mardi 11 août 2020

send multiple checkbox value in loop to servlet

I have a servlet class with doget() that uses for loop to fill the checkbox for various users. For eg it will fill the user Rahul with checkbox read and execute based on the some criteria and it will fill user Subh with checkbox full control and the remaining boxes remain unchecked. Now the user on the web page unchecks or check the boxes for each user to modify it. Now how I'm supposed to pass the change checkbox value for each user to a different function.

for(int i=0;i<len;i++)
       {
         String[] parts = prop[i].split("\\\\");
         arr[i] = parts[0];
         pw.println("<tr><td>");
         pw.println(parts[0]+"\\ "+parts[1]);       //user's firstname\lastname
         pw.println("</td><td>");
         if(parts[2].contains("Full Control"))
         {
             pw.println("<label><input type='checkbox' value='FullControl' checked='checked'/>Full Control </label>"
                    + "<label><input type='checkbox' value='Read' checked='checked'/>Read </label>"
                    + "<label><input type='checkbox' value='Write' checked='checked'/>Write </label>"
                    + "<label><input type='checkbox' value='Execute' checked='checked'/>Execute</label>");
         } 
         else
         {
            pw.println("<label><input type='checkbox' value='FullControl'/>Full Control</label>");
            if(parts[2].contains("Read")){
                pw.println("<label><input type='checkbox' value='Read' checked='checked'/>Read</label>");
            }
            if(parts[2].contains("Execute")) {
                pw.println("<label><input type='checkbox' value='Execute' checked='checked' />Execute</label>");
            }
            if(parts[2].contains("Write")) {
                pw.println("<label><input type='checkbox' value='Write' checked='checked' />Write</label>");
            }
         }

I want to pass this details in a method modifyPermission(firstname, checkboxValue, allow\deny) to modify it for each user for each permission. Something like this

obj.modifyACL(username, accessType, allow\deny);



Aucun commentaire:

Enregistrer un commentaire