• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

How to display data from database to JSP Page in Struts2

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to Struts and want to display the Registration ID which is generating automatically by the mysql to my success page when user submits the form, please guide me how to achieve it...

My Action...



I TRIED BY THE METHOD HIGHLIGHTED IN BOLD:

I want to display the OnlineID which is generated on my JSP page, but it is showing OnlineID as 0.

My JSP:




Please help........
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
New to Java? I see a couple of problems in your code. First, you declare an instance scope variable:

Then you pass it to a class method, which is totally unnecessary, because it is already accessible:

Then you create a new, but very similarly named variable in the method (Bad Idea!):

and you set the value for the local variable, but you do not set the value for the instance variable:


You also do not need to use OGNL syntax on your JSP tag (the percent sign and brackets). The JSP tag will take the property name itself as an argument:


 
Ranch Hand
Posts: 96
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi..
Can anyone please direct me to some tutorial that teaches me how to use database in a struts2 application? Searching the net, I found information in bits and pieces, but nothing comprehensive which teaches the stuff (without assuming that the reader knows the basics of how to do it).
Thanks in advance for the help...
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic