JR Galia
JR Galia

Reputation: 17269

JSP Scriptlets in Struts 2 Tags

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

Answers (1)

74H1R
74H1R

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

Related Questions