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.

Similar Messages

  • 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.

  • 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

  • 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

  • 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

  • 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());

  • How update xellerate form data from Action class

    Hi Experts,
    i did some customization in Action class.
    Now from this Action class i want toupdate xellerate from data
    Using digital signature i got the status of one of the attribute of xellerate from
    ie
    userIntf = (tcUserOperationsIntf)utilityFactory.getUtility("Thor.API.Operations.tcUserOperationsIntf");
    tcResultSet tRs = userIntf.findAllUsers(userMap);
    if(tRs.getRowCount() > 0)
    userLoginStatus= tRs.getBooleanValue("USR_UDF_IS_FIRST_LOGON");
    now i want update this attribute, ie ifuserLoginStatus is true, i want to update as false
    help me how to achive this..
    thanks

    How to update userdata using OIM API
    Thanks

  • Create data control from java class, not see "ADF Parameter Forms" option

    Hi,
    I have created a Fusion Web Application (ADF) in jdev 11g. In the application model project, I created a java class. Inside the java class, I have a public method as below
    public Asset [] searchAsset3(SearchTerm s) // SearchTerm is a java bean. It implements java.io.Serializable.
    I created data control from my java class. After that, I see an xml file generated under the same folder of my java class. Here is the xml content.
    <?xml version="1.0" encoding="UTF-8" ?>
    <JavaBean xmlns="http://xmlns.oracle.com/adfm/beanmodel" version="11.1.1.53.62"
    id="AIAAsset" Package="oracle.apps.aia.oer.model"
    BeanClass="oracle.apps.aia.oer.model.AIAAsset" isJavaBased="true">
    <MethodAccessor IsCollection="true"
    Type="com.flashline.registry.openapi.entity.Asset"
    BeanClass="com.flashline.registry.openapi.entity.Asset"
    id="searchAsset" ReturnNodeName="Asset"
    CollectionBeanClass="UpdateableCollection">
    <ParameterInfo id="name" Type="java.lang.String" isStructured="false"/>
    <ParameterInfo id="version" Type="java.lang.String" isStructured="false"/>
    <ParameterInfo id="description" Type="java.lang.String"
    isStructured="false"/>
    </MethodAccessor>
    <MethodAccessor IsCollection="true"
    Type="com.flashline.registry.openapi.entity.AssetSummary"
    BeanClass="com.flashline.registry.openapi.entity.AssetSummary"
    id="searchAssetSummary" ReturnNodeName="AssetSummary"
    CollectionBeanClass="UpdateableCollection">
    <ParameterInfo id="name" Type="java.lang.String" isStructured="false"/>
    <ParameterInfo id="version" Type="java.lang.String" isStructured="false"/>
    <ParameterInfo id="description" Type="java.lang.String"
    isStructured="false"/>
    <ParameterInfo id="type" Type="java.lang.String" isStructured="false"/>
    </MethodAccessor>
    <MethodAccessor IsCollection="true"
    Type="com.flashline.registry.openapi.entity.Asset"
    BeanClass="com.flashline.registry.openapi.entity.Asset"
    id="searchAsset3" ReturnNodeName="Asset"
    CollectionBeanClass="UpdateableCollection">
    <ParameterInfo id="s" Type="com.flashline.registry.openapi.query.SearchTerm"
    isStructured="true"/>
    </MethodAccessor>
    <ConstructorMethod IsCollection="true"
    Type="oracle.apps.aia.oer.model.AIAAsset"
    BeanClass="oracle.apps.aia.oer.model.AIAAsset"
    id="AIAAsset"/>
    </JavaBean>
    Then, in application user interface project, I created a JSPX page. From the data controls palette, I want to drag and drop the searchAsset3 onto my page. However, I don't see an option for me to choose "Create -> Parameters -> ADF Parameter Form". I only see "Create -> Methods". Unlike other public methods (e.g.searchAssetSummary and searchAsset) which have simple data type as input, I can see the "Create -> Parameters -> ADF Parameter Form" option when I drag and drop to my jspx page. Is that something I missed while creating data controls?
    Thanks.
    Arnold.

    Then, my other question is how do you do the bindings? I drag and drop the attributes from SearchTerm bean. Now the pagedef file has the AttributeValues added but my method is actually expecting one input parameter of type SearchTerm. How do you bind the attributes to the input of the method? Thanks.
    See below of my pagedef xml file.
    <?xml version="1.0" encoding="UTF-8" ?>
    <pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel"
    version="11.1.1.53.62" id="SearchAssetBySearchTerm1PageDef"
    Package="oracle.apps.aia.oer.view.pageDefs">
    <parameters/>
    <executables>
    <variableIterator id="variables"/>
    <methodIterator Binds="SearchTerm.result" DataControl="AIAAsset"
    RangeSize="25"
    BeanClass="com.flashline.registry.openapi.query.SearchTerm"
    id="SearchTermIterator"/>
    </executables>
    <bindings>
    <methodAction id="SearchTerm" RequiresUpdateModel="true"
    Action="invokeMethod" MethodName="SearchTerm"
    IsViewObjectMethod="false" DataControl="AIAAsset"
    ClassName="com.flashline.registry.openapi.query.SearchTerm"
    ReturnName="AIAAsset.methodResults.SearchTerm_AIAAsset_SearchTerm_result"/>
    <attributeValues IterBinding="SearchTermIterator" id="key">
    <AttrNames>
    <Item Value="key"/>
    </AttrNames>
    </attributeValues>
    <attributeValues IterBinding="SearchTermIterator" id="operator">
    <AttrNames>
    <Item Value="operator"/>
    </AttrNames>
    </attributeValues>
    <attributeValues IterBinding="SearchTermIterator" id="value">
    <AttrNames>
    <Item Value="value"/>
    </AttrNames>
    </attributeValues>
    <methodAction id="searchAsset3" RequiresUpdateModel="true"
    Action="invokeMethod" MethodName="searchAsset3"
    IsViewObjectMethod="false" DataControl="AIAAsset"
    InstanceName="AIAAsset.dataProvider"
    ReturnName="AIAAsset.methodResults.searchAsset3_AIAAsset_dataProvider_searchAsset3_result">
    *<NamedData NDName="s"*
    NDType="com.flashline.registry.openapi.query.SearchTerm"/>+
    </methodAction>
    </bindings>
    </pageDefinition>

  • Viewset does not have data passed from GenIL

    Hi All,
    We have a custom component in which data is not getting passed from a ViewSet to the Overview page. The details of the issue are given below:
    There is a detail view zsoEF and a table view zsoChild. These 2 views are housed in a viewset zsoVS. This view set has an event Eh_OnBack which requires the data from views zsoEF and zsoChild to be passed to overview view zsoOV.
    We recently upgraded to CRM 7.0. After the upgrade, the values entered on the views zsoEF and zsoChild are processed in the ZGenIL. The context nodes and the custom controllers are filled correctly with the screen values and some auto added data based on validations..
    When we click on the Back button, then Eh_OnBack does not have data in the Custom Controller. I am not able to pin point the reason for this missing data in the Back event. From the way i understand, when we do data binding in the views, we don't have to do that in ViewSet. Has there been any change in this design in CRM 7.0?
    I would like to know if there is any workaround for this issue.
    Thanks,
    Rini

    Hi Rini,
        Did you try to bind the context nodes with the component controller. Can give it a try whether it resolves the problem. Any way it is difficult to say anything as we don't have an idea what exactly you did in the component. Lets take it forward. In the mean time have a look in the below link.
    History navigation and context initialization calls - CRM - SCN Wiki
    Thanks,
    Javed.

  • Data Control from Java Class

    Using JDev 11gPS4
    I have a java class that i want to use as a DC:
    (simplified)
    public class AccountDC {
        public AccountDC() {
            super();
        public void insertAccount(Account account){
            //Do some things
    }Account:
    public class Account {
        private String name,alias;
        public Account() {
            super();
        public void setName(String name) {
            this.name = name;
        public String getName() {
            return name;
        public void setAlias(String alias) {
            this.alias = alias;
        public String getAlias() {
            return alias;
    }When I create the data control from the first class, i get the insertAccount operation.
    When i drop the account parameter on my JSPX page, JDev suggest an ADF Form which is fine.
    When I drop the insertAccount method below the form, JDev suggest an ADF Button which is also fine.
    JDeveloper doesn't seem to know that the values provided in the above form should be mapped to an Account object for the insertAccount.
    How should I do this?
    In the bindings I do have the individual attributeValues for each attribute but I don't seem to have a reference to an Account object. Do i need to add something to my DC?
    Another question... Is it maybe better to create a VO with only transient attributes and an Application Module where i expose my own custom createInsert method?
    It's all custom code. It does not write anything to a database.

    You should have an object that represent your method's parameter in your data control - if you'll drag it into your page you'll get the fields needed.
    Similar to the way it is done in this example:
    http://blogs.oracle.com/shay/entry/updateinsert_with_adf_web_serv

  • Re: Passing a string from Java class to JSP

    How can I pass a string from a function within my bean class to my JSP page?
    I would like to pass something like this with the necessary params filled in:
    String myString ="Successful <b>" + Sales.getActionType() + "</b> was made on <b>" + (new Date()).toString();
    The ActionType will be either a BUY or SELL and the current date need to be added in.
    Thank you in advance!

    SOLVED THE PROBLEM!!!

  • Problems with data controls from java classes in JSF pages.

    Hi! We have a problem in our Application that we are developing with JSF pages using Data Controls generated from facades java classes. When we running a page in debug mode and the page are loading, if we insert a breakpoint in the first line of method referenced in the data control, the execution enter two times in the method, and this is a problem for us. How to solve this?
    We are using JDeveloper 11.1.1.2 with ADF faces.

    You might need to play around with the refresh property of the action binding.
    http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/adf_lifecycle.htm#BJECHBHF

  • Data Passing from a Subreport to the Main Report

    <p>Hello,</p><p>I have been able to pass data from a subreport to a main report using shared variables. The Complete Reference: CR XI (p. 313) states that you should be able to now suppress the subreport to prevent it from showing on the main report, however this is not working. I want to get the data from the subreport and then further manipulate it in the main report, and I do not want the subreport shown on the main report. I tried suppressing/hiding the section where the subreport is placed as well as suppressing the subreport itself. The formula values on the main report become null when I do this though. Is it possible to keep the subreport off the main report?</p><p>Thanks.</p>

    Search forums, this has been answered multiple times.

  • Data Passing from ME21N to ME22N or ME23N

    Hi,
    I'm using screen exit to add some custom fields in PO Creation screen. I used the enhancement MM06E005. I have to add fields in Header hence, I added those in CI_EKKODB. Then, I designed 0101 screen of SAPMM06E.
    Further I used EXIT_SAPMM06E_008 to Pass data from Subscreen to Structure for storage of data entered in customer-screen.
    Till this point, it is working fine.
    My issues are --
    1). When I press Change button on the screen, customer-screen does not change its mode of display as with rest of the screen.
    2). After saving data using ME21N, it is not being reflected in ME22N and ME23N; while other data from standarad screen are coming.
    Can you please guide me what to do and which exit is to be used for the purpose..?
    Kumar Saurav.

    Issue resolved.
    Kumar Saurav.

  • FROM - TO Dates passed from prompt into the Title of the WEBi report

    What is the right approach to pass two reporting period dates (FROM /TO) from user's input into the Title(Header) of the Universe based WEBi report, like "Tickets submitted from:MM-DD-YY to:MM-DD-YY"
    Maybe this is trivial but it is easier to do in CR and I am not sure how to do it using Universe objects.
    These are my first steps in building real production Universe.
    Thanks in advance!
    Alex

    i dunn know if i understand you well, but it seems like you want to pass 2 dates (from, to) to some report and to have those 2 dates in the report title.
    its too easy, first at the universe level you have to have a Date objects, which comes in the time dimension.
    when you create a report usin Webi, just drag this Objects to the query filter and make the operator "between" and make both of them "prompt"
    give two texts to the prompts lets say "From Date" and "To Date",,,, and run the report.
    at the report design mode there is a function called "UserResponse"
    in the report title text add this =userresponse("From Date")
    you can modify the text as you require.
    good luck
    Amr

Maybe you are looking for

  • Sales order crestion for a PO---error msg

    Hello, For a single PO, i am able to create a number of sales order. Is there a way i can rewstrict the system by throwing an exception/warning message. Sanjay

  • Having 2 or more users on the same computer point to one itunes account

    I recently purchased a new computer. When I opened itunes for the first time on each user account it created different libraries and playlists for each user. We only use one Ipod. Now when I purchase a song in one account the other account does not s

  • MAC OS 01.4.11 WITH SPRINT CENTRO PALM SYS. TRYING TO CONVERT CONTACTS TO PALM 800W? NOT POSSIBLE?

    THERE ARE 4 PROBLEMS TRYING TO CONVERT FROM PALM CENTRO DATA TO PALM 800W: 1.MAC needs third party software to convert to ms,(if you have windows computer you still have the MS ongoing problems), 2.PALM PDA CELL PHONES,(no vision for the future) 3.NE

  • INSERT or UPDATE with multiple rows

    Hi there! I want to ask what I should do in the following case: I have to handle mutliple rows of data to insert OR to update into the database. The first question is about how to decide whether I should take INSERT or UPDATE. I read here in the foru

  • GR Output type based on the different PO

    Hi, When the user do the GR based on the Different Purchase Order Say Eg: NB, ZNB, ZCO.  The GR should print in the Different Printer Say Printer A for Document Type NB, Printer B for Doc Type -ZNB and Printer C for document Type ZCO. How to do the C