RePopulate form with the information what user just submitted.

I have one form. That form has one submit button. I have to create a new button in that form say call "New button". When user submits that form it will display result page. That result page will have one back button. When I hit back button I can go back to that form again. After I go back to that form when I hit "New Button" the form field will fill up with the information what user just entered before submit. I am using JSP and Struts in my application. This functionality is basically need for the user so that user do not need to entered the same information again.
Can you please help me what I have to do for that?
Thank you very much for your help.

Well, in your program, do you have one Form, or do you create a new Form whenever it's needed (ie, when the program starts up, and when the Back button is pushed from the result page)?
If you have one Form (which is the best approach in my opinion), then it probably follows this general structure:
public class Form {
   public Form() {
      // Do some constructor work in here
   public void submit() {
      // This is probably called when the user clicks the Submit button
}... obviously there's a lot more stuff going on inside the class that I have listed right there, but what I meant by 'storing the values as fields' would actually be really simple to implement.
A field is:
either class or instance member variables. non-local variables. Field also includes static final constants. http://mindprod.com/jgloss/fields.html
In short, it's just a variable stored in your class.
I'm sure you already have text fields and buttons as fields in your form class, probably like this:
public class Form {
   private JTextField userNameField = new JTextField("Input User Name Here");
   private JButton submitButton = new JButton("Submit");
}And if you don't, then you should probably adjust your structure so you do. Anyways, to store the data the user has input, just create Objects to store them.
public class Form {
   private JTextField userNameField = new JTextField("Input User Name Here");
   private JButton submitButton = new JButton("Submit");
   private String userName = ""; // This is our 'name field.' It is set to whatever is in the userNameField when the submit method is invoked. It is what stores the user's name. In the refresh method, you can set the userNameField's text (via setText) to this value.
   // ...You could make a field for each thing you need to store, such as age, race, eye color, whatever.
To implement 'storing' and 'using' these fields is also simple. You'd just need to adjust your submit method, and provide a new method that we'll call refresh. Now, by refresh I am not referring to a browser's refresh button which refreshes the page- I just named it refresh because it 'refreshes' our Form with the data the user previously input.
public class Form {
   public void submit() {
      // Do submittal stuff
      userName = userNameField.getText(); // This line right here ensures that the user's name is 'stored.'
   public void refresh() {
      userNameField.setText(userName); // This line causes the userNameField to be 'refreshed' with the data previously submitted.
   }Hope that helps.

Similar Messages

  • Why some contact forms doesn't work on some websites? We don't receive the submission form with the information?

    Why some contact forms doesn't work on some websites? We don't receive the submission form with the information?

    Hi Aish
    I wanted to check the following, but the URL is not found, you have another one?
    thanks
    Nicole
        4. Visit http://my-site.com/scripts/form_check.php in a web browser and make sure you see all green checkmarks. If some items do not display green checkmarks that means that the hosting server is not configured correctly to allow the Form widgets to send email messages to the address you've specified.
                    Contact your web-hosting provider about the server configuration problem. Describe the items that are not marked as green in the form check page, so that they can help you set up the servers to use the correct settings.
    Il giorno 9-set-2014, alle ore 16:11, Aishvarya Raj Rastogi <[email protected]> ha scritto:
    Why some contact forms doesn't work on some websites? We don't receive the submission form with the information?
    created by Aishvarya Raj Rastogi in Help with using Adobe Muse CC - View the full discussion
    Hi Nicole,
    What is the "From" email address in your form?
    Also, have you checked the spam folder?
    Please check the following posts as well :
    https://forums.adobe.com/docs/DOC-3581
    Re: PHP mail may be disabled or incorrectly configured on the web server.
    Regards,
    Aish
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at https://forums.adobe.com/message/6714281#6714281
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:
    To unsubscribe from this thread, please visit the message page at . In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Help with using Adobe Muse CC by email or at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.

  • My new Iphone 4 is restoring with the information from my old Iphone 3gs on itunes. How do I restore it back to 4g?

    My New Iphone 4 is restoring with the information from my old IPhone 3gs on Itunes. How do i get it to restore back to the 4g?

    There is no 4g.
    If you don't want to restore it with your old iPhone information, then just restore as a NEW phone, not from the backup. Don't quite understand what there's not to get. :-|

  • Problems with the imadmin purge user command

    I am using iMS 5.2 hot fix 1.05, iDA1.2sp1 and iDS 5.1
    When I try to use the imadmin purge user command I get the following errors:
    [email protected]: purging user
    [email protected]: purge user failed
    Failed connection refused.
    If I don't use the -g 0 option then it reports success, but the user account is still in LDAP...
    I found a reference to the imadmin user purge command not working when you have iDA 1.2patch1 and iMS 5.1 patch 1 unless you make a change to your resource.properties file but i have tried the file both way and I get the same error with the purge user command.
    I can use the imadmin delete user or imadmin modify user without any problem. I am just having trouble with the imadmin purge user command.
    Any ideas?

    This problem is documented in bug id 4671472. I have attempted the recommeded fix, but the problem persists. If anyone else has been having a similar problem and has any solution let me know. Thanks.
    Peter

  • Perform as pdf form with the ability to insert pictures

    How to perform as pdf form. with the ability to insert pictures?

    You want your users to be able to insert images into a PDF form? That is only possible if they're either using Acrobat, or if they're using the latest version of Reader (XI) and the image is in PDF format.

  • I have a web form with the save function, which works well until another person is required to complete a part of the form.  Can the form link be sent to others?

    Some respondents need to save it part way through and send the form on to someone else to complete a section.  When they send the link the other people dont seem able to see the form with the content previously completed, rather a blank form opens up. Can this be fixed? if so how?

    thanks. We are having continuing problems - after 45 mins on to adobe help, the only suggestion given is to try a different browser.  unsurprisingly this does not work! I am using the email received - which has the 'retrieve form' box attached.  One user was able to save it once, went back later did some more, and saved (or so she thought) when she went back again, it was totally empty! 
    I have had really mixed results - some have used the form with no problem, whilst others have reported the same issue (using various browsers).  Any suggestions..... (i set 28 days, as the time to keep open, and all are within this time frame).
    amanda

  • I am syncing my ipod but it comes up with a error saying itunes could not backup the ipod because the backup was corrupt or not compatible with the ipod, what do i do?

    i am syncing my ipod but it comes up with a error saying itunes could not backup the ipod because the backup was corrupt or not compatible with the ipod, what do i do?

    As I said the iTunes program on the computer.  You open iTunes on the computer and go to the View menue in the upper rightand then click on preferences. Go to Devices and delete the backup.

  • I am running lion now and I am not able to safe my emails to the computer with the attachments. what's wrong?

    I am running lion now and I am not able to safe my emails to the computer with the attachments. what's wrong?

    Try using these settings: http://support.apple.com/kb/HT4864.

  • I am not able to open iCloud from pc, error is "problem with the server". what should I do?

    I am not able to open iCloud from pc, error is "problem with the server". what should I do?

    Go to Settings>General>Restrictions>Accounts (near the bottom) and set this to Allow Changes.  You will then be able to access Settings>iCloud again.

  • I upgraded to lion, now that I am restarting my mac, it is asking for a password. mind you i never set a password in the begining. so i used my start up cd and re set the password and restarted my mac only to be faced with the same delima. user password.

    I upgraded to lion, now that I am restarting my mac, it is asking for a password. mind you i never set a password in the begining.
    So i used my start up cd and re set the password and restarted my mac only to be faced with the same delima. user password please.
    I am currently in safe mode, otherwise I can't log on to mymac
    Please help, anyone

    thank you to all who responded. the final line was that I had to reboot and loss all of my info.
    this was per apple store intelligence.

  • I am trying to look at my I cloud account on a pc in the library it normally works fine but now says problem connecting with the server. what can i do or is there an issue today

    I am trying to look at my I cloud account on a pc in the library it normally works fine but now says problem connecting with the server. what can i do or is there an issue today

    Hi...
    Try restarting the AMDS >  How to restart the Apple Mobile Device Service (AMDS) on Windows
    iCloud system status reports everything green >  Apple - System Status

  • How to create a form with the Designer Peopletools

    Help friends of the forum:
    Any page of examples of how to create forms with the tool in PeopleSoft Application Designer

    http://www.oracle.com/technology/documentation/psftent.html
    Down Peopletools 8.xx PeopleBooks and look at the PeopleSoft Application Designer
    It walks you through the whole Process

  • HT201304 I want to buy new level from candy crush, but unfortunately apple required to accept terms and condition first before I can buy. But once I click yes no more option to click I agree with the condition. what should I do?

    I want to buy new level from candy crush, but unfortunately apple required to accept terms and condition first before I can buy. But once I click yes no more option to click I agree with the condition. what should I do?

    Perform a Reset... Try again...
    Reset  ( No Data will be Lost )
    Press and hold the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears. Release the Buttons.
    http://support.apple.com/kb/ht1430

  • Do I gee a copy of submitted forms with the free account?

    Do I gee a copy of submitted forms with the free account?

    Hi;
    Using the Free account you can view the submitted data and export it to Excel, PDF or CSV (the data is in a table format).
    Email Notifications, where an email comes to you each time someone submits the form is a paid level feature.  Another Paid level feature is "Download Response as PDF" which allows you to save/download a PDF version of the filled out form that looks like the original.
    Thanks,
    Josh

  • Hi  i am trying to open a pdf  but " preview " is saying that the file cannot be opened or that there is a problem with the file  - what do i do? :-)

    hi  i am trying to open a pdf  but " preview " is saying that the file cannot be opened or that there is a problem with the file  - what do i do? :-)

    Try opening the file using Adobe Reader.
    Clinton

Maybe you are looking for

  • WITH clause in a stored procedure

    Hi, i have the following code for a stored procedure: create or replace PROCEDURE DISP_ORDER ( param1 IN VARCHAR2 , param2 OUT Types.cursor_type ) AS BEGIN WITH itemall as (select * from rep_order) open param2 for select * from itemall; END DISP_ORDE

  • Help with a menu bar

    Hi all, Thank you in advance for any help. I'm a bit of a beginner when it comes to coding but I'm trying to come up with a drop down menu bar very simliar to the one on this website: www.fatmedia.co.uk I've used inspect element to view the CSS and a

  • Why do I have 2 versions of the program pages on my mac after the update?

    Why do I have 2 versions of the program pages on my mac after the update?

  • IPhoto and a Projector

    Can I set iPhoto up so that when I play a slideshow from within iPhoto, it is displayed by the project as part of an extended monitor. I know keynote and powerpoint work this way. Thanks,

  • Lightroom 2.1 Auto import file naming adding -1

    I have used lightroom's (2.1) auto import function on 5 separate shoots with no problem. On my last shoot lightroom has been adding a "-1" to the file name. I am using "Custom name - Original File". So what used to be "Jen-1007" is now "Jen-1-1007",