Cannot pass parameters from action class to jsp using arraylist

hi all,
Im using datasource for jdbc connection.now i want to pass the selected values in action class from database to a jsp page.I want to use arraylist.But im not familar with arraylist.can anybody help .plzzzzzzzzzzz

You can use plain javabeans to transfer the data. Check out the jsp:usebean tag. If you don't know how to do, check out the Java EE tutorial: http://java.sun.com/javaee/5/docs/tutorial/doc/ Using javabeans in JSP pages starts halfway chapter 4.

Similar Messages

  • Passing Arrylist from action class to jsp and parsing in jsp

    I need to do the following using struts
    I have input jsp, action class and action form associated to that. In the action class I will generate the sql based on the input from jsp page/action form, create a result set. The result set is stored as java objects in a ArrayList object.
    Now I need to pass the arraylist object to another jsp to display. Can I put the ArrayList object in the request object and pass to the success page defined for the action? If this approach is not apprpriate, please let me know correct approach.
    if this method is okay, how can I access the objects from arraylist in jsp and display their property in jsp. This java object is a java bean ( getter and setter methods on it).
    ( need jsp code)
    Can I do like this:
    <% ArrayList objList = (ArrayList)request.getattribute("lookupdata"): %> in jsp
    (***I have done request.setattribute("lookupdata", arraylistobj); in action class. ***)
    Assuming the java object has two properties, can I do the following
    <% for (iint i=0. i<objList.size;I++){ %>
    <td> what should i do here to get the first property of the object </td>
    <td> what should i do here to get the first property of the object </td>
    <% }
    %>
    if this approach is not proper, how can I pass the list of objects and parse in jsp?
    I am not sure what will be the name of the object. I can find out how many are there but i am not sure I can find out the name

    Double post.
    http://forum.java.sun.com/thread.jspa?threadID=5233144&tstart=0

  • Struts - Data pass from Action class to JSP

    hello ,
    I am new to struts and have a strange question in my mind .
    How do we pass business logic data from action class to JSP.Do we use session object or any other best way to be used to pass data.
    Example scenario:
    Once the user logins into application by passing userid and password ,we need to display his open queries (from database table) on jsp.
    Components used :
    Login.jsp
    LoginForm(getter and setter methods of userid & password)
    LoginAction(get database connection,perform query to fetch user's open queries form the database)
    OpenQueries.jsp(to display Open queries on a tabular format)
    In LoginAction - We fetched user's open Queries from the database and stored them in collection object .
    My question is : what is the best way to pass Collection object from LoginAction to OpenQueries.jsp ?
    Thanks in advance...
    Ram
    Edited by: ram_76uk on Apr 10, 2008 8:21 PM

    You can use plain javabeans to transfer the data. Check out the jsp:usebean tag. If you don't know how to do, check out the Java EE tutorial: http://java.sun.com/javaee/5/docs/tutorial/doc/ Using javabeans in JSP pages starts halfway chapter 4.

  • Instead of using session How to pass the variable from action class to JSP

    Im using Struts1.2 version.Created the Sample application to get the username.Upto action class im getting the username then i have to display the username in the JSP.Is there any options rather than using session variable to display the username.

    did you check the answer in your previous thread
    Passing Variable from Javascript to Controller

  • How to pass arraylist of object from action class to jsp and display in jsp

    I need to do the following using struts
    I have input jsp, action class and action form associated to that. In the action class I will generate the sql based on the input from jsp page/action form, create a result set. The result set is stored as java objects in a ArrayList object.
    Now I need to pass the arraylist object to another jsp to display. Can I put the ArrayList object in the request object and pass to the success page defined for the action? If this approach is not apprpriate, please let me know correct approach.
    if this method is okay, how can I access the objects from arraylist in jsp and display their property in jsp. This java object is a java bean ( getter and setter methods on it).
    ( need jsp code)
    Can I do like this:
    <% ArrayList objList = (ArrayList)request.getattribute("lookupdata"): %> in jsp
    (***I have done request.setattribute("lookupdata", arraylistobj); in action class. ***)
    Assuming the java object has two properties, can I do the following
    <% for (iint i=0. i<objList.size;I++){ %>
    <td> what should i do here to get the first property of the object </td>
    <td> what should i do here to get the first property of the object </td>
    <% }
    %>
    if this approach is not proper, how can I pass the list of objects and parse in jsp?
    I am not sure what will be the name of the object. I can find out how many are there but i am not sure I can find out the name
    thanks a lot

    Double post:
    http://forum.java.sun.com/thread.jspa?threadID=5233144&tstart=0

  • Unable to send integer value from action class to jsp

    Hi,
    i have scenario like ,
    In my action class ,,
    DemoAction.java
    int samplevar = 3 ;
    // appending it to string since request accepts only objects.
    String sample = ""+samplevar
    request.setAttribute("sampleVar",sample );
    Demo.jsp
    <% int demovar = Integer.parseInt(request.getAttribute("sampleVar")) ; %>
    But i am unable to get the value.. what might be the reason please help...

    T.PD wrote:
    Welcome to the forum.
    855548 wrote:
    DemoAction.java
    int samplevar = 3 ;
    // appending it to string since request accepts only objects.
    String sample = ""+samplevar// You should better stick with a number object type:
    Integer sample = new Integer(samplevar );
    // or leave conversion to autoboxing (java 1.5+)
    Integer sample = samplevar ;request.setAttribute("sampleVar",10) is same as request.setAttribute("sampleVar",new Integer(10)) ;
    No explicit AotoBoxing is required as the second argumet is of java.lang.Object type. It will automatically autobox with java.lang.Integer.
    >
    request.setAttribute("sampleVar",sample );// you must put that in the response, not in the request...
    response.setAttribute("sampleVar",sample );This is not right. You have to set the attribute in request object as you are getting the attribute back in jsp from the request object.
    855548 wrote:
    Hi!! thanks for answering the question,,
    i have tried doing as u said , but still m getting the following error:
    On Compilation of JSP.
    cannot resolve symbol
    symbol : method parseInt (java.lang.Object)
    location: class java.lang.Integer
    int numberofcols = Integer.parseInt(request.getAttribute("noOfCols"));
    kindly help.request.getAttribute("noOfCols") gives you an object of java.lang.Object. Integer.parseInt(String str) requires a string.
    do this....
    int numberofcols = Integer.parseInt(request.getAttribute("noOfCols").toString());

  • Passing Parameters from Dashboard to a JSP page

    Hi,
    I have a table column of values displayed in dashboard. when a user clicks a value, that value should be send as a parameter to a JSP Page.
    Tell me how to add that column value as a parameter to the url which navigates to the JSP page. Should i use some presentation variables?
    If so give me the steps...
    Thanks,

    Hi Venkat,
    I am really happy to see your reply. i will explain my doubt clearly.
    I am using a presentation variable to store the column value selected by user(using a prompt). And i am using a Link (Dash board link ) to navigate to a jsp page.
    I want the presentation variable's value should be accessed in the JSP page...
    Now is it possible to pass the presentation variable's value through the url of the link to a jsp page.
    Eg: Let Presentation variable is file, and i had given the Link's url as
    http://localhost:9704/servco.jsp?file_id=@{file}
    i dont know whether this is the correct way. Please help me out in this....

  • ADF: Passing parameters from one page to another using setPropertyListener

    Hi,
    I'm trying to find a simple way to pass a parameter from one page to another.
    On the first page I have a table, the second page is a history page, showing the change history of rows from the table on the first page.
    In the table on the first page there's a unique column (an order number), the value of which is never changed for a given row.
    What I would like is to be able to pass the order number from the currently selected row of the first page on to the history page, making the history page show only the history for the given order number.
    Using the task-flow for the history page, I've defined an input parameter (an order number), defined a criteria and so on. I've tested the functionality of this in the Application Module, and it seems to work.
    My problem is passing the order number from the first page to the second.
    I've created a Managed Bean, with a variable for the current order number, including accessors. On the table on the first page, I've created a contextMenu, and added an Item called "Show history" with an action that navigated from the first to the second page (a control flow I've defined in adfc-config). I've included a setPropertyListener in the "Show history" item. I've set the "From" property of the setPropertyListener to "#{row.ordernumber.attributeValue}" and the "To" property to point at the order variable in the Managed Bean. Finally, I created a new page for the history, dragged the history task flow onto this page as a region, using the Managed Bean order variable as input parameter.
    The result is this: When I bring up the context menu from a row in the table on the first page and select "Show history", I get this error: "The class 'java.lang.String' does not have the property 'attributeValue'."
    That's a bit puzzling to me, seeing as I used the Expression Builder to fill out the "From" property. I've tried using "inputValue" instead of "attributeValue", but that simply changes the error message to: "The class 'java.lang.String' does not have the property 'inputValue'."
    What am I doing wrong?
    Regards,
    Andreas

    Hi Timo and Puthanampatti,
    I actually tried something similar to what you have suggested before starting this thread, but still got an error. What I hadn't spent a lot of time investigating initially was that it gave a DIFFERENT error. But after reading Timo's suggestion, I went back to this other error and found out that it was connected to my Managed Bean. For some reason, I had made the mistake of giving the bean the same name (in adfc-config) as the actual java class. And this leads to a circular reference error (that I would only get to see when I didn't get the java.lang.String error first).
    Having fixed this, I can successfully pass my parameter from one page to another (with the "From" property of the setPropertyListener set to "#{row.ordernumber}").
    Thanks for your time,
    Andreas

  • Cannot pass data from Web Dynpro to XI using a Web Service

    Hi All,
    We have been facing some issues when we try to pass on a SOAP / XML message via a WSDL from a WebDynpro App to XI - No data is reaching XI interface. The payload data details for the inbound message in XI is empty. When testing the WSDL separately using XML spy the data passes to the XI successfully.
    The problem only occurs when we pass on the data from the WebDynpro component.
    We are also passing additional information _user and _password to ensure authenticated access.
    Steps that we completed so far:
    1. Created a WSDL which we can use to communicate to XI interface.
    2. Imported WSDL using webdynpro Web Service Model import
    functionality.
    3. Bound WSDL with webdynpro components.
    4. Pass on data through WSDL contexts.
    5. Execute WSDL model.
    Any help would be much appreciated.
    Thanks,
    RR

    Hi,
    please check document:
    Almost Everything about Transaction Launcher u2013 Part
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/3059fb20-987f-2e10-ef82-d147b9b5e8b4
    Denis

  • Issue with passing parameters from JSP to Backing bean

    hi ,
    I have an issue in passing parameters from my JSP to backing bean. I want to fetch the parameter from my URL in backing bean .This is how i am coding it right now. But the parameter companyID returns me null.
    URL http://localhost:8080/admin/compadmin.jsp?companyID=B1234.
    In my backing bean
    FacesContext context = FacesContext.getCurrentInstance();
    String companyID = (String)context.getExternalContext().getRequestParameterMap().get("CompanyID");
         public void setCompanyID(String companyID)
              this.companyID=companyID;
         public String getCompanyID()
              return this.companyID;
    faces-config.xml :
       <managed-bean-name>admincontroller</managed-bean-name>
              <managed-bean-class>com.admin.controller.AdminController</managed-bean-class>
              <managed-bean-scope>request</managed-bean-scope>
              <managed-property>
                   <property-name>companyadminbean</property-name>
                   <property-class>com.admin.model.AdminBean</property-class>
                   <value>#{companyadminbean}</value>
                         </managed-property>
                        <managed-property>
                                 <property-name>companyID</property-name>
                              <value>#{param.companyID}</value>
                             </managed-property>Please let me know if iam missing something.Appreciate your help in advance
    Thanks

    Thanks very much for your input. I made changes to my bean accordingly. Actually the method getAdminType() is a not a getter of a property. It's just a method which iam calling in AdminController bean constructor to verify whether the person is System Admin or Client admin. So now the issue is inspite of making changes still the link "Copy Users" shows up for Client admin too which is incorrect.
    My Administrator bean:
    public class Administrator {
      boolean GSA=false;
      boolean SA=false;
      public Administrator(){}
    public boolean isGSA()
        return GSA;
      public boolean isSA()
        return SA;
      public void setGSA(boolean value)
        this.GSA=value;
      public void setSA(boolean value)
        this.SA=value;
    }My backing bean:
    public class AdminController {
    private AdminBean adminbean = new AdminBean();
    public AdminController(){
    int userID=1234;
    this.getAdminType(userID);           
    public void getAdminType(int userID)
             Administrator admin = new Administrator();
             if (userID<0) return;
             try{
                 if(Rc.isGlobalSystemAdmin(userID)){
                      admin.setGSA(true);
                              }else if(Rc.isClientSystemAdmin(userID)){
                      admin.setSA(true); // i could see these values setup correctly in the admin bean when i print them
                 adminbean.setAdmin(admin);
                  } catch (Exception e){ }
    Admin Bean:
    public class AdminBean {
    private Administrator admin; 
    public Administrator getAdmin()
                        return this.admin;
              public void setAdmin(Administrator admin)
                        this.admin = admin;
    faces-config.xml
    <managed-bean>
              <managed-bean-name>admincontroller</managed-bean-name>
              <managed-bean-class>com.controller.AdminController</managed-bean-class>
              <managed-bean-scope>request</managed-bean-scope>
              <managed-property>
                   <property-name>adminbean</property-name>
                   <property-class>com.model.AdminBean</property-class>
                   <value>#{adminbean}</value>
             </managed-property>
         </managed-bean>
         <managed-bean>
              <managed-bean-name>adminbean</managed-bean-name>
              <managed-bean-class>com.model.AdminBean</managed-bean-class>
              <managed-bean-scope>request</managed-bean-scope>
              <managed-property>
                   <managed-property>
                   <property-name>admin</property-name>
                   <property-class>com.model.Administrator</property-class>
                   <value>#{admin}</value>
                             </managed-property>
         </managed-bean>     My JSP:<h:outputLink id="ol1" value="/companyadmin/copyusers.jsp">
               <h:outputText id="ot1" value="Copy Users" rendered="#{adminbean.admin.isGSA}" /><f:verbatim><br/></f:verbatim>
               </h:outputLink>    so now the issue is thelink copy users is displayed even #{adminbean.admin.isGSA} is FALSE. please advise.
    Thanks
    Edited by: twisai on Oct 15, 2009 7:06 AM

  • Passing parameters from JSP to JSP

    How can I pass parameters from one JSP to another JSP?
    JSP1 calls JSP2. I need to pass some values in JSP 1 to use in JSP 2.
    Please help.
    Thanks.

    use jsp:forward and param tags

  • Pass parameters from JSP Dyn Page to WDJ Application

    Hi,
    I am trying to pass parameters from my JSPDyn Page to WDJ Application.
    I am using NWDS 7.1 EHP1
    My code is :
    function to_WEBDYNHK()
          EPCM.relaxDocumentDomain();
          EPCM.doNavigate
        ('ROLES://pcd:portal_content/Himanshu.Himanshu/TestDynUIApp?DynamicParameter="hkparam%3Dqwertyuio"');
    This method is being called on click of a button.
    hkparam is the parameter in question.
    The JSPDyn page is an iView and the WDJ application is a page and both have been assigned to a role.
    In the properties of the WDJ Page, I have removed DymanicParameter from "Do not Forward These Parameters To Web Dynpro" property.
    However I am getting null as the value of hkparam in my WDJ application.
    The code used is :
    IWDRequest request = WDProtocolAdapter.getProtocolAdapter().getRequestObject();
           String param1= request.getParameter("hkparam");
    What seems to be missing here.
    Please help.
    I went through the documentation on SDN but it does not seem to help.
    TIA,
    Himanshu

    Hi Himanshu,
    Try this code.
    EPCM.doNavigate("ROLES:portal_content/Himanshu.Himanshu/TestDynUIApp?hkparam=Dmypass1123")
    if the parameter is hkparam and the value to be passed is Dmypass1123. You need not change any design time property of the WD page, and WDProtocolAdapter should retrive the parameter.
    Regards,
    Vishweshwara P.K.M.

  • Automatically Pass Parameters From Crystal To SAP B1

    So, I've searched extensively, and haven't been able to find an answer to my unique issue.
    This question pertains to linking a Crystal Report by parameter values to the OWOR table in SAP B1, and automatically passing those parameter values from the active record in SAP. Several other tables are used in sql joins, but the report is generated from an OWOR production order. I should start by stating that the report works great when manually populating the parameter fields when SAP calls for them.
    Overview:
    I've written a report in Crystal that contains several sub reports, some of which are looking to the DocEntry field as the parameter (DocKey@) and others that do not look to the DocEntry field at all - but rather use another field on the form to pull up information that spans more than just that one production order. I've chosen to upload as a layout in SAP (as that is all I've worked with up to this point, and it seems it needs to be to automate from a production order); but as I continue to research, it appears DocKey@ is mandatory when uploading as a layout, and in order to view the report from the actively selected production order, it must be a layout. Does that mean the parameter is required in all sub reports? Is it required in any sub report?
    I have two main issues that I need to hurdle for this report to work how I would like it to:
    1. Three of the eight Commands (one main command and seven sub-report commands) use the DocKey@ as the parameter to pass from SAP back to Crystal. The main report command, as well as four of the sub reports/commands are looking to another field in the OWOR record - which happens to be a re-seller defined field (UDF). For all intensive purposes, let's call this field BatchID. I'm assuming the sub report commands run in succession, one after the next. The reason I need to use BatchID as the parameter to pull from the record, rather than DocEntry, is there are other records that contain the same BatchID, and I want all of the info pertaining to that BatchID to populate on the report.
    Q1: The first command containing DocKey@ is automatically populated by SAP, and the user does not have to key that one in. However, the next two DocKey@ parameters do not automatically populate, and the user is asked for those values. How can I fix this?
    Q2: How can I automate the passing of BatchID so the user does not have to fill it in 5 times when they wish to preview the report(layout)? Can I link ObjectID@ to any field in OWOR? Is there any other way like creating a stored procedure or something , to automate the passing of that variable from the SAP active record to the crystal report - so the user doesn't have to key it in several times just to pull up the report?
    Thank you so much for even reading, let alone helping me with this issue!!
    Cheers,
    Nick

              Hi
              I had the same problem. Take a look at this newsgroup article on the businessobjects
              website :
              http://support.businessobjects.com/library/kbase/articles/c2015264.asp
              Grieg
              "Rada Pickens" <[email protected]> wrote:
              >
              >Hi,
              >
              >I'm getting the same error message, I was wondering if you fixed the
              >problem.
              > I'm stumped, can you help?
              >
              >Rada
              >
              >
              >"JAI" <[email protected]> wrote:
              >>
              >>I am passing parameters, from the JSP page to Crystal Report, i took
              >>the code from
              >>the below mentioned url, i dont know, it is something wrong with the
              >>jsp page
              >>or crystal report.
              >>i have created parameter field in crystal report to receive the value
              >>from the
              >>jsp page.
              >>If u r not clear with the error, please reply to me.
              >>
              >>i took the code from the below mentioned page
              >>
              >>reference page:
              >>----------------------
              >>http://dev2dev.bea.com/trainingevents/webinars/012804_faq.jsp
              >>parameterFieldsViewReport.jsp
              >>
              >>
              >>error displaying in the jsp page
              >>-----------------------------------
              >>com.crystaldecisions.report.web.viewer.CrystalReportViewer
              >>Some parameters are missing values
              >
              

  • Pass parameters from hbj link

    Hi,
        I want to pass parameters from hbj link to the component where the event method is going to be called. And also when I click the event how it is going to redirect other jsp.
    Regards,
    Suresh.B

    Hello Reinuka,
    It is possible to send parameter to Web Dynpro iview.
    In the iview application parameters add Param1 =.
    Place this code wherever  you want to call that iview.
    WDPortalNavigation.navigateAbsolute("ROLES:"+iview,WDPortalNavigationMode.SHOW_INPLACE,(String) null, (String) null, WDPortalNavigationHistoryMode.NO_DUPLICATIONS,(String) null,(String) null,"Param1 = ");
    "ROLES:"+iview=Iview Path
    "Param=Paramvalue"=Parameter and its value
    Youcan receive the value as
    String parmvalue=WDWebContextAdapter.getWebContextAdapter().getRequestParameter("Param");
    Regards,
    Sridhar

  • Getting error , while passing parameters from one page to another page

    Hello friends,
    i am getting error, while passing parameters from one page to another page, below code i wrote.
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    ArrayList arl=new ArrayList();
    EresFrameworkAMImpl am=(EresFrameworkAMImpl)pageContext.getApplicationModule(webBean);
    ERecordImpl ERecordObj=new ERecordImpl();
    HashMap hMap = new HashMap();
    hMap.put("1",ERecordObj.getTransactionName());
    hMap.put("2",ERecordObj.getTransactionKey());
    hMap.put("3",ERecordObj.getDeferredMode());
    hMap.put("4",ERecordObj.getUserKeyLabel());
    hMap.put("5",ERecordObj.getUserKeyValue());
    hMap.put("6",ERecordObj.getTransactionAuditId());
    hMap.put("7",ERecordObj.getRequester());
    hMap.put("8",ERecordObj.getSourceApplication());
    hMap.put("9",ERecordObj.getPostOpAPI());
    hMap.put("10",ERecordObj.getPayload());
    // hMap.put(EresConstants.ERES_PROCESS_ID,
    if(pageContext.getParameter("item1")!=null)
    pageContext.forwardImmediately(EresConstants.EINITIALS_FUNCTION,
    OAWebBeanConstants.KEEP_MENU_CONTEXT,
    null,
    hMap,
    true,
    OAWebBeanConstants.ADD_BREAD_CRUMB_YES
    Error(71,2): method forwardImmediately(java.lang.String, byte, null, java.util.HashMap, boolean, java.lang.String) not found in interface oracle.apps.fnd.framework.webui.OAPageContext
    Thanks
    krishna.

    Hi,
    You have imported the wrong class for HashMap.
    Import
    com.sun.java.util.collections.HashMap; instead of java.util.HashMap
    Thanks,
    Gaurav

Maybe you are looking for

  • Getting the error "a problem occurred with this web page so it was reloaded"

    All of a sudden on one webpage I use frequently, I am getting this error.  The page is working on my other devices just not my MacBook Pro since yesterday. Here is the error report: Process:         com.apple.WebKit.WebContent [1196] Path:           

  • Epson 1400 photo scanner not connecting to Photoshop after Mavericks update

    I updated to Mavericks and now the Epson 1400 Scanner photo will not show up in Photoshop CS5.  Udated new drivers, still no result. What step am I missing?

  • My dream-machine...

    http://img207.imageshack.us/img207/1375/icontrolpro32med5jj.jpg okay... so i'm a geek. iMac G5 1.8ghz, 20   Mac OS X (10.4.2)  

  • ITunes always crashes on close Vista SP1

    I'm running Vista SP1 with the latest version of iTunes. Everytime I close iTunes I get an error message that iTunes has stopped working. I've tried reinstalling itunes and I've reinstalled Vista, but this only briefly fixes the problem. After the fi

  • Visual attribute for records in MULTISELECT block

    Hi, For some type of records I need to set background colour yellow. The block has property set to QMSSO$MSEL_BLOCK. I am using below code for each field in the block displayed: POST_QUERY for the block: set_item_instance_property('block.column_name'