Struts2: accessing action class getters in jsp without creating an object

I am working on struts2. In my action class, I have written some accessory (setter-getter). Now, let's assume that this action class returns SUCCESS in struts.xml as well. I open a jsp page (say abc.jsp) against the result "SUCCESS". I need the values ​​of all getter methods written in the action class without creating an object of the action class in my jsp (ie abc.jsp).

0


a source to share


1 answer


If your controller has a getPostalCode property, you can:

<s:textfield name="postalCode"/>

      



which will bind the value to the controller field. Outside the s: tags, you can also use jsp-el; the expression $ {postalCode} will do the same. Read this documentation

+1


a source







All Articles