我已将所有联系人详细信息存储在模型中的bean中,并将bean返回到Controller Servlet。在控制器Servlet中,我将这个bean存储到请求中并将其传递给JSP。在JSP中,我希望将所有用户详细信息保留在各自的文本框中。我用过表达语言。它保留了很好的价值。
- ControllerServlet.java:
String email=(String)ses.getAttribute("user");
String sl_no2=(String)request.getParameter("sl_no");
AddContactBean ab=m.getconDetails(sl_no2,email);
request.setAttribute("condetails", ab);
rd=request.getRequestDispatcher("UpdateContact.jsp");
rd.forward(request, response);
- UpdateContact.jsp:
//Values of Dod,Ph_no,Tags are retaining well.. But not radio button's.
<input type="text" name="dob" value="${condetails.dob}${param.dob}">
<input type="text" name="ph_no" value="${condetails.ph_no}${param.ph_no}">
<input type="text" name="tags" value="${condetails.tags}${param.tags}">
// only radio button values not retaining. What is solution??
<input type="radio" name="gender" value="male"${condetails.gender}${param.gender}">
<input type="radio" name="gender" value="female"${condetails.gender}${param.gender}">
答案 0 :(得分:0)
这里EL的连接无效,
<input type="radio" name="gender" value="male"${condetails.gender}${param.gender}">
应该是,
<input type="radio" name="gender" value="male${condetails.gender}${param.gender}">