Steve,
You wrote: "It seems that some solutions are harder than necessary."
The solution that you choose as a developer depends on the size of the
project you are working on. For simpler web applications, having every
page handle its own request parameters (perhaps by using a bean) may work
fine. In web applications that are more involved, you might want to
implement a Request-Controller architecture. In this case, a controller
JSP or servlet would handle the initial request and invoke a request
processor class to handle any processing and find the appropriate view page
to return as the response. The request processor class might then create
beans or otherwise maintain the session in order to supply the necessary
data to the view JSPs. You might want to check out the Jakarta Struts
architecture as an example of the Request-Controller architecture. In
struts, a class is created for each HTML form. This class is then used as
a bean for maintaining the page state. All form actions go to a servlet
controller that uses a config file to map a corresponding view page.
Regards,
Richard
At 11:57 AM 9/6/01 -0700, you wrote:
>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
===========================================================================
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