tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dennis Dai <>
Subject Re: Progamatically setting values of FORM elements
Date Fri, 30 Jul 2004 20:34:24 GMT
Well it's not part of the servlet spec and certainly should not be IMHO.

What you can do is to create a bean which sets those parameters from the 
request, and pass it to the resulting JSP page. Then in the JSP page you 
use getter methods (or EL variables) to populate those parameters. This 
is usually used when there're errors in the submitted form and I'd 
assume you're going to use it with the same purpose.

Various web application frameworks like struts or webwork/xwork will do 
this automatically for you. (I'm using webwork/xwork right now and IMHO 
it's much less complicated and more elegant than struts.) If you're 
using your home grown framework, you can at least borrow ideas from 
those other frameworks ...

On 7/30/2004 1:13 PM, Luc Foisy wrote:

> No concept of HTML. But it does have concept of parameters. When you submit a form, the
form contents are placed in a parameter. (in ServletRequest)
> There is no way that I know of to do the reverse, set those parameters on the response
and it will apply to the form elements.
> The browser stores the element values somewhere, just thought it might have been floating
around somewhere I could get it.
> I thought someone would know something I did not.
> -----Original Message-----
> From: Shapira, Yoav []
> Sent: Friday, July 30, 2004 3:43 PM
> To: Tomcat Users List
> Subject: RE: Progamatically setting values of FORM elements
> Hi,
> No, the Servlet API has no concept of HTML.
> Yoav Shapira
> Millennium Research Informatics
>>-----Original Message-----
>>From: Luc Foisy []
>>Sent: Friday, July 30, 2004 3:41 PM
>>To: Tomcat Users List
>>Subject: RE: Progamatically setting values of FORM elements
>>>From the responses, I am guessing there is not a way to do this with
> only
>>the Servlet API?
>>I am not currently using struts and learning to use them, implementing
> them
>>at this time, I think would be too much of a headache.
>>I'll have to find an alternate solution that fits into our own
> framework.
>>-----Original Message-----
>>From: Luc Foisy
>>Sent: Friday, July 30, 2004 1:10 PM
>>To: Tomcat User List (E-mail)
>>Subject: Progamatically setting values of FORM elements
>>Is there any way I can have my java set the values of FORM elements.
>>Rather than storing the values in the java code and generating the
> complete
>>form element containing that value.
>>Something like adding something to the response that will give that
> item a
>>For my particular need, I want to set a number of checkbox elements on
> or
>>off. I do have the ability to predict the element names...

Dennis Dai

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message