Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems with jsp:useBean

 
Rafael Afonso
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello:
In a JSP Page I created one bean as String and I defined its value of the following form:

When I go to open the page, appear the following message of the Tomcat:

javax.servlet.ServletException: bean stringSearch not found within scope

Analyzing .java generated from my JSP I observed the following one I break up of code:

This means that a value to bean was not atribuited. What I am doing wrong? The fact of String to be a final class and not to exist something as String.setValue() influences?
Grateful,
 
Mark Howard
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rafael
Chewed on this one for a while, until I noticed that you only specify type in your bean declaration. Type can not be specified on its own if the bean has not been instantiated yet. You must add either class or beanName as well.
Once instantiated, any further useBean declarations for the same bean variable, using only type, should work ok.
Hope this helps
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic