I want to assign the value from field Description to a hidden field test. But the problem is the "Description" contains sequence of words and the following code is assigning only first word to "test"
<s:hidden value=<s:property value="Description" /> name="test">
I am kind of new to struts. Can someone please help. Also it would be nice if i get to know good tutorial links of struts2.
If this is a property in your action class you need not to use <s:property value="Description" />
as the Description
will be available at the top of value stack and you can use OGNL to fetch the value from value-stack.This is what you need to do
<s:hidden value="%{description}" name="test" />
Please make sure the value
in hidden filed should be similar to the name of property in your action class as it will be resolved to either the getter and setter in your action class or the public property defined in your action.
So this means value="%{description}"
will be converted by OGNL like getDescription()
and will try to find the getter in your action class to fetch the property value.
<s:hidden value="%{description}" name="test" />
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