How to get the value of radio attribute value

Category: Java EE
 
allen8081
2011-11-13 12:59:15

Sponsored Links
radio tags in html value attribute, if it is not a given value, but a variable value, which indicates how it? Or not using js js also denote ah? Forget you big ox pointing, jsp, which is a section of code, and now want to get the value submitted to the servlet value value value does not know how to represent
<%
; ParkDao pardao = new ParkDaoImp ​​();
Park par = new Park ();
List <Park> pl = new ArrayList <Park> ();
pl = pardao.findPark (0);
for (Iterator <Park> it = pl.iterator (); it.hasNext () ;) {
int parknum = it.next (). getParknum () ;

%>
<tr bgcolor="#FFFFFF"> ;
<td height="20"> <input type = "radio" name = "parknum" value = "< ;% = parknum%> "/> </td>
; <td align="center"> <% = parknum%> </td>
</tr>
; <%
}
;%>

Sponsored Links

aixiaoyang9166
2011-11-13 01:06:30
String parknum = request.getPrameter ("parknum");
duquanji
2011-11-13 01:24:58
value = "<% = parknum %> ", you wrote is right? I mainly do not know write right
rockjackie23
2011-11-13 01:28:34
jsp:
<input type = "radio" value = "<% xxxx%>" checked = "checked" name = "name" />
serlet:
String names = request.getParameterValues ​​("name");
Test test ; = new Test () ;/ / here to create your entity class object
if (names.length! = 0) {
for (Test st : names) {
test.setName (st.getName ());
}
}
; return test ;/ / Here is what you get radio value object is stored, and then modify their own
zhaogaixin74156
2011-11-13 01:35:19
something less embarrassed modify the next
servlet
String [] names = request.getParameterValues ​​("name");
String ips = "";
if (names! = null ) {
for (int i = 0; i <names.length; i + +) {
ips + = names [i]. trim () + ",";
}
} else {
ips = request.getParameter ("name" );
}
; return ips;
zhbluest
2011-11-13 01:40:36
Thank you, know
hemingway0117
2011-11-13 01:47:53

radio is not radio do? Select a use getParameterValues ​​this can ah?
syk22
2011-11-13 01:51:31
Since we know it will end affixed to the mix of friends
maqingqinglove
2011-11-13 02:08:52
request.getParameterValues ​​("name");
Domain and server ip had changed since 8/23/2013. Suspend the user registration and posts for program maintenance.