Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can we append 2 strings in Struts

I need to append 2 String class variables using Struts 2

I tried like this

<s:set var="Name" value="#variable1+#variable2"/>

but no result.

like image 890
hKs Avatar asked Oct 28 '25 15:10

hKs


2 Answers

Use OGNL to force evaluation of concatenation operation

<s:set var="Name" value="%{#variable1 + #variable2}"/>
like image 73
Roman C Avatar answered Oct 31 '25 06:10

Roman C


it is also working.

<s:set var="Name" value="#variable1+''+#variable2"/>
like image 42
hari Avatar answered Oct 31 '25 06:10

hari