Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using servlets with java beans

 
Giselle Dazzi
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Do you know how I can call beans methods from a servlet.
I mean, Im trying to find out how to do a


from inside a servlet instead of a jsp page.
I tried instantiating the bean class and then calling the get method I want but since it's a new instance, I dont see the content it has been set by the session.
Thx in advance,
 
cyril vidal
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Giselle,
The best way to see how you may call a javabean from a serlvet is to check the code of the servlet generated by your JSP page.
I'm sure you know that at translation time, JSP pages are converted into servlets..
So just cut and paste..
Regards,
Cyril
 
Tim Baker
Ranch Hand
Posts: 541
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and if you don't know if your using tomcat look in tomcat/work
 
Giselle Dazzi
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thx, I got it, here's the code I used:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic