Reputation: 17269
I have the following JSP scriptlets:
<input type="text" name="user.emailAddress"
value="<%=UserServiceFactory.getUserService().getCurrentUser().getEmail()%>"
readonly="readonly"/>
How to convert it to struts 2 tag
<s:textfield />
to avoid scriptlets.
Upvotes: 0
Views: 553
Reputation: 3514
When you are opening this page, if you are using prepare method. Set this email address in that method.
user.setEmailAddress(UserServiceFactory.getUserService().getCurrentUser().getEmail())
You HTML will be
<s:textfield name="user.emailAddress" readonly="true" />
Upvotes: 1