Is there any way to append the string present in servlet on checkbox checked. My servlet code snippet is:
PrintWriter pw=res.getWriter();//get the stream to write the data
pw.println("<html><body><center>");
pw.println("<h3>Welcome to servlet<b>");
pw.println("</b></h3><br><br>");
String[] prop = obj.returndays(pathDir);
pw.println("The File property is ::<br><table><tr><th>User or Group Name</th><th>Permission[These checkboxes are not modifiable]</th></tr>");
len=prop.length;
String[] arr = new String[len];
for(int i=0;i<len;i++)
{
String str="";
String[] parts=prop[i].split("\\\\");
arr[i]=parts[0];
pw.println("<tr><td>");
pw.println(parts[0]+"\\ "+parts[1]);
pw.println("</td><td>");
if(parts[2].contains("Full Control"))
{
pw.println("<label><input type='checkbox' value='FullControl' checked='checked' oncheck='appendString('Full control')'/>Full Control </label>"
+ "<label><input type='checkbox' value='Read' checked='checked' onclick='appendString('Read')'/>Read </label>"
+ "<label><input type='checkbox' value='Write' checked='checked' onclick='appendString('Write')'/>Write </label>"
+ "<label><input type='checkbox' value='Execute' checked='checked' onclick='appendString('Execute')'/>Execute</label>");
}
request.setAttribute("string", str);
I want to define a function appendString(String s), that will append 's' into 'str' variable defined above and finally pass that string as a parameter. I'm just concerned about how to append string str oncheck and get it in servlet to further process it.
Is there any other way to do the above desired thing?
Aucun commentaire:
Enregistrer un commentaire