jQuery in Action, 3rd edition
The moose likes Struts and the fly likes bean:write ??????? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "bean:write ???????" Watch "bean:write ???????" New topic

bean:write ???????

rahul karwal
Ranch Hand

Joined: Oct 26, 2001
Posts: 73
I have an ArrayList of objects (meaning i have refernce to the objects which is a Bean class say SearchBean), and i have the ArrayList in the request object, can i use bean :write to access the GetMethod of my SearchBean? here is the snippet of the code: -
request.setAttribute("searchResult",searchList); --- my ArrayList.

<logic:iterate id="currentUser" name="searchResult">
<%SearchBean search = (SearchBean)currentUser;%>
<tr >
<td><html:link page="" >Edit</html:link></td>
<td><html:link page="">Delete </html:link></td>
i want to replace the scriplet code with any of the Struts or JSP tags, is it possible, can anyone give me a small example how this can be done?

aziz dhanani.
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258

... or something close to that. I'm not sure how nested variables like currentUser are referenced. Check out the Struts website for documentation .. here's a start.

John Smith
Ranch Hand

Joined: Sep 02, 2004
Posts: 61
Instead of your dynamic cast use a bean efine on the variable exposed by the iterate tag, your bean:write tags will then be able to find the getter methods and such
Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

The JSTL equivalent requires no casting:
<c:forEach var="currentUser" items="searchResult">
<td><cut value="${currentUser.userName}"/></td>
<td><cut value="${currentUser.email}"/></td>

Just evangelizing.
[ December 10, 2004: Message edited by: Marc Peabody ]

A good workman is known by his tools.
rahul karwal
Ranch Hand

Joined: Oct 26, 2001
Posts: 73
thanks use the John Smith way and it worked.
aziz dhanani

heres what i did
<logic:iterate id="currentUser" name="searchResult" type="AdminSearchBean">
I agree. Here's the link: http://aspose.com/file-tools
subject: bean:write ???????
It's not a secret anymore!