How to declare a variable and assign value to that variable in Struts2?
Use the set tag:
<s:set var="myVar">hello</s:set>
read the var with:
<s:property value="#myVar"/>
Another example:
<s:set name="personName" value="person.name"/>
Hello, <s:property value="#personName"/>. How are you?
where person is a bean in your value stack
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With