If a user interacts with various HTML form elements (such as checkboxes,
selection lists, and radio buttons) on a page displaying a result set based
on the selected options, what design decisions should I consider in how to
maintain the state of the selections between page reloads?  There seem to be
many options, including:

(1) Using request.getParameter method
(2) Using a simple bean
(3) Using JavaScript to construct the URL
(4) Using hidden form elements

And, apparently, if Unicode is involved, I'm hearing I might want to use a
POST method rather than a GET, in order to preserve the Unicode characters
properly.  It seems that the simplest would be to use the
request.getParameter method.  So, when would I use beans instead?

I'm just learning JSP and how to handle these issues, and am quite puzzled
by what I'm reading (see comments below).  There really doesn't seem to be a
consensus, and when solutions are offered, either alternatives are not
readily mentioned or they don't say when one technique is preferred over
another.  So, can any of you authors or experts offer sage advice for design
considerations?  Am I missing something?  It seems that some solutions are
harder than necessary.

Thanks,
Steve


=========
Here's some of what I've read:

Advanced JavaServer Pages (in Chapter 3, HTML Forms) -- David M. Geary:
"Using beans to capture state is the preferred method for handling forms..."

Java Servlet Programming (in Chapter 18, JavaServer Pages)-- Jason Hunter:
- has an example of using a bean to store and retrieve properties from a JSP
page.

Professional Java Server Programming (chapter 14, Writing Maintainable JSP
Pages) -- chapter author unknown:
"State within a JSP should be held within beans."

Beans and Form Processing (http://www.jsptut.com/Forms.jsp):
"The standard way of handling forms in JSP is to define a "bean". This is
not a full Java bean.  You just need to define a class that has a field
corresponding to each field in a form..."

JavaServer Pages -- Hans Bersten:
-- excellent book, but maybe I missed this discussion and the book isn't
handy.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to