aspose file tools*
The moose likes Struts and the fly likes how to display data from database on jsp using struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to display data from database on jsp using struts2" Watch "how to display data from database on jsp using struts2" New topic
Author

how to display data from database on jsp using struts2

priyanka jaiswal
Greenhorn

Joined: Apr 27, 2011
Posts: 2
This is My class where database connection and other databasequery gets executed....


this is my action class............for student










next is ma jsp page where i want to display d data .....



i m not getting any error but nuthing is getting displayed on my jsp page.....

hey can anybody please help me out with this problem.


Thanks in advance

priyanka jaiswal.

Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8713
    
    6

I added code tags to your post to make it easier to read. Please UseCodeTags in the future.
I see your JSP references an action property named "list" but you don't have a method to get the list from your action class.
Your action class is confusing as it appears to be both a data object (containing attributes for each student instance) and an action method (execute).


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
priyanka jaiswal
Greenhorn

Joined: Apr 27, 2011
Posts: 2
Thanks for respose...
yes i have written action method in same class....bt when i created a diffrent actionclass there wasnt ny diffrence..the result was same....

actully i am very new to the technology not even worked on sturts1 ..so didnt have any idea....
and about the list ...i am not getting..where shuld i create a method nw.i reffered many examples.it was same as it is....jst can you help me out where i am getting wrong.
Really stucked with particular part of code ...

Thanks
priyanka jaiswal
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8713
    
    6

Are you new to Java as well (it looks like it)? You should start off with the Java Tutorial. It will be very difficult to write a web application in Java without understanding the basics of the language.
If you are new to web programming, you should read over the Struts Key Technologies. Again, without a basic understanding what is going underneath the covers, you will very easily lose your way.
After getting a good foundation, try reading through the pointers on our Struts 2 FAQ. There are many good tutorials and references available for Struts 2. We would love to help you, but if you haven't completed Step 1 and want to jump to Step 10, you will be setting yourself up for a lot of frustration and failure.
NOTE: Struts 2 has little to do with Struts 1, so it is not necessary to know one before learning the other.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to display data from database on jsp using struts2
 
Similar Threads
how to display database values in a table
javax.servlet.jsp.JspException: Cannot find bean under name jobtitleList
Problem in retrieving List from class and displaying it in JSP in struts2
I need to set <s:property> value in the action class
Retrieving database values inside the <s:select> tag