How can we append 2 strings in Struts

心已入冬 提交于 2021-02-07 21:50:52

问题


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.


回答1:


Use OGNL to force evaluation of concatenation operation

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



回答2:


it is also working.

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


来源:https://stackoverflow.com/questions/23789198/how-can-we-append-2-strings-in-struts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!