using html:option tag

2005-09-27 Thread faisal.shoukat
Hi All,
 
I am using the html option tag embedded within the html select tag to
select a value from a drop down list as follows:
 
html:select property=title

html:option value=MrMr/html:option
html:option value=MrsMrs/html:option

/html:select
 
This works fine and I can save the correct value to the database.  The
question I have is how do I display the same option tag when updating
the user and the details are returned from a database.  So in plain
English after the user has saved the client to the db he then wants to
update the record.  A search is done but how do I display on the JSP
page the selected option with the option of seleting something else from
the drop down list.
 
Thanks in advance


Re: using html:option tag

2005-09-27 Thread Wendy Smoak

From: [EMAIL PROTECTED]


This works fine and I can save the correct value to the database.  The
question I have is how do I display the same option tag when updating
the user and the details are returned from a database.


The same JSP snippet you posted should work in both the 'add' and 'edit' 
forms.


For select list contents that are the same for every user, I use a 
ServletContextListener to place collections in application scope, and then 
use html:options or html:optionsCollection.  This avoids hard-coding the 
list of options.


--
Wendy Smoak 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: using html:option tag

2005-09-27 Thread glenn . deschenes
The html:select tag has an attribute value.
http://struts.apache.org/userGuide/struts-html.html#select
The value to compare with for marking an option selected. [RT Expr]

HTH,
Glenn



[EMAIL PROTECTED] 
27/09/2005 12:08 PM
Please respond to
Struts Users Mailing List user@struts.apache.org


To
user@struts.apache.org
cc

Subject
using html:option tag






Hi All,
 
I am using the html option tag embedded within the html select tag to
select a value from a drop down list as follows:
 
html:select property=title
 
html:option value=MrMr/html:option
html:option value=MrsMrs/html:option
 
/html:select
 
This works fine and I can save the correct value to the database.  The
question I have is how do I display the same option tag when updating
the user and the details are returned from a database.  So in plain
English after the user has saved the client to the db he then wants to
update the record.  A search is done but how do I display on the JSP
page the selected option with the option of seleting something else from
the drop down list.
 
Thanks in advance