Passing values  between action classes.

there are 2 jsps. main.jsp and detail.jsp In Main. jsp i only enter project description and submit to database and map the struts to call the detail .jsp which has to pick the project id(which is sequence generator) and display its description so I can add the other details of project.
Now the problem is as I submit the aciton the request goes out of scope and I am unable to get the project Id so I can't find the project desc to display in my details page.
i tried populating the form before I leave the save action which is called in first jsp. But I am still not able to get the value of project id. Below is my code
ProjectDetailForm form = (ProjectDetailForm) aform;
......save action is done...
form.setProjectId(projectNumber);
to make it clear project number is the number i wast assing to projectid and its sequence generator in datamap.
In display action where I want value so i can dispaly the project desc in Detail.jsp
ProjectDetailForm form= (ProjectDetailForm) aForm;
int projectNumber=form.getProjectId();
Please anybody let me where I am going wrong. Its kind of urgent.
Regards,
Infyniti.
One wya is querystring, which not preferred in our proj. Is there any susbstitution for querystring in struts.
Its kin of urgent.

I'm not entirely certain what you are doing, but heres a best guess:
If I understand you correctly you want to chain two actions
1 - save action - saves new record, and generates new unique id
2 - display action - displays the new record.
Seeing as you say "the request goes out of scope", I presume that means that your actionForward to go from the save action to the display action is a redirect?
Pro: a refresh won't save a duplicate new record
Con: you lose all request attributes/parameters.
So one request saves the record, and the redirect causes a new request to display the record. But you need to retain the record id between the two requests.
Setting it on the ActionForm should work providing:
- the same ProjectDetailForm used in both the "save" action and the "display" action?
- the form have a scope of "session"
- you don't have a "reset" method that would clear the value between calls
Are you able to post the struts-config for these two actions?
Given the constraints, the only other alternative I can think of is to put the id in a session attribute.
As an alternative, you could make it so that the save action forwards to display without a redirect, but that opens you up to a "refresh" saving a new record again. You could combat that by using struts synchronizer tokens. http://www.javaworld.com/javaworld/javatips/jw-javatip136.html
Hope this helps,
evnafets

