aspose file tools*
The moose likes Servlets and the fly likes how to call servlet class from an action class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "how to call servlet class from an action class?" Watch "how to call servlet class from an action class?" New topic
Author

how to call servlet class from an action class?

Ankit Gandhi
Greenhorn

Joined: Nov 03, 2006
Posts: 27
hi,

i want to call a method defined in a servlet class which extends HttpServlet inside the doView() method of an action class which extengs Generic Portlet.
we can''t create the object of that servlet class in action class and call its method.
please help

TIA
Manisha
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Don't.

Servlets are not meant for this.
Instead, move your method to a bean or a plain old Java object (POJO) that can instanciated and have its methods called from any Java class; servlet or otherwise.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ankit Gandhi
Greenhorn

Joined: Nov 03, 2006
Posts: 27
Actully problem is that i want to use getKookies() (C replaced with K) in the doView() method of an action class.

And since doView() method can take only two arguments RenderRequest and RenderResponse and with their objects we can�t use the getKookies()(C replaced with K) method.
getKookies() (C replaced with K)gives the error if we call it with the object of RenderRequest because it is undefined for the type RenderRequest. and getKookies() ((C replaced with K) is defined for HttpServletRequest.
Please tell me with which object I can call the getKookies() (C replaced with K)method?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to call servlet class from an action class?