• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can we override JspServiece() ? if not why?

 
bhavya raj
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Every One !!!111

is jspserviece() iverloaded or not ? if not explain clearly.
who will take care about class file generation, recompialtion of servlet for jsp s

Thanks in Advice
 
swarupa patil
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Bhavya
Yees,we can override the _jspservice method.For overridding the
jspService method , we have extends the currend Jsp page with our
own class .This class must be extended by org.apache.jasper.runtime.HttpJspBase for Tomcat version, for Othe server you have to check the class.
Insert the following code in ur JSP Page
<%@ page extends="name of ur class"%>

And write class as follows
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.HttpJspBase;


//public class OwnJSp implements HttpJspPage
public class OwnJSp extends org.apache.jasper.runtime.HttpJspBase
{


public void _jspService(javax.servlet.http.HttpServletRequest request,javax.servlet.http.HttpServletResponse response)throws javax.servlet.ServletException,java.io.IOException

and provide the implementation for _jspService method which cna handle
HTTp methods
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!