Similar Messages

  • Passing values to different classes.

    Class A (main panel) calls Class B (calendar panel) and Class C (textbox and buttons panel). When the users changes dates on the calendar class B, class C needs to be notified of the new values.
    I have two constructors in class C...an empty parameter constructor that is used when the main panel(A) calls it, and a constructor that accepts an Object as a parameter (which is the list of dates selected on the calendar), used when class B calls it.
    My problem is that when the values are changed on the calendar, class C is not holding on to the list of dates. In my constructor, I am enumerating through the list...so I know the values are being passed, but when I try to use the list later on in the code (when a button is clicked) the list is empty.
    Does anyone have any suggestions on how to resolve this problem?
    Thanks!!!!

    you can do something like that:
    public someClass {
    someOtherClass obj;
    public someclass (someOtherClass object) {
    this.obj = object;
    public void someMethod () {
    if (condition) { obj.someOtherMethod();  }
    public someOtherClass {
    //constructor here
    public void someOtherMethod () { //do Stuff }
    like this you could pass values between your classes A, B and C

  • Pass values between pages

    Hello experts!
    I am trying to pass value between two pages without page submit.
    I set item value from first page to session state by dynamic action. Then I am trying to pass this value to second page, I use button which redirects to second page and sets item value on second page with value from first page.
    But approach this does not woks as I expected. The value from the first page is not passed to the second page when I click on button. Value is passed to the second page only if I:
    1. set some value to item on first page (e.g. XX);
    2. click on button which redirects to the second page;
    3. get back to first page;
    4. set some new value to the item (e.g. YY);
    5. click on button;
    6. then the first value from session state is passed to sthe econd page (value XX)
    Could anybody tell me where I make a mistake, or what is wrong in my solution?
    Test appl.
    www.apex.oracle.com
    http://apex.oracle.com/pls/apex/f?p=9027:LOGIN_DESKTOP:6946284921064
    workspace: kurintest
    username: [email protected]
    passwd: kurintest
    appl: 9027 pass_value
    Thanks in advance!
    Jiri

    Jiri N. wrote:
    Hello experts!
    I am trying to pass value between two pages without page submit.
    I set item value from first page to session state by dynamic action. Then I am trying to pass this value to second page, I use button which redirects to second page and sets item value on second page with value from first page.
    But approach this does not woks as I expected. The value from the first page is not passed to the second page when I click on button. Value is passed to the second page only if I:
    1. set some value to item on first page (e.g. XX);
    2. click on button which redirects to the second page;
    3. get back to first page;
    4. set some new value to the item (e.g. YY);
    5. click on button;
    6. then the first value from session state is passed to sthe econd page (value XX)
    Could anybody tell me where I make a mistake, or what is wrong in my solution?A redirect button and it's target URL&mdash;including items to be set and their values&mdash;are rendered on page show, in this case before <tt>P2_ITEM1</tt> has a value. Look at the page source when the page is first rendered:
    <input type="button" value="Button1"onclick="apex.navigation.redirect(&#x27;f?p=9027:3:11397156385140::NO:RP,3:P3_ITEM1:&#x27;);" id="P2_BUTTON1"  />No value substituted for <tt>&P2_ITEM1.</tt> in the URL.
    Why do you want to navigate between these pages without a page submit? As APEX has to render page 3 anyway, why not submit and branch?

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

  • Navigate between 2 reports and pass values between 2 different columns

    Hello
    I have a question about navigating from 1 report to another while passing the value from column 1 to column 2 in the second report...
    In OBIEE 11G, I create action link on report 1, column 1 and this action link is navigate to BI Content and the destination is report 2. Now report 2 has column 2, which is an alias of column 1 from report 1, from user's point of view they are the same, but from OBIEE point of view they are different.
    My action link is able to navigate to report 2, however, the value in column 1 which I clicked to execute the navigation, does not get passed to column 2 in report 2..
    Is there a way around this issue?
    Let me know if I need to provide more clarification
    Thanks

    Thank you Anirban
    I think this is the best solution you just provided.The current post and the post at below looks same
    Navigate from report to dashboard and  pass values between different column
    is it not answered?
    Thanks :)
    Edited by: Srini VEERAVALLI on May 7, 2013 3:07 PM

  • Pass values between different frames

    Dear Friends from Adobe.
    I need a lot of help from you.
    I have a project with Flash Action Script 2.0 and would like
    to know if you have to pass values between different frames.
    Example:
    Passing a value of a inputbox the frame 1 for a inputbox in
    frame 2.
    OBS: If possible could pass the solution through e-mail?
    Now, very grateful.
    Diogo Areas.

    Using AS2 you can either name the input textfield instance on
    the stage or, you can name the variable property of the input
    textfield. You can name either of these from the Property Inspector
    window. Once named, you can then have access to the value of the
    text that is entered. It will be either instanceName.text or
    variableName.
    The scope of either of these values lasts only as long as the
    textfield instance exists. So, if the first textfield is in frame
    7, for instance, and is only in frame 7, and you want to use the
    value in another frame, say frame 20, then you'll have to store the
    value outside of the textfield for later use. You can do this by
    creating a variable in the first frame of the movie, and then
    placing the text from the textfield in frame 7 into that variable.
    Then at frame 20, you can retreive that value and use it in the
    textfield in frame 20.
    Alternately, you can continue the instance of the textfield
    in frame 7 out through frame 20. The content will continue to be
    available. You can add keyframes to the layer that the textfield is
    in at frame 7, and move the object off the visible area of the
    stage, so that it won't be seen, if you like.

  • Pass Values between two Function Modules RFC in Portal

    I need to pass values ​​between 2 FM RFC.
    I have an implicit enhancement in HRMSS_RFC_EP_READ_GENERALDATA RFC function module.
    PERNR LIKE  PSKEY-PERNR
    ENHANCEMENT 1  Z_ESS_EXPORT_PERNR.    "active version
      EXPORT pernr to memory id 'PMK'.
      set parameter id 'PMK' field pernr.
    ENDENHANCEMENT.
    On the other hand an RFC function module that has the code:
            pmk    LIKE PSKEY-PERNR,
            pmk_2  LIKE PSKEY-PERNR.
      get parameter id 'PMK' field pmk.
      IMPORT pmk_2 FROM MEMORY ID 'PMK'.
    When the execution is done in development environment, the modules function at the level of R3, the "get parameter id" works only if the debbuger is classic, otherwise not work. The Import to memory id never works.
    In the environment of quality, r3 do not work any of the 2 sentences. If run from portal (which is as it should be) does not work.
    Thanks if anyone can help me get the problem. Both function modules are executed at the portal.
    Regards
    Edited by: Daynet1840 on Feb 15, 2012 2:02 AM

    When the execution is directly in r3, in development environment or quality, does the set / get parameter id. Export / Import memory id not work.
    But if the FM are called from the portal, does not the set / get parameter id.
    I tried changing the sentence as I indicated harishkumar.dy still not working.
    Madhu: They're in different function groups, one is standard and the other not.
    Regards
    Edited by: Daynet1840 on Feb 15, 2012 3:08 PM
    Edited by: Daynet1840 on Feb 15, 2012 3:11 PM

  • Pass values between panels in different UI files

    Hi All,
    Is there a way to pass values between panels belonging to User Interface files ? Or is it easier to have one .uir and different .c and .h files ?
    Thanks,
    Kanu

    I should say that it's not possible for you to trap events from the first popup,and this depends on the basic concept of "popup panel".
    When you install a popup panel, all user interaction with existing panels is excluded: all focus it aimed at the popup only, no other user interface event is generated. If you launch another popup from the first one, the second popup prevails over the first one and no event can be generated on the first panel until the second one is closed.
    Handling a chain of two popup panels while looping on GetUserEvent can lead to unpredictable situation not so easy to untangle.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Passing values between event structure cases

    Hello everybody,
    I have a question concerning the event structure  - how to pass values (let's say a string / the state of a boolean control / the value of a numeric control value / an array of numeric values) between event cases ?
    There seem to be 2 situations here  :
    - when you need to pass the value of the control that triggers an event;
    - when you need to pass the value of a control which is modified in an event case.
    I have read the documentation but i still do not understand very clearly how to do this. Maybe you can point me in the right direction (maybe some threads on the forum that i have missed).
    Thank you very much !!
    (KUDOS for everyone who is interested in this )

    AndreiN2014 wrote:
    - when you need to pass the value of the control that triggers an event;
    - when you need to pass the value of a control which is modified in an event case.
    The first question isn't worded very well.  What exactly are you looking to do?  Are you looking for an event that specifically relates to that control?  If so, just drop it inside of the event and wire it.  Are you looking to trigger multiple events from the same control?  Ie, you hit the control, event1 is triggered which then triggers event2 ... ?  If so, you might consider taking a look at a different architecture.  I can think of very few cases where I'd prefer do this over something like having the button trigger a state and using the state machine architecture. 
    Others have pointed out the Shift Register.  This is the typical way to pass values between one iteration of a loop to another.  We can assume you have some sort of loop outside of the event structure to make it run a second time.  Put a shift register on this loop and the value wired into it will pass each iteration.  But, if it's just a random control, you can also just leave that outside of the event structure and wire it in as well.  This will provide the new value to the next occurrence of the event structure.
    You really need to define your problem before trying to solve it.

  • Use context to pass value between JPF and Java Control

    hi,
    Can we use context to pass value between JPF and Java Control? It works if i m using InitialContext in the same machine but i dun think it will works if i put Web server and application server in different machine. Anyone have an idea how to do it?
    I also want to get the method name in the onAcquire callback method. Anyone knows how to do this?
    thks
    ?:|

    Hi.
    Yoy can the next options for make this:
    1. Pass your values in http request.
    example: http://localhost/index.jsp?var1=value1&var2=value2&var3....
    2. You can use a no visible frame (of height or width 0) and keep your variables and values there using Javascript, but of this form, single you will be able to check the values in the part client, not in the server. Of this form, the values of vars are not visible from the user in the navigation bar.
    Greeting.

  • How to pass value between models?

    Dear all,
    I use VC 7.0 composer to create dashboards. That include one overview dashboard (model) to show seven KPI in one screen and I also have seven detailed dashboards (models) to show the detail of each KPI.  Each dashboard has their own iView .   User will only need to pick a plant once at the overview dashboard and I expect the plant value will be passed to other seven detailed dashboards.
    Since those dashboards are saved in different models, I just wonder is it possible I can pass the value from the overview dashboard model to the separated detailed dashboard models? The reason I donu2019t put all dashboards in one model because I need to have different reports assigned on the left of the screen for each dashboard in portal. If I need to accomplish this in portal, I believe I need separate iView(model) for each dashboard. Please correct me if I am wrong since I am new to portal development. Thanks.

    I think it is possible to pass values between models.
    Just creat on "Write-RFC" and one "Read-RFC"
    The RFC has just the function to write/read a value into an customer table...
    ^^ We have tried this scenario and it works perfect.
    Regards
    Florian

  • How to pass values between views in FPM - GAF

    Hi Experts ,
    i have a doubt in FPM how to pass values between views .
    For Example:  i am having 2 views -  1 ) overview , 2 ) edit  using  the GAF
    in 1st view (overview ) i have a table displaying the employee details , i will select a single employee from that table for editing .
    how to pass the selected employee details to the 2 nd view (edit ) .
    Thanks & regards
    chinnaiya P

    Hi chinnaiya pandiyan,
    Please follow below steps:
    1. To achieve this u need to create two context nodes in the component controller.
    2. Say one is EMPLOYEE_DATA and other is SELECTED_DATA.
    3. Set the Cardinality of EMPLOYEE_DATA to 0..n and SELECTED_DATA to 1..1.
    4. Add same attributes to both nodes. (probably all those fields that are required in table and/or in edit view.
    5. Map both these nodes to OVERVIEW view.
    6. Map only SELECTED_DATA node to EDIT view.
    7. Create table in OVERVIEW view based on EMPLOYEE_DATA node.
    8. Create edit form in EDIT view based on SELECTED_DATA node.
    9. While navigating from OVERVIEW view to EDIT view, read the selected element of EMPLOYEE_DATA node and copy it to an element of SELECTED_DATA node. This should be written in PROCESS_EVENT method of component controller inherited from FPM component.
    10. Now u got the selected data in SELECTED_DATA node which will be displayed in EDIT view.
    Regards,
    Vikrant

  • Passing values between jsp and php

    hi there, is it possible to pass values between jsp and
    php? i really need to find out the way if there is
    any. thanks in advance
    -azali-

    Yes, there are a few ways to do this.
    1) Think about using Cookies.
    2) Maybe use a Redirect passing the values in the Query string.
    3) Retain the data in a repository in the back end.
    4) Using Hidden fields within your pages.
    I am sure you can use these Idea's for a base to develop other methods on how to pass values back and forth from JSP -> PHP and vice versa.
    -Richard Burton

  • How to pass value between two forms.

    Hi all,
    how to pass value between two forms(using :parameter),...
    Thanks
    Rajesh

    To use parameters, create a parameterlist with the named parameters
    DECLARE
      pl_id PARAMLIST;
      pl_name VARCHAR2(10) := 'tempdata';
    BEGIN
      pl_id := Get_Parameter_List(pl_name);
      IF not Id_Null(pl_id) THEN
        DESTROY_PARAMETER_LIST(pl_id);
      END IF;
      pl_id := Create_Parameter_List(pl_name);
      ADD_PARAMETER (pl_id,'MYPARAMETER',TEXT_PARAMETER,:BLOCK.VALUE);      
      CALL_FORM('MYNEWFORM', NO_HIDE, DO_REPLACE, NO_QUERY_ONLY, pl_id);
    END;In the new form you can then just access the parameters via :PARAMETER.MYPARAMETER;
    An alternative is the usage of globals:
    :GLOBAL.MYPARAM:=:BLOCK.VALUE;
    -- call the emp-form
    CALL_FORM('MYNEWFORM', NO_HIDE, DO_REPLACE);and in the new form use:
    DEFAULT_VALUE(NULL, 'GLOBAL.MYPARAM');
    IF :GLOBAL.MYPARAM IS NOT NULL THEN
    ...The advantage of gloabls is that they can also return values back to the calling form, which is not possible using parameters

  • Pass value between JSP pages

    I would like to pass values between pages.
    I don't want showing up on the url. Ex: some.jsp?param=value
    I don't feel it's safe.
    It's not coming from form either....
    How can I hide the value and pass it to next page?
    I want to pass the value when the user click on a hyperlink
    Thanks In Advance.
    Message was edited by:
    Theepan

    Client side information is never safe no matter what you do. If the values don't end up in the url, they are always present SOMEWHERE in the html content.
    If you don't want the values to end up in the url, rework the page so it DOES do a post form submit. You could turn the hyperlink into a javascript call that submits the form for you.

Maybe you are looking for

  • Missing focus indicator for selectOneRadio

    Hello, I am using JDeveloper 11.1.1.6.0. I am working on a project that is required to meet accessibility standards and have run across an issue with the selectOneRadio. When there is no selection made in the radio (either by default or manual select

  • Question about Java Errors

    I have some questions about some java errors 1. what kind of errors are contained in Error class? 2.does this class contain only runtime errors? 3. if the question number 2 is positive, what about InstantiationError which is a compile error and is a

  • Is it possible to get the line, an error occure on MobiLink upload (handle_error)

    Is it possible to idendify the row of upload set, in which an error occured (given it's not a general fail of query), solve the error and continue? In my current example I'm getting a unique key exception on upload I'd like to handle with some automa

  • I have put an album into itunes

    I have put an album into iTunes. The album art shows in the get info box. But the album art will not display in the artwork box by the track listings. Please help.

  • Textpad can't Run programs after installing oracle9i Jdeveloper

    'NoClassFound' this type run error is displaying the textpad editor, after installing the jDeveloper. Before installing the JDeveloper it was running properly from textpad through jdk 5, Now it is showing the above error. Though from the jdeveloper r