Reputation: 266
<s:property value="%{sourceName}"/>
<input type="text" name="sourceName" size="40" maxlength="25000" id="sourceName" class="gray" value="%{sourceName}"/>
<s:property>
prints the string present in sourceName, but unable to set the value attribute for textfield to sourceName.
Why is it that I am able to access value from value stack at some places and not at others?
Upvotes: 0
Views: 178
Reputation: 50203
Because %{}
is an OGNL notation, and hence can be used in Struts tags only.
The other one, in a simple HTML tag, should be a JSP EL notation, ${}
(or printed with the whole <s:property />
tag).
BTW Struts tags (and/or JSTL tags) are usually preferred to plain JSP EL because of different reasons, including security.
P.S: read this SO answer to better understand the several notations involved.
Upvotes: 1