
how to convert jspcode into servlet code usig which method plz tell me.

JSPs are automatically converted to servlets before the container runs them.
Suppose there is jsp code 'myjsp.jsp'
< html > < body > Welcome to Roseindia Technologies < / body > < / html >
This JSP file has to be placed in the ?\apache-tomcat-6.0.16\webapps\examples\jsp folder in the system. To access this JSP through the tomcat server,use the below URL:
http://localhost:8080/examples/jsp/myjsp.jsp.
When you hit enter after typing the contents above in the browsers address bar, tomcat covnerts this JSP into a servlet, compiles it and then invokes it.
The servlet that gets created will be placed in ?\apache-tomcat-6.0.16\work\localhost\examples\jsp as myjsp_jsp.java.
The contents of this converted Servlet would be as below:
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;
public class myjsp_jsp extends HttpJspBase {
static {
}
public myjsp_jsp( ) {
}
private static boolean _jspx_inited = false;
public final void _jspx_init()
throws org.apache.jasper.runtime.JspException {
}
public void _jspService(HttpServletRequest request,
HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
String _value = null;
try {
if (_jspx_inited == false) {
synchronized (this) {
if (_jspx_inited == false) {
_jspx_init();
_jspx_inited = true;
}
}
}
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html;charset=" +
"ISO-8859-1");
pageContext = _jspxFactory.getPageContext(this,
request, response, "",
true, 8192, true);
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
out.write(">
\r\n< html >\r\n< body >"+
"\r\nWelcome to Roseindia Technologies"+
"\r\n\r\n\r\n");
// end
} catch (Throwable t) {
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (pageContext != null)
pageContext.handlePageException(t);
} finally {
if (_jspxFactory != null)
jspxFactory.releasePageContext(pageContext);
}
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.