• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts 1.3 how to send data from database to the jsp page!

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone, and sorry if it isn't the right zone to explain my problem.

I need to see database informations in the jsp but i don't know how.
(i 'm not allowed to use java code on the jsp)

For example after the login action i want to see the message welcome "user" in the other pages, where user is his name saved in the db.
Now in my ActionClass i m calling a method

User user = daoFactory.userDAO().checkLogin(loginform.getUserName(), loginform.getPassword(),connection);

and it 'll return a object user with all the information i need.


Then in my jsp :

<jsp:useBean id="Mrbean"
class="it.tbr.action.LoginAction" />

welcome<jsp:getProperty name="Mrbean" property="name" />

where
name=request.getParameter(user.getFirstName()); (in the ActionClass)

but in my jsp i got a null name.

i miss something but i don t know where.
can someone help me?
thanks
 
Ranch Hand
Posts: 84
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch...

Consider action class as bean will not work in this case. Please try below code snippets.

In action class,



In JSP,



Hope this will help.
 
When evil is afoot and you don't have any arms you gotta be hip and do the legwork, but always kick some ... tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic