Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't jspService() be overridden?

Why can't the jspService() method be overridden, where as jspInit() and jspDestroy() can be overridden?

like image 664
gmhk Avatar asked Feb 18 '10 12:02

gmhk


People also ask

Why we Cannot override _jspService method?

Why ? Since what ever we wrote code in the JSP will be placed in _jspService() of generated servlet class(from JSP) . means _jspService() is already imlimented by us.So if we attempted to override _jspService() it will give a compilation error regarding the method _jspService() is already defined.

Which method Cannot be overridden in a JSP page?

_jspService() method is used to serve the raised requests by JSP. It takes request and response objects as parameters. This method cannot be overridden.


1 Answers

This forum post explains why you cannot override jspService().

Basically, if you tried to override the jspService method, the code generated by the JSP compiler would end up with two copies of the method: the one you wrote and the one created by the compiler. This would result in a Java compilation error.

like image 166
Stephen C Avatar answered Sep 20 '22 21:09

Stephen C