Can anybody tell how to assign a value coming from \"
into jsp variable ?
you can use the following to get the value in to variable,
For example there is a string avalue,
String avalue="";
Now you can assign a property value to it by using,
<s:property value="a"/>
avalue=request.getAttribute("a");
above will gives the property value to a string variable. otherwise u can set the value and then assign it through getAttribute.
The struts property tag generates output not input. If you want to do something else with the value that s:property
would output, the equivalent code would be getA()
, which is what s:property
will use to get the value that it will print.
https://cwiki.apache.org/WW/property.html
You can use the s:set tag for this.
For example this will call getA() from your action and put the value into "avalue", don't use name instead of var
<s:set var="avalue" value="a" />
And then you can reference it like so on the JSP:
<b>Print value defined in set tag :</b> <s:property value="#avalue" /> <br/>
Which will print out the value.
As Tim mentioned, <s:property value="a"/>
is equivalent to calling the action's getA()
method. You can get this using the JSP EL as ${action.a}
.
If you need to evaluate an OGNL expression and store that in an EL variable, you would probably need a custom tag.