Need code for Dynamic check box creation in struts

dynamic checkbox should be created with details of data stored in database(with check mark for already selected check box).
once user make any change to that page and click submit the result ahould be saved in database..
can anybody explain me how to proceed this.
If any sample source code you have plz do sent me..

consider these are the details in database
1. apple checked
2. orange
3. mango
4. grapes checked
consider a jsp page which should display list of fruits in the datsbase,
the jsp page should retrieve these data and diaplay with check box.
These should be generated dynamically.
Assume the jsp page has option for user to enter some other fruit name which should be updated into database of fruits and that should be displayed with the jsp page during next visit.(i.e) number of fruits in the database is not constant.

Similar Messages

  • Dynamic check box creation in selection screen

    Hello,
    I am trying to put up some check boxes dynamically in a selection screen. The number: of check boxes required and the 'checkbox label text' is to be retrieved from a database table. I have retrieved all these values in AT SELECTION-SCREEN OUTPUT event. But, I dont know how to create check box parameters using these dynamic values.  Please help..

    hi Giffin,
    Create a program with name 'Z_13317_DYN_CHKBOX' and paste the following code in it. Also make ensure that an include with name 'Z_13317_DYN_INCL' is not existing earlier because this program will be overwritten each and everytime.
    Z_13317_DYN_CHKBOX will take an integer as an input. After giving input, click on the button on selection screen.
    Suppose, if you have given 3 as input and if you have clicked the button, then 3 checkboxes will be generated on your selection screen.
    REPORT  Z_13317_DYN_CHKBOX.
    types :begin of t_itab1,
            line(72),
           end of t_itab1.
    data: incl type table of t_itab1 with header line.
    parameters: p_tab type i,
                p_frst type c no-display.
    selection-screen begin of line.
    selection-screen: pushbutton 2(20) but1 user-command cli1.
    selection-screen end of line.
    include z_13317_dyn_incl if found.
    initialization.
    at selection-screen output.
      if p_frst = ' '.
        p_frst = 'X'.
        perform crt_dyn_incl.
      endif.
    at selection-screen.
      case sy-ucomm.
        when 'CLI1'.
        perform crt_dyn_incl.
      endcase.
    *&      Form  crt_dyn_incl
    *       text
    form crt_dyn_incl .
      perform populate_incl.
      perform del_incl.
      insert report 'Z_13317_DYN_INCL' from incl.
      commit work.
      submit z_13317_dyn_chkbox via selection-screen with p_frst = p_frst.
    endform.                    " crt_dyn_incl
    *&      Form  del_incl
    *       text
    form del_incl .
      call function 'RS_DELETE_PROGRAM'
        exporting
         program                          = 'Z_13317_DYN_INCL'
         suppress_checks                  = 'X'
         suppress_popup                   = 'X'
         with_cua                         = ' '
         with_documentation               = ' '
         with_dynpro                      = 'X'
         with_includes                    = ' '
         with_textpool                    = ' '
         with_variants                    = ' '
      if sy-subrc <> 0.
      endif.
    endform.                    " del_incl
    *&      Form  populate_incl
    *       text
    form populate_incl .
      data: v_cnt type n.
      do p_tab times.
        v_cnt = v_cnt + 1.
        incl-line = 'parameters: '.
        concatenate incl-line 'p_chk' v_cnt into incl-line.
        concatenate incl-line 'as checkbox.' into incl-line separated by space.
        append incl.
        clear incl.
      enddo.
    endform.                    " populate_incl
    Regards,
    Sailaja.

  • Please send me the exit name to add my code for AUTLF check box for VA02

    Hi All,
    My requirement is as follows,
    1) The scope of this enhancement is required only for transaction VA02 - Change Sales Order, order-type maintained in table TVARV
    2) In the program, if User tries to uncheck the checkbox – Complete delivery (VBAK-AUTLF), program to check if there are subsequent deliveries for stock reservation (Delivery type ZRES) are existing or not.  If the deliveries are existing, an appropriate error message should be displayed and user should be restricted from performing this activity.
    So please tell me where to insert my code? according to my requirement and also please send me the user exit or function module exit
    Thanx in advance,
    santhosh.

    USER EXIT
    http://www.sap-img.com/abap/a-short-tutorial-on-user-exits.htm
    http://www.sapgenie.com/abap/code/abap26.htm
    http://www.sap-img.com/abap/what-is-user-exits.htm
    http://wiki.ittoolbox.com/index.php/HOWTO:Implement_a_screen_exit_to_a_standard_SAP_transaction
    http://www.easymarketplace.de/userexit.php
    http://www.sap-img.com/abap/a-short-tutorial-on-user-exits.htm
    http://www.sappoint.com/abap/userexit.pdfUser-Exit
    http://www.sap-img.com/ab038.htm
    http://help.sap.com/saphelp_46c/helpdata/en/64/72369adc56d11195100060b03c6b76/frameset.htm
    http://www.sap-img.com/abap/a-short-tutorial-on-user-exits.htm
    http://www.sap-img.com/abap/what-is-user-exits.htm
    http://expertanswercenter.techtarget.com/eac/knowledgebaseAnswer/0,295199,sid63_gci982756,00.html
    Rewards if useful.........
    Minal

  • Need code for dynamic insertion of a MIME object(image) into WebDynpro View

    Hi experts,
    I am attempting to insert an image into a view at runtime, using lines of code.
    I know that this code must be present in the WDDOMODIFYVIEW method of that particular view.
    However I am not sure about the lines of code which can do this. Can anyone please help me out with this........
    Thanks in advance,
    Adithya.

    Hi.,
    Yes you can add MIME at runtime ., Check this.,
    [MIME at run in WDA |Can mime object be created at run-time?;
    also ., [Display logo at runtime in WDA|Mime logo not displaying;
    hope this helps u.,
    Thanks & Regards
    Kiran

  • Dynamic check box

    Hi I need help from all java expertise, I need to create dynamic check boxes. table have the customer name, one customer have multiple locations, on selection of customer name, all the locations should be displayed with chek box option, so that the user will allocate some rebate or ajustment to a particular location. How to achive this. any help will be appericiated
    thanks

    Lets assume that you got your customer information and everything is stored in a ResultSet rs
    The value of the radio buttons in this case will be the customer name but you can change it
    to whatever you want that way you can get the parameter accordingly to do your updates.
    <%
    ResultSet rs = ....... ;
    for( int n = 1; n <= rs.size(); n++ )
    while (rs.next()) {
    String custName = rs.getString("CUSTOMER_NAME");
    String custLoc = rs.getString("CUSTOMER_LOCATION");
    %>
    <tr>
    <td BGCOLOR="#FFFFCE" valign="top" align="left"><input type="radio" name="radioButton" value="<%=custName%>"> </td>
    <td BGCOLOR="#FFFFCE" valign="top" align="left"><%=custName%> </td>
    <td BGCOLOR="#FFFFCE" valign="top" align="left"><%=custLoc%> </td>
    </tr>
    <% } // end while loop
    } // end for loop
    %>
    </table>

  • Need code for Sales order creation in oops using xi as integration server

    Need code for Sales order creation in oops using xi as integration server.

    hi rocky,
              could you pls give a bit explanation on what you are expecting.
    regards,
    Pavan

  • Apex with dynamic check box....

    hi to all:
    i have report emp.it contain data like eno,ename,sal,record .
    example:eno ename sal record
    100 a 100
    200 b 3000 going on...
    using this column i am making report by using apex and report contain one submit button also.
    1)in this report i am creating dynamic check box depend on eno..see my coding
    declare
    str varchar2(3000);
    begin
    str:='select htmldb_item.CHECKBOX(10,eno,DECODE(record,1,''CHECKED'')) "SELECT" ,eno,ename,sal ,record from emp where 1=1';
    return str;
    end;
    2)in process created after  submit
    iam created pl/code like ..this code for
    declare
    i number;
    str varchar2(2000);
    emp_id number;
    begin
    FOR i in 1..HTMLDB_APPLICATION.G_F10.count
    LOOP
    IF HTMLDB_APPLICATION.G_F10(i) is not null then
    SELECT htmldb_application.G_F10(i) INTO emp_id from dual;
    --insert into my_log values(emp_id);commit;
    update emp set record=1 where eno=emp_id ;
    commit;
    else if HTMLDB_APPLICATION.G_F10(i) is null then
    update emp set record=0 where eno=emp_id ;
    commit;
    else
    null;
    end if;
    end loop;
    end;
    my requirenent:
    a)if check box checked then -update -record column -1
    b)if check box uncked then -update - record column -0
    in process coding--
    eno alway is not null only..
    so i want to do check box with update the record column..like this
    a)if check box checked then -update -record column -1
    b)if check box uncked then -update - record column -0
    pls give solution.
    output i want like this example:
    chebox eno ename sal record
    checked(X) 100 a 300 1
    checked(x) 200 b 300 1
    next time i am trying to make uncheck first row like
    chebox eno ename sal record
    unchecked 100 a 300 0
    checked(x) 200 b 300 1

    Hi VKR,
    Please try this,
    <cfform name="frmTest"  format="Flash" action="test.cfm" method="post"  >
    <cfscript>
        qryCountry = queryNew("Country,CountryID");   
          queryAddRow(qryCountry);  
          querySetCell(qryCountry, "Country", "India");  
          querySetCell(qryCountry, "CountryID", "1");  
          queryAddRow(qryCountry);  
          querySetCell(qryCountry, "Country", "England");
           querySetCell(qryCountry, "CountryID", "2");    
          queryAddRow(qryCountry);  
          querySetCell(qryCountry, "Country", "Kenya");
           querySetCell(qryCountry, "CountryID", "3");      
    </cfscript>   
        <cfformgroup type="repeater"  query="qryCountry">                       
            <cfinput type="checkbox" value="{qryCountry.currentItem.CountryID}" name="chk" Label="{qryCountry.currentItem.Country}">                               
        </cfformgroup>
        <cfinput type="submit" name="submit" width="100" value="Submit"  >
    </cfform>
    Hope this will help

  • Need code for restarting my system

    hello every body i need code for restarting system
    this code does not work
    try {
    Runtime.getRuntime().exec("shutdown -s -t01") // stop
    }catch(...
    or
    try {
    Runtime.getRuntime().exec("shutdown -r -t01") // reboot
    }catch(...
    or
    try {
    Runtime.getRuntime().exec("shutdown -l -t01") // logout
    }catch(...

    write a jni function that calls this method : ExitWindowsEx()
    check the documentation

  • Need code for sales order create report using bapi's

    need code for sales order create report using bapi's

    Hi,
    Go through below link
    http://www.saptechies.com/bapi_salesorder_createfromdat2/
    <b>Reward points if it helps,</b>
    Satish

  • Need code for ITC502

    I need code for gpib to ITC 502.
    Need to set temperature and threshold,
    thankx

    The instruction manual for this instrument is available from Oxford
    Instruments at no charge- they sent me a copy by email as a PDF file. I
    don't have it to hand at the moment so can't dig out the relevant info but
    it would be worth having the full manual, I think. There's a bit more to a
    decent driver than simply setting the temperature, and I'm not sure what you
    mean by "threshold".
    "mdeleon" wrote in message
    news:[email protected]..
    > I need code for gpib to ITC 502.
    > Need to set temperature and threshold,
    > thankx

  • Need code for padding (spacing) 5 navigation links in my #topnavbar internal style

    need code for padding (spacing) 5 navigation links in my #topnavbar internal style

    I'm new at this and the below code is regarding the navigation bar and links
    I started using a template to create the first html page and made copies of it to create the other four.
    All the links work but I wanted to space them apart further.
    They look basically like this horizontally: Home About Us Photo Gallery Services Contact Us
    #topnavbar {
    text-align:center;
    #topnavbar a:link a:visited{
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 100%;
    font-weight: bold;
    color: #039;
    text-decoration: none;
    margin: 0 25px:
    #topnavbar a:hover a:active {
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 100%;
    font-weight: bold;
    color: #039;
    text-decoration: none;
          <div id="topnavbar">
          <nav>
          <p><a href="index.html">Home</a>  
             <a href="aboutus.html">About Us</a>  
             <a href="photogallery.html">Photo Gallery</a>
             <a href="services.html">Services</a>
             <a href="contactus.html">Contact Us</a></p>  
          </nav>
           </div>

  • Urgently Need Code for Copy & Paste from Html Table in JSP to Excel file

    I am creating a html table in JSP file .
    I need code for 'Cut,Copy,Paste' functions ie. if someone wants to copy data from my table to excel file or from excel file to html table he shud be able to do that.
    Can someone give me code for 'Cut,Copy and Paste' i.e. some javascript functions which can do cut, copy and paste which i can put in my jsp file
    Thanks
    Message was edited by:
    javatechguru2007

    package com.chinmayananda
    public class Tetris{
    // complete here
    code]
    public abstract class AbstractTetris {
       public abstract void start();
       public abstract void stop();
    }nearly done

  • I'm new to jsf VWP..i need code for searching

    Hi,
    i need code for search...
    just populate records from database using jsf VWP5.5.1
    how to bind in table.
    we enter name r value in textbox click button related records display to table.how write code in button.
    pls help me....

    Don't crosspost. Please proceed here: http://forum.java.sun.com/thread.jspa?threadID=5211369

  • Dynamic Check Box Error

    Hi All,
            I have created Dynamic UI Checkbox which is creating dynamic checkboxes based on the database Table fields.
    Here is my code in Start View
    // This file has been generated partially by the Web Dynpro Code Generator.
    // MODIFY CODE ONLY IN SECTIONS ENCLOSED BY @@begin AND @@end.
    // ALL OTHER CHANGES WILL BE LOST IF THE FILE IS REGENERATED.
    package com.titan.retailauditreport;
    // IMPORTANT NOTE:
    // ALL IMPORT STATEMENTS MUST BE PLACED IN THE FOLLOWING SECTION ENCLOSED
    // BY @@begin imports AND @@end. FURTHERMORE, THIS SECTION MUST ALWAYS CONTAIN
    // AT LEAST ONE IMPORT STATEMENT (E.G. THAT FOR IPrivateStartView).
    // OTHERWISE, USING THE ECLIPSE FUNCTION "Organize Imports" FOLLOWED BY
    // A WEB DYNPRO CODE GENERATION (E.G. PROJECT BUILD) WILL RESULT IN THE LOSS
    // OF IMPORT STATEMENTS.
    //@@begin imports
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.ResultSetMetaData;
    import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDCheckBox;
    import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTransparentContainer;
    import com.sap.tc.webdynpro.progmodel.api.IWDNode;
    import com.sap.tc.webdynpro.progmodel.api.IWDNodeElement;
    import com.sap.tc.webdynpro.progmodel.api.IWDNodeInfo;
    import com.sap.tc.webdynpro.progmodel.api.IWDUIElement;
    import com.titan.retailauditreport.wdp.IPrivateStartView;
    //@@end
    //@@begin documentation
    //@@end
    public class StartView
    Logging location.
      private static final com.sap.tc.logging.Location logger =
        com.sap.tc.logging.Location.getLocation(StartView.class);
      static
        //@@begin id
        String id = "$Id$";
        //@@end
        com.sap.tc.logging.Location.getLocation("ID.com.sap.tc.webdynpro").infoT(id);
    Private access to the generated Web Dynpro counterpart
    for this controller class.  </p>
    Use <code>wdThis</code> to gain typed access to the context,
    to trigger navigation via outbound plugs, to get and enable/disable
    actions, fire declared events, and access used controllers and/or
    component usages.
    @see com.titan.retailauditreport.wdp.IPrivateStartView for more details
      private final IPrivateStartView wdThis;
    Root node of this controller's context. </p>
    Provides typed access not only to the elements of the root node
    but also to all nodes in the context (methods node<i>XYZ</i>())
    and their currently selected element (methods current<i>XYZ</i>Element()).
    It also facilitates the creation of new elements for all nodes
    (methods create<i>XYZ</i>Element()). </p>
    @see com.titan.retailauditreport.wdp.IPrivateStartView.IContextNode for more details.
      private final IPrivateStartView.IContextNode wdContext;
    A shortcut for <code>wdThis.wdGetAPI()</code>. </p>
    Represents the generic API of the generic Web Dynpro counterpart
    for this controller. </p>
      private final com.sap.tc.webdynpro.progmodel.api.IWDViewController wdControllerAPI;
    A shortcut for <code>wdThis.wdGetAPI().getComponent()</code>. </p>
    Represents the generic API of the Web Dynpro component this controller
    belongs to. Can be used to access the message manager, the window manager,
    to add/remove event handlers and so on. </p>
      private final com.sap.tc.webdynpro.progmodel.api.IWDComponent wdComponentAPI;
      public StartView(IPrivateStartView wdThis)
        this.wdThis = wdThis;
        this.wdContext = wdThis.wdGetContext();
        this.wdControllerAPI = wdThis.wdGetAPI();
        this.wdComponentAPI = wdThis.wdGetAPI().getComponent();
      //@@begin javadoc:wdDoInit()
      /** Hook method called to initialize controller. */
      //@@end
      public void wdDoInit()
        //@@begin wdDoInit()
    //          IWDNodeInfo node=wdContext.getNodeInfo().addChild("DynamicNode",null,true,true,false,false,false,true,null,null,null);
    //         IPrivateStartView.INodeAElement ele=wdContext.createNodeAElement();
    //         wdContext.nodeNodeA().addElement(ele);
    //         IWDNodeInfo multiplenode=wdContext.nodeNodeA().getNodeInfo();
    //         IWDNodeInfo multipleinfo=multiplenode.addChild("MultiNode",null,true,true,false,false,false,true,null,null,null);
    //          multiplenode.addAttribute("roles", "ddic:com.sap.dictionary.string");
    //          multipleinfo.addAttribute("roles", "ddic:com.sap.dictionary.string");
    //          IWDNodeElement elem;
         //IWDNodeInfo node=wdContext.getNodeInfo().addChild("DynamicNode",null,true,true,false,false,false,true,null,null,null);
         //node.addAttribute("BrandID");
        ResultSet rs=null;
        ResultSetMetaData rsmd=null;
        Connection con=null;
        PreparedStatement pst=null;
        String status="SELECT BrandMaster.BrandID,BrandMaster.BrandName FROM BrandMaster WHERE BrandMaster.BrandID=?";
        try{
             Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
             wdComponentAPI.getMessageManager().reportSuccess("Driver Loaded");
             con=DriverManager.getConnection("jdbc:odbc:Pankaj");
             wdComponentAPI.getMessageManager().reportSuccess("Connected");
             pst=con.prepareStatement(status);
             pst.setInt(1,1);
             rs=pst.executeQuery();
             wdComponentAPI.getMessageManager().reportSuccess("Query Fired");
             rsmd=rs.getMetaData();
             int ttlcolumns=rsmd.getColumnCount();
             wdComponentAPI.getMessageManager().reportSuccess("Populating Data1");
              IWDNodeInfo node=wdContext.getNodeInfo().addChild("DynamicNode",null,true,true,false,false,false,true,null,null,null);
              //node.addAttribute("BrandID","BrandID:com.titan.retailauditreport");
              node.addAttribute("BrandID",);
             while(rs.next())
                  wdComponentAPI.getMessageManager().reportSuccess("Populating Data");
    //               IWDNode node1=wdContext.nodeNodeA().getChildNode("MultiNode",IWDNode.NO_SELECTION);
    //               IWDNodeElement elem=wdContext.nodeNodeA().createElement();
    //               node1.addElement(elem);
                   IWDNode node1=wdContext.getChildNode("DynamicNode",0);
                   IWDNodeElement ne1=node1.createElement();          
                   for(int i=1;i<=ttlcolumns;i++)
                        if(i==1)
                             //elem.getBrandID(rs.getString(i));
                             String s1=rs.getString(i);
                             ne1.getAttributeValue("BrandID"+s1);
                        else if(i==2)
                             //elem.getBrandName(rs.getString(i));
                             //String BN=setBrandName((rs.getString(i)));
                             String s2=rs.getString(i);
                             ne1.getAttributeValue("BrandName"+s2);
                   rs.close();
                   pst.close();
                   con.close();
                   wdComponentAPI.getMessageManager().reportSuccess("Resources Closed");
         catch(Exception e)
              wdComponentAPI.getMessageManager().reportException("Error  "+e,true);
        //@@end
      //@@begin javadoc:wdDoExit()
      /** Hook method called to clean up controller. */
      //@@end
      public void wdDoExit()
        //@@begin wdDoExit()
        //@@end
      //@@begin javadoc:wdDoModifyView
    Hook method called to modify a view just before rendering.
    This method conceptually belongs to the view itself, not to the
    controller (cf. MVC pattern).
    It is made static to discourage a way of programming that
    routinely stores references to UI elements in instance fields
    for access by the view controller's event handlers, and so on.
    The Web Dynpro programming model recommends that UI elements can
    only be accessed by code executed within the call to this hook method.
    @param wdThis Generated private interface of the view's controller, as
           provided by Web Dynpro. Provides access to the view controller's
           outgoing controller usages, etc.
    @param wdContext Generated interface of the view's context, as provided
           by Web Dynpro. Provides access to the view's data.
    @param view The view's generic API, as provided by Web Dynpro.
           Provides access to UI elements.
    @param firstTime Indicates whether the hook is called for the first time
           during the lifetime of the view.
      //@@end
      public static void wdDoModifyView(IPrivateStartView wdThis, IPrivateStartView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
        //@@begin wdDoModifyView
        if(firstTime)
              IWDTransparentContainer theGroup= (IWDTransparentContainer)view.getElement("RootUIElementContainer");
              theGroup.createLayout(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDMatrixLayout.class);
              theGroup.destroyAllChildren();
              IWDUIElement uiElement = null;
             IWDCheckBox icb=(IWDCheckBox)view.createElement(IWDCheckBox.class,"CheckB");
              //IWDAttributeInfo info = wdContext.getNodeInfo().getChild("NodeA").getChild("MultiNode").getAttribute("roles");
              icb.bindChecked("DynamicNode.BrandID");
              uiElement=icb;
              theGroup.addChild(uiElement);
        //@@end
    The following code section can be used for any Java code that is
    not to be visible to other controllers/views or that contains constructs
    currently not supported directly by Web Dynpro (such as inner classes or
    member variables etc.). </p>
    Note: The content of this section is in no way managed/controlled
    by the Web Dynpro Designtime or the Web Dynpro Runtime.
      //@@begin others
      //@@end
    But iam not able to add attribute in the statement
    int ttlcolumns=rsmd.getColumnCount();
             wdComponentAPI.getMessageManager().reportSuccess("Populating Data1");
              IWDNodeInfo node=wdContext.getNodeInfo().addChild("DynamicNode",null,true,true,false,false,false,true,null,null,null);
              //node.addAttribute("BrandID","BrandID:com.titan.retailauditreport");
              node.addAttribute("BrandID",);
    its throwing an error
    Error:com.sap.tc.webdynpro.services.exceptions.WDTypeNotFoundException: type Boolean not found
    Is that my database connectivity code ?
    Can anybody plz help me out?
    i
    Thanks and Regards
    Santosh Saraf

    Hi,
        It didnt work.So i changed my coding,Iam able to get checkbox.
    Here is my code
      public static void wdDoModifyView(IPrivateStartView wdThis, IPrivateStartView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
        //@@begin wdDoModifyView
        IWDMessageManager msgMngr=wdThis.wdGetAPI().getComponent().getMessageManager();
         if(firstTime)
              //IWDTransparentContainer theGroup= (IWDTransparentContainer)view.getElement("RootUIElementContainer");
              IWDTransparentContainer theGroup= (IWDTransparentContainer)view.getElement("TransparentContainer");
              theGroup.createLayout(com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDMatrixLayout.class);
              theGroup.destroyAllChildren();
              //IWDUIElement uiElement = null;
              //IWDUIElement uiElement1 = null;
              IWDUIElement uiElementnew = null;
              //IWDCheckBox icb2=(IWDCheckBox)view.createElement(IWDCheckBox.class,"CheckA");
              //IWDCheckBox icb1=(IWDCheckBox)view.createElement(IWDCheckBox.class,"CheckB");
              //icb1.setText("Checkbox1");
              //icb2.setText("Checkbox2");
              Connection con=null;
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con=DriverManager.getConnection("jdbc:odbc:Pankaj");
    Statement st=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
    ResultSet rs=st.executeQuery("select * from BrandMaster");
    int count=0;
    while(rs.next())
         count++;
    msgMngr.reportSuccess(""+count);
    rs.beforeFirst();
    IWDNodeInfo node=wdContext.getNodeInfo().addChild("DynamicNode",null,true,true,false,false,false,true,null,null,null);
    node.addAttribute("BrandID","ddic:com.sap.dictionary.boolean");
    while(rs.next())
         IWDNode node1=wdContext.getChildNode("DynamicNode",0);
         IWDNodeElement ne1=node1.createElement();
         ne1.setAttributeValue("BrandID",new Boolean(true));
         //ne1.getAttributeValue("BrandID"+rs.getString(2));
         IWDCheckBox icbnew=(IWDCheckBox)view.createElement(IWDCheckBox.class,"Checknew");
         icbnew.setText(rs.getString(2));
         icbnew.bindChecked("DynamicNode.BrandID");
         uiElementnew=icbnew;
         theGroup.addChild(uiElementnew);
    msgMngr.reportSuccess(""+count);
    catch(Exception e)
              //IWDAttributeInfo info = wdContext.getNodeInfo().getChild("NodeA").getChild("MultiNode").getAttribute("roles");
    //          icb1.bindChecked("DynamicNode.BrandID");
    //          icb2.bindChecked("DynamicNode.BrandID");
    //          uiElement=icb1;
    //          uiElement1=icb2;
    //          theGroup.addChild(uiElement);
    //          theGroup.addChild(uiElement1);
              try
              {if(con!=null)
    con.close();
              catch(Exception e)
        //@@end
    The following code section can be used for any Java code that is
    not to be visible to other controllers/views or that contains constructs
    currently not supported directly by Web Dynpro (such as inner classes or
    member variables etc.). </p>
    Note: The content of this section is in no way managed/controlled
    by the Web Dynpro Designtime or the Web Dynpro Runtime.
      //@@begin others
      //@@end
    But now the problem is i need to have five dynamic checkboxes based on my tablebut iam getting only one check box with the first value of a column in a table(First Row).
    I want to display all the five rows,even if iam giving the rs.next in while loop.
    Here ia my table structure
    Master Table
    BrandID      BrandName
    1             abc
    2             def
    3             ghi
    4             jkl
    5             mno
    Iam getting the only one checkbox with abc as text,i want all the five rows checkbox.
    Plz help me out in this regard
    Thanks and Regards
    Santosh Saraf

  • Dynamic check box status android app

    Hello All,
                   I desperately need your help. I have created dynamically created check boxes depending on my selection for my android app using the following code snippet.
    for(var i:int=0 ; i<data.PromptText.length; i++)
                                                       chk = new CheckBox();
                                                       chk.label= data.PromptText.getItemAt(i);
                                                       chk.name=data.ResponsePromptID.getItemAt(i);
                                                       chk.addEventListener(MouseEvent.CLICK,ClickEvent);
                                                       chk.width = 1000;
                                                       chk.height = 50;
                                                       addElement(chk);
    Now after click on each check box, I need to check which check box of the list of check boxes created ?
    Please help me, this is driving me nuts.

    Hi,
    I see you have "addElement" rather than "addChild", so this is Flex, right?
    So there is an easier way to do that in any case, I think.
    For example, you could use CheckBox to create a custom renderer and then use your PromptText IList as dataProvider to a list, something like this:
    1. Your item renderer
    [code]
    <?xml version="1.0" encoding="utf-8"?>
    <s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                                            xmlns:s="library://ns.adobe.com/flex/spark"
                                            xmlns:mx="library://ns.adobe.com/flex/mx"
                                            autoDrawBackground="true"
                                             width="100%" mouseDown="itemrenderer1_mouseDownHandler(event)"
                                            >
    <fx:Script>
              <![CDATA[
                         * Override selected to provide bindable property
                         * as ItemRenderer.selected is not flagged as bindable.
                        override public function set selected(value:Boolean):void {
                                  super.selected = value;
                                  cbSelect = value;
                        [Bindable] protected var cbSelect:Boolean = false;
                         * Override to set ctrlKey and so to leverage Adobe's existing
                         * click to toggle functionality.
                        protected function itemrenderer1_mouseDownHandler(event:MouseEvent):void
                                  // ctrlKey is used by the component to toggle multiple selection
                                  // behaviour but, for checkbox, we want to treat all as a multiple
                                  // selection toggle, so set it to true.
                                  event.ctrlKey = true;
              ]]>
    </fx:Script>
              <!--
              Use CheckBox with selection tied to render selection
              and mouseEnabled=false to prevent conflicts with CheckBox
              own interactivity.
              -->
              <s:CheckBox label="{data}" selected="{cbSelect}"
                                             top="4" bottom="4" left="4" right="4"
                                            mouseEnabled="false" mouseChildren="false"
                                            />
    </s:ItemRenderer>
    [/code]
    2. The application that uses the item renderer:
    [code]
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                                     xmlns:s="library://ns.adobe.com/flex/spark"
                                     xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
                                     layout="{vl}">
              <fx:Script>
                        <![CDATA[
                                  import flashx.textLayout.formats.VerticalAlign;
                                  import mx.collections.ArrayCollection;
                                  import mx.collections.Sort;
                                  import spark.components.CheckBox;
                                  import spark.events.IndexChangeEvent;
                                  import spark.layouts.VerticalLayout;
                                  private var promptBuilder:int = 0;
                                  private var idBuilder:int = 0;
                                  [Bindable] protected var PromptText:ArrayCollection = new ArrayCollection(
                                            ["Prompt text 1...","Second Prompt text...","Third prompt as text...","Prompt...","Prompt...","Prompt..."]
                                  [Bindable] protected var ResponsePromptID:ArrayCollection = new ArrayCollection(
                                            [++idBuilder,++idBuilder,++idBuilder,++idBuilder,++idBuilder,++idBuilder]
                                   * Change handler called whenever an item is selected or deselected.
                                  protected function list1_changeHandler(event:IndexChangeEvent):void
                                            displayCurrentSelection();
                                   * Simple demonstration of interrogating list to find what is and is
                                   * not selected.
                                  protected function displayCurrentSelection():void {
                                            var s:String = "STATUS OF LIST AT "+(new Date).toTimeString();
                                            // selectedIndices returns a list of the data indices of any selected items.
                                            var vs:Vector.<int> = listDisplay.selectedIndices;
                                            if(!vs.length) {
                                                      // If zero length, nothing selected
                                                      s += "\n(No selection.)";
                                            } else {
                                                      // If length, then we have work to do.
                                                      // 1. Indices populated in order of clicking, but we want them
                                                      // in order of display, so sort.
                                                      vs = vs.sort(sortOnInt);
                                                      // 2. Now loop through to see what is and isn't there.
                                                      for(var i:int=0;i<vs.length;i++) {
                                                                // Index is position in the data set that was selected
                                                                // This should match the parallel array of ids.
                                                                var index:int = vs[i];
                                                                s += "\nID:"+ResponsePromptID.getItemAt(index)+" = "+PromptText.getItemAt(index);
                                            // Populate the display variable.
                                            currentSelection = s;
                                            // Simple sort function.
                                            function sortOnInt(a:int,b:int):int {
                                                      return a>b ? 1 : -1;
                                  [Bindable] protected var currentSelection:String;
                        ]]>
              </fx:Script>
              <fx:Declarations>
                        <!-- Place non-visual elements (e.g., services, value objects) here -->
                        <s:VerticalLayout id="vl" paddingBottom="10" paddingTop="10" paddingLeft="10" paddingRight="10" />
              </fx:Declarations>
              <s:Label text="Click to toggle item selection" fontWeight="bold" />
              <s:List id="listDisplay"
                                  layout="{new VerticalLayout}" width="100%"
                                  labelField="label" dataProvider="{PromptText}"
                                  itemRenderer="CBItemRenderer"
                                  allowMultipleSelection="true"
                                  change="list1_changeHandler(event)"
                                  />
              <s:Label text="{currentSelection}" width="100%" />
    </s:Application>
    [/code]

Maybe you are looking for