Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error in Struts

 
amit bhadre
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am doin g project , in that I created LoginAction, ActionBean which has setter and getter meothods, one login page,one success page. Also has Struts-congig.xml,web.xml which is default created using workbench eclipse IDE....

Ths success.jsp has table wich retrieves data from DB. Which running smoothly.Mean no exception for DB connection.

The process is going like this...


login.jsp->LoginAction.java+BussinessLogic.java -->>success.jsp




The BussinessLogic.java has ArrayList productList var type....and LoginAction.java has alos has one ArrayList....?


the error was could not found productList in any scope. Can U tel me what may be tha cause...please any body....



If U r getting what I am telling can any body tel me how get the values from Data Base to form page through struts. Show me Simple application...or any page...

if replies thanks advance....


cheers
amit bhadre

[ March 15, 2006: Message edited by: amit bhadre ]
[ March 15, 2006: Message edited by: amit bhadre ]
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ActionForm bean should have a property (e.g. productList) that represents the list of products. Your BusinessLogic class should retrieve the data from the database using JDBC, create the list of products, and place it in the ActionForm bean using the setProductList() method. Then, in your JSP, you should be able to display the productList using either JSTL <c:forEach> or the Struts <logic:iterate> tag.

If you don't understand how to access data using JDBC, I'd suggest googling "JDBC tutorial" to understand how JDBC works.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic