This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Struts and the fly likes Displaying Database Items in Index page Using Struts Hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Displaying Database Items in Index page Using Struts Hibernate" Watch "Displaying Database Items in Index page Using Struts Hibernate" New topic
Author

Displaying Database Items in Index page Using Struts Hibernate

Shajid Johnny
Ranch Hand

Joined: May 15, 2010
Posts: 34
Hello Dear members,
I have been trying to build an application using Struts2 and Hibernate3 for Data Access layer. I have successfully done the modules for Add/Edit/Delete of Category and SubCategory with proper HQL, Taglibs, JSTL etc.

Now I want to show all my added Categories and SubCategories on the index.jsp when the project runs. But I can't use struts actions, can't invoke the DAO methods through which I properly displayed them previously.

So, for the index.jsp i used core Servlet & JDBC to display them.

My question is- does the frameworks have some limitations like this? or its really doable and its me who doesn't know??
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8935
    
    9

Struts isn't magic. It is built out of core Java and Servlets, so theoretically, anything that is possible with a Servlet is possible with Struts.
Is the problem that you can't have the Struts action as the welcome page? I solved that by making an index.html redirect immediately to a Struts action.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Shajid Johnny
Ranch Hand

Joined: May 15, 2010
Posts: 34
Joe Ess wrote:Struts isn't magic. It is built out of core Java and Servlets, so theoretically, anything that is possible with a Servlet is possible with Struts.
Is the problem that you can't have the Struts action as the welcome page? I solved that by making an index.html redirect immediately to a Struts action.


Thanks Joe. But could you please show me how could i do this? it would be better if you write some code snippet here for me
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8935
    
    9

Sure it's easy for you if I do your work. We ask that you ShowSomeEffort. How about doing a search and let us know what you find.
Shajid Johnny
Ranch Hand

Joined: May 15, 2010
Posts: 34
Thanks Mr Joe for your guidance! yes I shall keep that in mind :-)
 
Don't get me started about those stupid light bulbs.
 
subject: Displaying Database Items in Index page Using Struts Hibernate