Solved

How to pass a RecordSet or a List of JavaBeans from Action objects to JSPs in Struts?

Posted on 2007-11-16
3
436 Views
Last Modified: 2013-11-24
Hi folks,

New to Struts. Wanna to know how to pass a RecordSet object or a List of JavaBeans objects from Action objects to JSPs and then display records in the RecordSet or  beans in the javabeans one by one.

Thanks
0
Comment
Question by:tiger0516
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
boonleng earned 500 total points
ID: 20306876
You can either create an ActionForm to store the javabeans.
The following url show how to use action form.
http://www.roseindia.net/struts/strutsActionForms.shtml

Or directly set the beans into request in Action class.
Example:
Struts Action class
------------------------
  public ActionForward execute(..) throws Exception{
      List listofBeans = manager.getListofbeans(...); // retrieve list of beans from backend
      request.setAttribute("myresult", listofBeans);
      return mapping.findForward("success");
  }

JSP
------------------------
<logic:iterate id="row" name="myresult">
    <bean:write name="row" property="propertyNameInBean"/>.
</logic:iterate>
0
 
LVL 1

Author Comment

by:tiger0516
ID: 20306951
manager.getListofbeans

What's this?

Thanks
0
 
LVL 14

Expert Comment

by:boonleng
ID: 20307298
That is just an sample code.
you need to change it accordingly to retrieve the list of beans from your codes.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now