Tuvshinbayar Davaa
Tuvshinbayar Davaa

Reputation: 19

How to set custom value of object to textfield tag in Struts2

I want to use the value of custom object in textfield. Is it done by EL expression or any other way? Scriplets does not work as mentioned below

<s:textfield label="Login" name="loginName" value=<%=temp.getLoginName()%>/>

Upvotes: 0

Views: 1529

Answers (1)

Boris the Spider
Boris the Spider

Reputation: 61148

You need to provide a getter for the custom object from your action and a getter for its 'value' and then do:

<s:textfield value="%{customObject.value}"/>

Upvotes: 2

Related Questions