• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem on detecting the checkboxes  RSS feed

 
chiu pong
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
it's me again . I have a problem on detecting the checkboxes.
In a.jsp, i have the following code in a form.
<%
for (int j=0; j<size; j++) {
if(isLinked){
%>
<input type="checkbox" name="table<%=j%>" value="<%=tablename%>" checked/>
<%}else{%>
<input type="checkbox" name="table<%=j%>" value="<%=tablename%>" />
<%
}
}
%>
In a_action.jsp, which is the action page of the form, I detect the check boxes as followings:
<%
for (int i=0; i<size; i++) {
String tn = request.getParameter("table" + i);
if (tn!=null) {
//do something
}
}
%>
The problem is in a.jsp, checkboxes will be checked by default if isLinked==true, so i cannot detect they are checked or not by the action in a_action.jsp. String tn will always be null no matter i uncheck or check the default checked ones.
Can anyone suggest me how to handle this matter?
thx a lot.
ypc
 
Sachin Junghare
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know where you missed out ...but it is working fine for me ...!!!
It is correct code.
I do just few changes ... nothing great !!!
a.jsp
------

a_action.jsp
-----------

I get values for both the println...
Hope you resolve yur problem.
J Sachin.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!