java - How do I store a dynamically changed textbox value as a checkbox value? -
i have table displays data database. table has 3 columns, first 1 being checkbox.
<sql:setdatasource var="datasource" driver="com.mysql.jdbc.driver" url="jdbc:mysql://localhost/phonebookdb" user="root" password="12345" /> <sql:query var="pbook" datasource="${datasource}"> select * phonebook </sql:query> <html:form action="/phonebookaction.do" method="post" > <table align="center" bgcolor="khaki" border="5" bordercolor="saddlebrown" cellpadding="10"> <thead> <tr> <td align="center" ><b>select</b></td> <td align="center" ><b>name</b></td> <td align="center" ><b>phone number</b></td> </tr> </thead> <c:foreach items="${pbook.rows}" var="row"> <tr> <td align="center"> <input type="checkbox" align="middle" name="record" value="${row.id},${name},${pnum}"> </td> <td> <input type="text" name="name" maxlength="30" value="${row.c_name}" > </td> <td> <input type="text" name="pnum" maxlength="10" value="${row.p_num}"> </td> </tr> </c:foreach> </table> <html:submit property="method" value="edit" /> <html:submit property="method" value="delete" /> </html:form>
i want users able update values of columns name , phone number jsp itself. have no clue how can set updated value in textbox checkbox's value attribute , updated value can sent servlet , model, operation on db.
want solve without using javascript.
kindly help! thank you...
just pass row id value of checkbox. not append name , pnum on checikbox value.
on submit, in action class, append name , pnum rowid required.
i hope help. not see point in appending name , pnum row.id checkbox value in jsp page itself.
Comments
Post a Comment