| Author |
_jspService methiod calarification
|
vineet walia
Ranch Hand
Joined: Feb 16, 2008
Posts: 137
|
|
Code Source is scwcd study guide
why this out object is not available in _jspService. it is showing cnt resolve
|
 |
Frits Walraven
Rancher
Joined: Apr 07, 2010
Posts: 706
|
|
Hi Vineet,
You can override the jspInit() and jspDestroy() methods in a jsp, but you can't override the _jspService() method.
JSP.11.1.1.1 Protocol Seen by the JSP Page Author
....
In JSP 2.0 this is done by defining methods with the names jspInit and jspDestroy in a
declaration scripting element in the JSP page. The jspInit method, if present, will
be called to prepare the page before the first request is delivered. Similarly a JSP
container can reclaim resources used by a JSP page when a request is not being
serviced by the JSP page by invoking its jspDestroy method, if present.
A JSP page author may not (re)define servlet methods through a declaration
scripting element.
Regards,
Frits
|
 |
Abimaran Kugathasan
Ranch Hand
Joined: Nov 04, 2009
Posts: 2066
|
|
vineet walia wrote:
why this out object is not available in _jspService. it is showing cnt resolve
How do you know that, the problem with out implicit object?
|
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
|
 |
vineet walia
Ranch Hand
Joined: Feb 16, 2008
Posts: 137
|
|
eclipse is showing that error ....
for me it is showing only... cnt resolve this object
|
 |
Abimaran Kugathasan
Ranch Hand
Joined: Nov 04, 2009
Posts: 2066
|
|
vineet walia wrote:eclipse is showing that error ....
for me it is showing only... cnt resolve this object
As Frits indicated, you can't override _jspService() method.
|
 |
vineet walia
Ranch Hand
Joined: Feb 16, 2008
Posts: 137
|
|
|
yes i go it
|
 |
Abimaran Kugathasan
Ranch Hand
Joined: Nov 04, 2009
Posts: 2066
|
|
vineet walia wrote:yes i go it
So, is it the problem? Let's know it! Thanks!
|
 |
Darryl Smith
Greenhorn
Joined: Aug 06, 2010
Posts: 5
|
|
You should not be overriding the _jspService method - The real problem.
Your problem is out is not declared. Why that happens is that when the JSP page is translated the JSP translator creates a _jspService method and then it starts initializing some of the implicit objects. One of the objects it instantiates is out.
Here is a snippet from the java file created by Tomcat 5.5
Have a look at line 10 and 22.
|
 |
Seetharaman Venkatasamy
Bartender
Joined: Jan 28, 2008
Posts: 4057
|
|
Darryl Smith is right! all the implicit objects are available with in service method of jsp. in other word, you can use implicit object only with <% %> and <%= %>.
and it is not possible with declaration(<%! %>)
As a side note: these scriptlets are obsolete.
|
fall down seven times, get up eight times-bodhidharman
|
 |
 |
|
|
subject: _jspService methiod calarification
|
|
|