[英]Assigning jsp element value to struts2 textfield
I am implementing logic for updating user details so for that i have run hibernate query and desired object of class Applicants now what I want is to use class Applicant object and use property getApplicantId()
and use it in Struts2 textfield 我正在实现用于更新用户详细信息的逻辑,因此我已经运行了休眠查询和类Applicants的所需对象,现在我想要的是使用类Applicant对象并使用属性
getApplicantId()
并在Struts2文本字段中使用它
<%
String id="12"; // for not using static Id later i'll fetch Id from session.
UserData data=new UserData();
Applicant applicant=(Applicant)data.fetchUserData(id);
%>
Now i want to use JSP's ID in struts2 textfield like 现在我想在struts2文本字段中使用JSP的ID,例如
<s:textfield name="fName" value="<%=applicant.getApplicantId()%>"/>
Scriptlets can't be used in the Struts2 tags. Scriptlet不能在Struts2标签中使用。 And I strongly recommend to move it to the action.
我强烈建议将其付诸行动。 As a workaround you may use a stringified value
作为解决方法,您可以使用一个字符串化的值
<s:textfield name="fName"><%=applicant.getApplicantId()%></s:textfield>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.