Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combo box in JSP 1

Status
Not open for further replies.

tvrtko

Programmer
Nov 26, 2003
53
HR
I made the class that makes a combo box in JSP page.
Please tell me how to send selected entry as a request parameter and how to get it in servlet.

Thanks
 
Class looks like this:

public class MyClass {

public MyClass () {
}

public StringBuffer getSomething(String styleClass) {
StringBuffer tmp = new StringBuffer();
tmp.append( &quot;<SELECT SIZE=1 class=&quot; + &quot; &quot; + styleClass + &quot; &quot; + &quot; style='WIDTH:136px'>&quot; );
tmp.append(&quot;<OPTION>first</OPTION>&quot;);
tmp.append(&quot;<OPTION>second</OPTION>&quot;);
tmp.append(&quot;</SELECT>&quot;);
return( tmp );
}
}

and JSP page:
<% MyClass myClass = new MyClass();%>
<%= myClass.getSomething(comboStyle) %>

I'm new in this, so please help
 
Hi,

I hope I did understand your question correctly.
Why dont you pass the name value to your select box along with style and ArrayList too to populate the select box values.

So in the servlet you can get the name value pair of the select box.

getSomeThing(String name, List list, String style)

Cheers,
Venu

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top