displaying data from a single request object in struts2
Joined: Nov 14, 2008
Hi, Following are the bean class,jsp class and action class used in struts2. Problem is:-I am displaying data through a request object in jsp class <s roperty id="detail" value="#request['custinfo']" /> Through this tag,but it is fetching all the data in request object and displaying.
I have many fields such as customerBasicInfoVo.setPersBusinessInd("P"); customerBasicInfoVo.setNameLine1("PHILLIP W ROBINSON"); and so on��I want all PersBusinessInd to be displayed in different <td> in jsp and NameLine1 to be in different <td>. I am not able to do that because everything is in single request object.
� Is there any way to iterate the values I am entering in the string buffer�I used list also but again the problem is same all data is being displayed in single <td> only
Please use UBB code to format your code (and disable smilies).
Your property tag is <s:property value="#request['custinfo']"/>, so it'll display the entire object. Use OGNL to get a specific property of the 'custinfo' object: #request['custinfo'].firstName or whatever.
That said, this is non-canonical Struts 2. Normally objects to be displayed in the JSP would be an action property with a public getter, so in the JSP you could use either of the following:
Dave [ November 17, 2008: Message edited by: David Newton ]