• 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

JSP servlet bean bad communication

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I'm new to servlets and JSP,
I've deployed into Tomcat 5.5 a servlets that creates a java object (I tried with String) and pass it to a JSP page using request.setAttribute(...) method...

where dispatch method is:


In the JSP I've:


After deploying Tomcat get this error:



I've been tried to change scope attribute from "request" to "session" without any change...



 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried your code in my own environment and it worked perfectly.

How are you initiating the request? Are you sure that the servlet is being invoked?

Your error is indicative that the JSP may be being invoked without the servlet.
 
Antonino Lo Bue
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've developed the servlet for use of Jess (Rule-engine) to import an ontology (from JessTab/Protege) and apply to this some inference rules...
the String is only for debug....because is much simpler than passing other bean...


Here is code:


BaseServlet class:
_____________


**********************
HyperContainer servlet class:
______________________


**************
hyperContainer.jsp :
______________



[ February 08, 2007: Message edited by: Antonino Lo Bue ]
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
None of that answers my question. What URL are you using on the request?
 
Antonino Lo Bue
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know what you mean by "what URL".... I've the servlets deployed into Tomcat..
this is my web.xml conf file:

 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Antonino Lo Bue:
I don't know what you mean by "what URL"....



The URL that is being used to initiate the request.
 
Antonino Lo Bue
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've this index html:



http://localhost:8005/servletHyperJessGen/hyperContainer.jsp
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Aha!

http://localhost:8005/servletHyperJessGen/hyperContainer.jsp

This directly addresses the JSP without the benefit of your controller being called in order to set up the scoped variable.

You need to use the appropriate URL to invoke your controller, not the JSP.
[ February 09, 2007: Message edited by: Bear Bibeault ]
 
Antonino Lo Bue
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok... but what is the appropriate URL???
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Think about it for a few minutes. You are setting up a servlet that creates a scoped variable and places it on the request. It then forwards to a JSP that expects to find that scoped variable.

But, you are directly addressing the JSP, hence cutting the servlet completely out of the picture. Naturally, the JSP complains. It's sort of like skipping ahead on an assembly line and wondering why all the parts you need aren't there.

Your URL needs to address the servlet, not the JSP.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hint, from your deployment descriptor:

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic