wood burning stoves 2.0*
The moose likes Struts and the fly likes How to show a textfield dynamically using struts..(URGENT) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to show a textfield dynamically using struts..(URGENT)" Watch "How to show a textfield dynamically using struts..(URGENT)" New topic
Author

How to show a textfield dynamically using struts..(URGENT)

preethi venkatarangan
Greenhorn

Joined: Jan 21, 2007
Posts: 27
Hi everyone..
I want to know how to show or hide a text filed based on the value selected in a Drop down List.
Say for example i have created a DropDownList which has numbers 1,2,3 using the <html:select> tag &<html ptionsCollection> tag.
Now if i need to display 1 textfield if the user has selected 1 from dropdownlist, 2 textfields if user has selected 2 from the list.

Can someone please help me by providing a sample code.I need it very badly.

Thanks in Advance For your help.
rajan Kayarohanam
Greenhorn

Joined: Jan 24, 2008
Posts: 12
hi,
for this you can write a code in your action such that take the selected value in that dropdown list and based upon that set some boolean value/set some property in the form to 1/2/3/4 which ever you want. and in the JSP you can use <logic:equal name="formName" property="thePropertyyouHaveSetInForm" value="1/2/3/4..."> give the Text box here.</logic:equal>.

Basically you have to get the dropdown list value in your action and based upon that you have to set a property to 1or2or3or4 and can use the logc:equal tag.

Test and let me know if this had helped you... Good Luck!!!
 
Don't get me started about those stupid light bulbs.
 
subject: How to show a textfield dynamically using struts..(URGENT)
 
Similar Threads
how to show same row for each click on a link
how to preselect value in dropdownlist in jsp struts
How to show a textfield dynamically
Drop Down Box in Struts - Select Default Value Implementation
getting this Ajax code to work with jsp