У меня есть следующий набор полей в jsp.
<fieldset id="myFieldset" method ="post" action="Values">
<legend> Value Input</legend>
<table border="0" cellpadding="3" cellspacing="3" width="100%">
<tbody>
<tr>
<td class="form-row" style="font-weight:bold; font-size:10px; color: #006699;">
<label1>Present date</label1> <input id="presentDate" name="presentDate" type="date">
<label1>Payment Type</label1>
<select id="payType" name="payType" style="font-size:11px;text-align: right; width:105px;" >
<option value="A">Advance</option>
<option value="B">In Arrears</option>
</select>
<br/>
</td>
Я пытаюсь включить / отключить его через Java с помощью сервлета.Вот мой сервлет.
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
log.debug("doGet");
response.setContentType("text/html");
PrintWriter out = response.getWriter();
Connection con = null;
try {
con = accountPool.getConnection(); //get one connection
/**Check to see if user is an admin*/
boolean go = isAdmin(con, request);
if (go) {
out.println(displayPage.blankTop(request, response, getServletContext()));
String text = request.getParameter("myFieldset");
out.println("myFieldset" + text);
out.println("<input type='checkbox' name = 'check' onclick=\"validation(this);\"CHECKED />");
out.println("<script type='text/javascript'>function validation(check) {if(check.checked == true){"
+ "document.getElementById(\"myFieldset\").disabled = true;"
+ "} else {"
+"document.getElementById(\"myFieldset\").disabled = false;"
+ "} } </script>");
out.print("<tr><td>");
printUserTable(con, out);
displayPage.bottom();
out.println("</div>");
con.close();
} else {
/**You are not an admin*/
out.println(displayPage.top(request, response, getServletContext()) +
displayPage.bottom());//You are not an admin
}
} catch (Exception e) {
out.println("Exception: " + e.getMessage());
e.printStackTrace();
} finally {
PooledDataSource.returnConnection(con); //free up this connection
}
}
Однако, когда он не работает.Также out.println возвращает ноль для набора полей.Я не уверен, что мне здесь не хватает.
Любая помощь очень ценится.Спасибо.