• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Problem on detecting the checkboxes

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Could you hold this kitten for a sec? I need to adjust this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic