You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by John Wright <jw...@fyidocs.com> on 2001/03/16 22:34:28 UTC

remembering selected option question

Maybe a newbie question here:

If a request is sent to a JSP page that has a <html:select>  tag but the
request does not include a parameter with the same name as the property
attribute of the <html:select> tag it is my understanding that an exception
will be thrown saying that the request must contain the parameter.  If this
is the case how do you handle cases in which you want to remember the
selected option when there might be other screens accessed in between the
times when the screen with the <html:select> tag is accessed?

Thanks,

John




Re: remembering selected option question

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 16 Mar 2001, John Wright wrote:

> Maybe a newbie question here:
> 
> If a request is sent to a JSP page that has a <html:select>  tag but the
> request does not include a parameter with the same name as the property
> attribute of the <html:select> tag it is my understanding that an exception
> will be thrown saying that the request must contain the parameter.  If this
> is the case how do you handle cases in which you want to remember the
> selected option when there might be other screens accessed in between the
> times when the screen with the <html:select> tag is accessed?
> 

I'm not quite sure I understand your question completely, but the general
philosophy in Struts works like this:

* Requests are submitted to an Action (via the Controller servlet)
  rather than being submitted directly to a page.

* The controller servlet can associate a form bean (an instance of
  ActionForm) with the request, in order to capture the input fields
  from that request.  You would have a property to capture the current
  state of the property you are using <html:select> on, for example.

* If you need to keep the information about what was selected for more
  than one request, the typical approach would be to store the
  corresponding form bean in the user's session.


> Thanks,
> 
> John
> 

Craig McClanahan