This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
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.
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!!!
subject: How to show a textfield dynamically using struts..(URGENT)