Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to pass form field values between JSP pages?

Posted on 2004-08-24
8
Medium Priority
?
368 Views
Last Modified: 2011-09-20
I have a JSP form, and I need to pass all the form field values between two other pages.
And one of the form field values is a textarea field.

I don't think they can be passed in the URL, because of the length restriction.
So how can I do this.

An example would be appreciated.
0
Comment
Question by:g118481
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 32

Expert Comment

by:ldbkutty
ID: 11884480
Use POST method in your FORM tag.
0
 
LVL 11

Expert Comment

by:sompol_kiatkamolchai
ID: 11884506
<form name="form1" action="jsp2.jsp" method="post">
  <input type="text" name="field1">
  <input type="text" name="field2">
  <input type="text" name="field3">
  <input type="text" name="field4">
  <input type="text" name="field5">
...
  <input type="text" name="fieldn">
  <input type="submit">
</form>
0
 
LVL 32

Expert Comment

by:ldbkutty
ID: 11884532
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 1

Author Comment

by:g118481
ID: 11884922
I am sorry.
I didn't clarify my request enough.

I know all too well how to use POST for forms.
My issue is, that I need to pass the form values to two other JSP pages after the initial POST has been made by the form.

Example:

1.  my form post the field values to a select statement that checks table2
2.  I then need to pass those same form field values back to the form, or to another insert statement, depending on the results from table2.
0
 
LVL 6

Expert Comment

by:dorothy2
ID: 11885069
I think your issue is that (1) you don't want to pass the form values in the url because of size restrictions; and (2) if you pass them via POST, the form values are "request" level so you lose them after you process the page after the post.

I believe the request object stores all the values in a HashMap. Why don't you create your own HashMap, and give it "session" access? Then you can access the form values, update them whenever you want, and delete the HashMap when it is  no longer needed.

Dorothy
0
 
LVL 1

Author Comment

by:g118481
ID: 11885112
Dorothy,

That sounds like a good option.
Would you have an example to share?
0
 
LVL 11

Accepted Solution

by:
sompol_kiatkamolchai earned 200 total points
ID: 11888868
To share variable in session scope you can bind your value by

session.setAttribute("var1", someObject);

the above can be used in jsp page, if you want to do in Servlet the session variable need to get from request object.

HttpSession session = request.getSession();
session.setAttribute("var1", someObject);

and then var1 in session object will be available until session expired or IE browser is closed by client.
0
 
LVL 7

Expert Comment

by:a1programmer
ID: 11896348
You could also create a form to store the hidden values after the first post...  Then you could submit it to the other 2 pages using javascript.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As much as Microsoft wants to kill off PST file support, just as they tried to do with public folders, there are still times when it is useful or downright necessary to export Exchange mailboxes to PST files. Thankfully, it is still possible to e…
If something goes wrong with Exchange, your IT resources are in trouble.All Exchange server migration processes are not designed to be identical and though migrating email from on-premises Exchange mailbox to Cloud’s Office 365 is relatively simple…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question