[英]Assigning jsp element value to 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);
%>
現在我想在struts2文本字段中使用JSP的ID,例如
<s:textfield name="fName" value="<%=applicant.getApplicantId()%>"/>
Scriptlet不能在Struts2標簽中使用。 我強烈建議將其付諸行動。 作為解決方法,您可以使用一個字符串化的值
<s:textfield name="fName"><%=applicant.getApplicantId()%></s:textfield>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.