How to identify multiple checkbox selected in JSF

Hi All,
My scenorio is.
I am diplaying records on page using <h:dataTable>
I have one column in dataTable which contains checkboxes which I displayed as,
<h:selectBooleanCheckbox id="abc" />
Also I have button on page.
I want to select 2 check boxes & then click onto button then that 2 records should get deleted.
how to identify that 2 checkbox selected ?
can anybody help ?
Thanks
Sandip

Hi BalusC
Thanks for your reply.
Is there any other approach to do this ?
because as per your approach my code will not work because you are using seperate bean.
If i try to compare your code with my code then I have to do changes in my entity bean which is not possible.
So is there any other way ,
If I want select more than 1 checkbox & delete those records of selected checkboxes .
i.e. I want to find which checkboxes selected on JSP page sothat I will get those selected value on Java side & will delete that record from java side.
Please help.
I am not finding any solution to this.
If any code then it will be a great help for me.
Thanks
Sandip

Similar Messages

  • Multiple checkbox selection in ALV and updating internal table

    Dear Expert,
    Can anyone tell me how to handle the multiple checkbox selection in ALV Grid report and then updating the internal table.
    I tried the option but it works only when i select only 1 row in ALV.
                    DO L_LINES TIMES.
                      read table icoas index rs_selfield-tabindex.
                      if sy-subrc = 0.
                        ICOAS-NOCHK = 'X'.
                        modify ICOAS INDEX rs_selfield-tabindex TRANSPORTING NOCHK.
                      ENDIF.
                    ENDDO.
    Requires help....
    Regards & Thanx,
    Bhupathi.

    Hi,
    Use this method to capture the check box event. Write this once you create your grid using CREATE OBJECT grid1.
    DATA:      GRID1 TYPE REF TO CL_GUI_ALV_GRID,
    CALL METHOD grid1->register_edit_event
      EXPORTING
        i_event_id = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED
      EXCEPTIONS
        ERROR      = 1
        others     = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
      LOOP AT T_GRIDDETAILS INTO WA_GRIDDETAILS.
        IF WA_GRIDDETAILS-CHECKBOX = 'X'.
                  "Do your operation
        ENDIF.
        CLEAR WA_GRIDDETAILS.
      ENDLOOP.

  • Identify multiple Excel selection ranges passed to VBA.

    If I select two ranges of a worksheet from within the worksheet/Excel itself and run a VBA (macro) to perform operations in VBA on the ranges, how do I identify those two selections in the VBA code to work with
    them?
    In other words, in the work book drag with the mouse to select a range, then Ctrl+drag a second range then call/run the macro/VBA. (For example, right-click drag cells B11 to B14, release, then Ctrl-right-click cell F1 (or F1 to F7). Then run the macro.)
    How do I reference those two selected ranges (B11:B14 and F1 or F1:F7from the example) in the VBA code?
    I see many example within VBA of selecting multiple ranges, but how do I refer to ones "passed" to the macro? (I'm thinking it would be something like Application.Selection.first and Application.Selection.second, etc but VB doesn't show anything
    to choose past Application.Selection .)
    Is it even possible to identify that two selections exist or is it all one selection, even if they are disjoint ranges?
    If it's all one selection (Application.Selection), how might I identify two non-contiguous ranges from within the selection and "split" them into two?
    I just found out that in Excel I can select three non-adjacent cells from any row or column, but I can only copy those three cells if they are on the same row or column. I didn't try more cells.
    This is all in Excel 2007.

    JimC, you get my ANSWERED vote!
    As near as I can tell, it does almost exactly what I need. I tested with four non-contiguous cell selections and the loop displays each one in the order selected.
    What it doesn't do is give the range of a contiguous area in the order of selection, meaning selecting e20 to a3 (dragging up to the left) gives range a3 to e20. Essentially, a range bigger than one cell is always identified as lowest order cell
    to highest order cell.
    I can handle that if needed by selecting individual cells through the range (as long as it's not too many cells) in the order I want to deal with them.

  • How to handle multiple option selected in JSP?

    Hi ,
    Imagine in a jsp page we have 7 check boxes with 7 different option.
    When user selects each chk box data should be fetched from respective table.
    Scenario:
    User can select 1 or more option in jsp page,in osb how to query multiple tables dynamically for the user selected options without using if else in message flow/switch in XQuery as no of combinations will be more .
    Can any of you guide us on this?
    Edited by: Anitha R on Feb 21, 2011 6:21 AM

    Hi Anuj -
    Thanks for the response.
    I understand your point,but thing is-
    For 7 options if we create 7 BS and for single selection based on the option selected we can invoke the respective BS.
    But if user selects more than 1 option ,i need union response of 2 respective business service .How can we achieve this , Do we have option to combine result from 2 DB adapter/2 BS to single result in OSB?
    Current method i try to follow,we have a single db adapter configured to get union response for all 7 options from DB.based on the user option i need to filter data for each eg - meterid i have in my master collection..planned to write query transformation of response data as needed for option user selects.Is this a better approach?Will this cause any performance issue?Because in my XQuery for each master data i'll fetch other details from DB using fn:bea execute sql..
    Kindly suggest any better approach to follow.
    Waiting for your earliest response.

  • How to implment multiple checkbox in labview

    Hi ,
    I have a case in which i need to make a panel with multiple checkboxes and select more then 2 or 3, is it possible to do , can you send an example.
    Attached is the example figure i need to implement in labview.
    Thanks,
    Ankit Gupta
    Attachments:
    checkboxes.png ‏26 KB

    Quick and dirty:
    Ingredients:
    1. Classic Cluster Set to Size to Fit and made fully transparent
    2. System Recessed Frame + Free label with transparent foreground
    3. Some number of System Checkboxes
    On the BD either Unbundle By Name or Cluster to Array are effective ways to deal with the individual values.
    Attachments:
    MulitpleCheckButtons.ctl ‏5 KB

  • How to handle multiple exception types in JSF 2?

    I'm trying to handle multiple exception types in JSF2, including a default error page for any unexpected exception types. The problems I'm having are:
    1) ViewExpiredException is handled only when no generic exception handler is specified
    2) "Regular" exceptions like NullPointerException are never handled
    My managed bean:
    @Named
    @SessionScoped
    public class MyController implements Serializable {
    /* A method that does nothing */
    public void doNothing() {
        //do nothing
    /* Generate a null pointer exception on purpose */
    public void generateNpe() throws NullPointerException {
        Object x = null;
        x.toString();
    My test page to generate the exception:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Test page</title>
    </h:head>
    <h:body>
        <h:form>
            <h:commandButton id="button1" value="do nothing" action="#{myController.doNothing}" />
            <h:commandButton id="button2" value="generate NPE" action="#{myController.generateNpe}" />
        </h:form>
    </h:body>
    </html>
    My web.xml:
    <!-- Redirect all NPEs to this page; this never works! -->
    <error-page>
        <exception-type>java.lang.NullPointerException</exception-type>
        <location>/error/error003.jsf</location>
    </error-page>
    <!-- Redirect all VEEs to this page; this works fine if the next section is excluded -->
    <error-page>
        <exception-type>javax.faces.application.ViewExpiredException</exception-type>
        <location>/error/error002.jsf</location>
    </error-page>
    <!-- This grabs everything, even with the previous sections defined.  If I exclude this error-page section, VEE works fine but NPE still does not get redirected -->
    <error-page>
        <exception-type>java.lang.Exception</exception-type>
        <location>/error/error001.jsf</location>
    </error-page>My questions are as follows:
    1) How can we handle "regular" java exceptions like NPE?
    2) How can we define a catch-all for unexpected exception types, while still respecting specific exception handlers for VEE, etc?
    Thanks,
    Benjamin

    Is your data model right? If you are adding in one and deleting in another it sounds to me more like a process that an entity, in which case you may revisit your data model and simplify it, add in a session bean with the process method to co-ordinate between the two.
    However, if you want to map multiple different tables within a single entity bean it is possible and just part of the mapping. How you actualyl specify it depends on which implementation you are working with.
    Cheers,
    Peter.

  • JTable - how to do multiple interval selections

    Suppose if i have a 10 rows in the table.
    By Default, How can i select multiple interval rows selection.
    Like 2,5,7,8,10 rows has to be selected.
    After loading i should be able to select different rows also.
    How can I do it.

    You can do that by using ListSelectionModel from the JTable by calling getSelectionModel()
    Detail of the selection model can be found inside Java API

  • URGENT - how to get the checkbox selected data from datatable.

    Hi
    I have some dynamic data. which will be displayed as checkbox. User can select the checkboxes in jsp. after selection when I submit the page I wanted to get the list of checkbox data the user selected.
    Here is the following code. when I submit the form the method which is mapped in bean (dostuff() method) is not calling. it is simply displaying the same page. Could you please tell me where I am doing wrong.
    please give me suggestion what I should to get the checkbox data in bean.
    My Code JSP:
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <f:view>
    <h:form>
    <h:dataTable id="xxx" var="person" value="#{checkboxBean.beans}" >
    <h:column><h:selectBooleanCheckbox value="#{person.checked}"/></h:column>
    <h:column><h:outputText value="#{person.id}"/></h:column>
    </h:dataTable>
    <h:commandButton id="details" action="#{checkboxBean.doStuff}" value="do Stuff"></h:commandButton>
    </h:form>
    </f:view>
    public class CheckboxBean {
    private static final Logger logger = Logger.getLogger(CheckboxBean.class);
    private List beans = null;
    public CheckboxBean() {
    logger.debug("CheckboxBean()");
    public String doStuff() {
    logger.debug("doStuff()");
    logger.debug("Some Bean selected data :" );
    return "test";
    public List getBeans() {
    beans = new ArrayList();
    SomeBean[] someBeans = new SomeBean[3];
    someBeans[0] = new SomeBean("first Person", false);
    someBeans[1] = new SomeBean("2nd Person", true);
    someBeans[2] = new SomeBean("third person", false);
    beans.add(someBeans[0]);
    beans.add(someBeans[1]);
    beans.add(someBeans[2]);
    logger.debug("Inside getBeans()");
    return this.beans;
    <managed-bean>
    <description>Checkbox bean.</description>
    <managed-bean-name>checkboxBean</managed-bean-name>
    <managed-bean-class>com.view.bean.CheckboxBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    * Created on Mar 17, 2006
    * TODO To change the template for this generated file go to
    * Window - Preferences - Java - Code Style - Code Templates
    package com.view.bean;
    public class SomeBean {
    private boolean checked = false;
    private String id ;
    public SomeBean() {
    public SomeBean(String anId, boolean bool) {
    super();
    this.id = anId;
    this.checked = bool;
    public String getId() {
    return this.id;
    public void setId(String id) {
    this.id = id;
    public boolean isChecked() {
    return this.checked;
    public boolean getChecked() {
    return this.checked;
    public void setChecked(boolean checked) {
    this.checked = checked;
    public String toString() {
    return "Id: " + id + ", checked :" + checked;
    }

    Hello,
    If you post in ASP.NET forums, you'll get more help.
    Thanks for your understanding.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Anyone know how to measure multiple file selections in a finder window?

    Hello,
    I have a flash drive that holds 8gbs. I have an enormous folder of images I am going to start passing to my buddy on the flash drive. Anybody know how I can select multiple files and know how big the selection will be prior to dragging them to the 8gb drive?
    Thank!
    Kirk

    Shift-click or command-click to select them, and then press the Option, Command, and I keys; the information in the window will change as the selection changes.
    (52489)

  • Multiple Checkbox Selection should not be not be allowed

    Hi,
    I have 4 checkboxes in a region ( based on transient attributes).
    I do not want the user to select more than one at any given time. How can I achieve this ?
    Would I need to write code in each setAttribute method for each attribute to check if the others are checked as well or is there another way ?
    Thank you
    Shanky

    Try Setting PPR for every Checkbox to make the other checkbox to become disable when one checkbox is checked.

  • Infopath 2010: How To Seperate Multiple Users Selected In People Picker With A Semicolon

    I've seen several posts on this forum about getting multiple user values in a people picker in Infopath to show up in a Sharepoint List.  Obviously, they merge which isn't all that useful if you want to use that data for a workflow. I followed
    Clayton Cobb's suggestion, and took a look at this blog which uses a
    no code solution, which is what i need. Everything for this blog works for me, but I do not need to use the UserProfile web service.
    I'm coming up just short though. I can successful select multiple users in my people picker, and as I do that, the text box populates itself separated by semicolons, but the same AccountId is repeated (of the 1st person selected in the people picker) instead
    of the unique value of each user.
    Here is my current result, with data fields shown
    Here is the result I would like to see. This way the text box gets upload into Sharepoint so I can use it in other places.
    Can someone please help me?  I'm very close.  Here is my function on the text box:
    eval(eval(Person, 'concat(/my:myFields/my:PersonTraveling/pc:Person/pc:AccountId, "; ")'), "..")
    XPath (advanced):
    xdMath:Eval(xdMath:Eval(/my:myFields/my:PersonTraveling/pc:Person, 'concat(/my:myFields/my:PersonTraveling/pc:Person/pc:AccountId, "; ")'), "..")

    Hi methitical,
    Please change your XPath (advanced) to
    xdMath:Eval(xdMath:Eval(/my:myFields/my:PersonTraveling/pc:Person, 'concat(pc:AccountId, "; ")'), "..")
    to make it work.
    Thanks & Regards,
    Emir
    Emir Liu
    TechNet Community Support

  • Multiple Checkbox

    Hello,
    How to make multiple checkbox in BPS (WAS)?
    A checkbox for each row?
    How to read the value of the checkbox fleg?
    Can anyone help me?

    902535 wrote:
    Hi,
    i have to make a frame using swing in which frame will contain multiple checkboxes(Eg.4),now suppose some one select one or two or three etc or all check box so depending upon selected checkbox the coresponding frame should come and after the clicking the save button the next frame should open for second checkbox(eg.A,B,C are the checkboxes and add,sub,mul are the coresponding frame and now if we select B,C checkbox so th first add sub frame should come after completing first frame work mul should come automatically similarly for all combination) please give any idea which could help me.
    thanksHello,
    if you don't have other unstated requirements (such as, the user should be able to jump to this or that other widget in the main frame while editing info in the new frames), each of your "frames" look like a widget that the user must finish dealing with before doing the next task.
    then it looks like a modal dialog (http://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html).
    In particular, a handy way to display modal dialogs is to use JOPtionPane;showXxxDialog(...) , also described in this page of the Swing tutorial.
    That could look something like:
    /** Called after user clicks "OK" */
    public void actionPerformed(...) {
        if (checkboxAdd.isSelected()) {
            JOptionPane.showMessageDialog(new AdditionPanel(...),...);
        if (checkboxSub.isSelected()) {
            JOptionPane.showMessageDialog(new SubstractionPanel(...),...);
        if (checkboxMul.isSelected()) {
            JOptionPane.showMessageDialog(new MultiplicationPanel(),...);
    }Best regards,
    J.

  • Make html:checkbox selected by default depending upon bean value --struts

    Hi all,
    I have a doubt regarding the html:checkbox .
    I have the following code in my jsp.
    I am giving it inside logic:iterate tag and fetching the value from session scope.
    <html:checkbox property ="readchk" value ="read" indexed="true" onclick="return assignme(this.value,this.checked,'s')"/>
    How to make this checkbox selected by default.
    "readchk" (bean) is in my ActionForm, it has been been assigned either
    0 or 1 .
    I want to make the checkbox selected by default if the readchk is 1
    and the checkbox not selected if the readchk value is 0.
    Could anybody please help me out in fixing this problem.
    Thanks
    Parvathi

    If u give the value for ur check box in the action form it wld be checked!!
    regards
    Shanu

  • How to handle multiple selection in the Spark List control with checkbox as itemrenderer?

    Hi All,
    I am using checkbox as an ItemRenderer in spark list.
    I have a query.
    how to handle multiple selection in the Spark List control with checkbox as itemrenderer?
    how to retrieve the selected item label?
    Thank you in advance.

    Hi there, I'll tweak your code a little bit to something like this:
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                    layout="vertical">
        <mx:Script>
            <![CDATA[
                 import mx.events.ListEvent;
                 import mx.controls.CheckBox;
               [Bindable]
               private var mySelectedIndexes:ArrayCollection=new ArrayCollection();
                private function onChange(e:ListEvent):void
                   if(CheckBox(e.itemRenderer).selected){
                             mySelectedIndexes.addItem(e.rowIndex);
                   }else{
                                  mySelectedIndexes.removeItemAt(mySelectedIndexes.getItemIndex(e.rowIndex));     
                   chkList.selectedIndices=mySelectedIndexes.toArray();
            ]]>
        </mx:Script>
    <mx:ArrayCollection id="collection">
            <mx:Object label="Test A"/>
            <mx:Object label="Test B"/>
            <mx:Object label="Test C"/>
            <mx:Object label="Test D"/>
            <mx:Object label="Test E"/>
            <mx:Object label="Test F"/>
            <mx:Object label="Test G"/>
        </mx:ArrayCollection>
    <mx:List id="chkList" dataProvider="{collection}" itemRenderer="mx.controls.CheckBox"  itemClick="onChange(event);" allowMultipleSelection="true"/>
    </mx:Application>

  • How to read data after select multiple record by checkbox,

    hi experts
    i  m using simple report with check box , and itab whcih contain records
    how to read data after select multiple record by checkbox,
    thanks

    Hi Prashant,
       Try using this logic.This Code displays the list with check boxes. When you check a checkbox and press a button say 'Select All' or 'De Select all' or 'Display'. It will read the data of those records.
    DATA :
      fs_flight TYPE type_s_flight,
      fs_flight1 TYPE type_s_flight1.
    * Internal tables to hold Flight  Details                             *
    DATA :
      t_flight LIKE
      STANDARD TABLE
            OF fs_flight,
      t_flight1 LIKE
       STANDARD TABLE
             OF fs_flight1.
    SET PF-STATUS 'SELECT' .
    PERFORM selection.
    PERFORM displaybasic .
    *                      AT USER COMMAND EVENT                          *
    AT USER-COMMAND.
      PERFORM selectall .
    *&      Form  SELECTION
    *      Select query to reteive data from SPFLI table
    *  There are no interface parameters to be passed to this subroutine.
    FORM selection .
      SELECT  carrid                       " Airline Code
              connid                       " Flight Connection Number                  
        FROM  spfli
        INTO TABLE t_flight.
      DESCRIBE TABLE t_flight LINES w_lines .
    ENDFORM.                               " SELECTION
    *&      Form  DISPLAYBASIC
    *      Display the basic list with SPFLI data
    *  There are no interface parameters to be passed to this subroutine.
    FORM displaybasic .
      LOOP AT t_flight INTO fs_flight.
        WRITE :
             w_check AS CHECKBOX,
             w_mark,
             fs_flight-carrid UNDER text-001,
             fs_flight-connid UNDER text-002.
      ENDLOOP.                             " LOOP AT T_FLIGHT..
      CLEAR fs_flight-carrid .
      CLEAR fs_flight-connid.
    ENDFORM.                               " DISPLAYBASIC
    *&      Form  SELECTALL
    *      To check all the checkboxes with a 'selectall' push button
    *  There are no interface parameters to be passed to this subroutine.
    FORM selectall .
      CASE sy-ucomm.
        WHEN 'SELECT_ALL'.
          w_check = 'X'.
          w_line = 4 .
          DO w_lines TIMES.
            READ LINE w_line .
            MODIFY LINE w_line FIELD VALUE w_check .
            ADD 1 TO w_line .
          ENDDO.                           " DO W_LINES TIMES
          CLEAR w_line.
        WHEN 'DESELECTAL'.
          w_check = space.
          w_line = 4 .
          DO w_lines TIMES.
            READ LINE w_line FIELD VALUE w_mark .
            IF w_mark = space .
              MODIFY LINE w_line FIELD VALUE w_check .
            ENDIF.                         " IF W_MARK = SPACE
            ADD 1 TO w_line .
          ENDDO.                           " DO W_LINES TIMES
        WHEN 'DISPLAY'.
    IF sy-lilli BETWEEN 4 AND w_lines .
        DO w_lines TIMES.
          READ LINE w_num FIELD VALUE w_check INTO w_check
                                     fs_flight-carrid INTO fs_flight-carrid
                                     fs_flight-connid INTO fs_flight-connid.
          IF sy-subrc = 0.
            IF w_check = 'X'
              SELECT  carrid
                      connid
                      fldate               " Flight date
                      seatsmax             " Maximum capacity in economy
                      seatsocc             " Occupied seats in economy class
                FROM  sflight
                INTO  TABLE t_flight1
               WHERE  carrid = fs_flight-carrid
                 AND  connid = fs_flight-connid.
              LOOP AT t_flight1 INTO fs_flight1.
                WRITE :
                  / fs_flight-carrid UNDER text-001,
                    fs_flight-connid UNDER text-002,
                    fs_flight1-fldate UNDER text-007,
                    fs_flight1-seatsmax UNDER text-008,
                    fs_flight1-seatsocc UNDER text-009.
              ENDLOOP.
            ENDIF.                         " IF SY-SUBRC = 0
          ENDIF.                           " IF W_CHECK = 'X'.
          ADD 1 TO w_num.
        ENDDO.                             " DO W_LINES TIMES
        CLEAR w_check.
        w_num = 0.
      ELSE .
        MESSAGE 'INVALID CURSOR POSITION ' TYPE 'E' .
      ENDIF.                               " IF SY-LILLI BETWEEN..
    ENDCASE.                             " CASE SY-UCOMM
    ENDFORM.                               " SELECTALL
    Much Regards,
    Amuktha.

Maybe you are looking for

  • Copying Titles

    I've selected the font, font size, text color and background color for captions. Is there a way that I can copy these preferences and paste them onto other clips so that all I have to do is change the words in the caption for the new clips? Or do I h

  • Black Thumbnails & Previews

    I've had a problem pop up recently, a number of my pictures are now showing up with black thumbnails and previews.  I have tried everything, deleting and re-generating both, repairing permissions, rebuilding database, even working on another computer

  • How to compare 2 columns in a cross tab

    Hi, I need some idea on how to compare 2 columns in a cross tab in Deski. Original Table is like this: Type..............ID...........Name Type1............1............BO1 Type1............2............BO1 Type1............3............BO2 Type2....

  • Length of 2d arrays

    If I have this array specified: String[][] myArray = new String[5][10];Is there a way to use the ".length" variable to get both the "lenght" and the "width" (5 and 10) for this array? It's awefully handy with regular 1D arrays, but I'm getting a litt

  • No Matching Records found in OOEI Table

    Can Any one Give me the clearance of the given below mentined error No matching records found  'G/L Accounts' (OACT) (ODBC -2028)  [Message 131-183] When we add the out going excice invoice based on delivary we got the bove error Regards, Venkat.