Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Variable declaration in Struts2

Tags:

java

struts2

How to declare a variable and assign value to that variable in Struts2?

like image 870
Lohit Avatar asked Dec 16 '22 16:12

Lohit


1 Answers

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

like image 200
robsf Avatar answered Dec 29 '22 04:12

robsf