aspose file tools*
The moose likes Struts and the fly likes nested:write Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "nested:write" Watch "nested:write" New topic
Author

nested:write

Giomar Guevara
Ranch Hand

Joined: Oct 18, 2006
Posts: 51
I use a nested:write tag to write the value of a property.What I need to do is just show part of this value...

name: John Smith

<nested write property="name"/>

For instance, instead of showing: "John Smith",just show "John..."

is there a way to do this with this tag? I think there is no such a thing as a size attribute...

thanks...
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The place to manipulate bean properties is in the bean itself, not in the JSP. So, for example, if you need only the first name, create a getter on the JavaBean named getFirstName() that does whatever manipulation of the name property you need to do. Then in your JSP, simply put:


Merrill
Consultant, Sima Solutions
Giomar Guevara
Ranch Hand

Joined: Oct 18, 2006
Posts: 51
ok but in those cases the presentation layer is not in charge of that,meaning the JSP? you're not supposed to do changes for presentation in another layer...
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
A JavaBean used by the presentation layer is often referred to as a Transfer Object (TO) or sometimes a Data Transfer Object(DTO). The purpose of this type of object is to act as means of transferring data between the view and the model. Even though technically it's part of the model, it has to be used by both the model and the view. It is inescapable that it must present the data in a format that is acceptable to the view. Putting logic in this type of object to present data in a certain way is a commonly accepted practice, and is far preferable to muddying up your JSP with scriptlets to perform the same function.
Giomar Guevara
Ranch Hand

Joined: Oct 18, 2006
Posts: 51
ok,thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: nested:write