Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

setting a bean property from servlet and redirecting to jsp  RSS feed

 
Stacy Frank
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am in desperate need of some help! I have a simple jsp page that has a log in form, when I submit it goes to my login servlet. The login servlet accesses a database and verify's the login information. If the login is invalid I redirect back to the jsp page. I have a java bean (Member) in the session and I need to set the "status" to invalid. I then can use the <c:choose JSTL tags to print a message on the jsp page that the login is invalid. I understand how to print the message but how do I set this status in the bean to pull out on the jsp page? If I call Member.setStatus("invalid"); it tells me I can not access a non static method. Any insight about what I am missing is appreciated!

Thank you!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66142
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If Member is the class name, then the syntax Member.setStatus("invalid"); signifies a call to a static method of the member class. This is just basic Java.

If setStatus is not a static method, then an instance of a Member is required before you can call it.

How familiar are you with Java?
[ March 31, 2006: Message edited by: Bear Bibeault ]
 
Stacy Frank
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
apparently I overlooked that! Everything worked just fine as soon as I created a new instance of the bean. I knew I was overlooking something stupid!

thanks so much!
Stacy
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!