how to convert jspcode into servlet code usig which method

how to convert jspcode into servlet code usig which method

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

View Answers

May 7, 2012 at 1:53 PM

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);
}
}
}









Related Tutorials/Questions & Answers:
HOW TO CONVERT THIS CODE INTO GUI
HOW TO CONVERT THIS CODE INTO GUI   System.out.println("\n\t UGANDA CHRISTIAN UNIVERSITY\n"); System.out.println("\n\tFACULTY OF SCIENCE AND TECHNOLOGY\n"); System.out.println("\n BACHELOR OF SCIENCE IN COMPUTER
jspcode
want code if i came back to the previous page,the page will appear with previously selected values. please send the code   Dependent Dropdown: 1
Advertisements
How to convert this Java code into GUI?
How to convert this Java code into GUI?   import java.util.Scanner; public class StudentMarks { double totalMarks; String grade; public void setTotalMarks(double totalMarks) { this.totalMarks = totalMarks
How to found which class or method contain specific annotation?
How to found which class or method contain specific annotation?  ... and execute that method or class which ever is possible... like @One class A { } @Two class B { } @One class C { } How will I find
What is the equivalent method in Java which is equivalent to clrscr() in c/c++ . The code should help to clear the output screen ?
What is the equivalent method in Java which is equivalent to clrscr() in c/c++ . The code should help to clear the output screen ?  Hello to all, I have searched the net to know that is there any equivalent method for clrscr
how to convert a .xlsx to .xls fil - JSP-Servlet
how to convert a .xlsx to .xls fil  Dear sir, How to convert a .xlsx file to .xls using poi .Please give me some clue.... Thanks in advance
how to execute this code - JSP-Servlet
how to execute this code  hi guys can any help me in executing this bank application http://www.roseindia.net/jsp/bank.shtml, i need to use any database plz tell me step-to-step procedure for executing this,i need to create
Which method is more efficient?
Which method is more efficient?  I'm faced with initializing a bunch of text fields in java. The problem is that the number of text fields is quite... May be you can initialize an array using following code: //initialization
How to write jsp/servlet code to integrate LINKDIN?
How to write jsp/servlet code to integrate LINKDIN?  How integrate linkdin api's in java codding
How to get client's address in a servlet
How to get client's address in a servlet  ... client's address in a servlet. In this example we have used method getremoteAddr() of the ServletRequest interface which returns IP address of the client
How Code Resuablity easy in servlet - Servlet Interview Questions
How Code Resuablity easy in servlet  Hi friends am newbie to servlet. How code reusability easy in servlet. why not in jsp.here reusabillity means only javabeans or any thing else.  Hi, Servlet
how to convert war file into .exe file using java code
how to convert war file into .exe file using java code  hi,I am beginner in the java,I want to convert my java maven project to .exe file,plz tell me which is required jar files and how i convert this..?Thanks in advance
servlet code
servlet code  how to implement insert update n delete in one servlet in net beans   If you want to perform insert, update and delete functions in the same servlet, then please visit the following links: http
Servlet Init method
Servlet Init method  can we capture the form data into the init method of the servlet
ModuleNotFoundError: No module named 'usig-normalizador-amba'
: No module named 'usig-normalizador-amba' How to remove the ModuleNotFoundError: No module named 'usig-normalizador-amba' error? Thanks   Hi...ModuleNotFoundError: No module named 'usig-normalizador-amba'  Hi
ModuleNotFoundError: No module named 'usig-normalizador-amba'
: No module named 'usig-normalizador-amba' How to remove the ModuleNotFoundError: No module named 'usig-normalizador-amba' error? Thanks   Hi...ModuleNotFoundError: No module named 'usig-normalizador-amba'  Hi
ModuleNotFoundError: No module named 'usig-normalizador-amba-P32'
: No module named 'usig-normalizador-amba-P32' How to remove the ModuleNotFoundError: No module named 'usig-normalizador-amba-P32' error? Thanks...ModuleNotFoundError: No module named 'usig-normalizador-amba-P32'  Hi
convert jsp to servlet
convert jsp to servlet  how to convert following code into servlet int i=0; while(rs.next()) { %> <tr> <td> <input type="checkbox" name="check<%=i%>" value=<%= rs.getString("bookid
convert this code to GUI
convert this code to GUI  hello.. this is my code.. import... = grade;//"this" keyword refer to current instance of the method on which... = totalMarks; //"this" keyword refer to current instance of the method
convert this code to GUI
convert this code to GUI  hello.. this is my code.. import... = grade;//"this" keyword refer to current instance of the method on which... = totalMarks; //"this" keyword refer to current instance of the method
convert this code to GUI
convert this code to GUI  hello.. this is my code.. import... = grade;//"this" keyword refer to current instance of the method on which... = totalMarks; //"this" keyword refer to current instance of the method
convert this code to GUI
convert this code to GUI  import java.util.Scanner; public class... refer to current instance of the method on which it is use } public... instance of the method on which it is use } public String getGrade
convert this code to GUI
convert this code to GUI  import java.util.Scanner; public class... refer to current instance of the method on which it is use } public... instance of the method on which it is use } public String getGrade
convert this code to GUI
convert this code to GUI  import java.util.Scanner; public class... refer to current instance of the method on which it is use } public... instance of the method on which it is use } public String getGrade
convert this code to GUI
convert this code to GUI  import java.util.Scanner; public class... refer to current instance of the method on which it is use } public... instance of the method on which it is use } public String getGrade
convert this code to GUI
convert this code to GUI  import java.util.Scanner; public class... refer to current instance of the method on which it is use } public... instance of the method on which it is use } public String getGrade
convert this code to GUI
convert this code to GUI  import java.util.Scanner; public class... refer to current instance of the method on which it is use } public... instance of the method on which it is use } public String getGrade
convert this code to GUI
convert this code to GUI  import java.util.Scanner; public class... refer to current instance of the method on which it is use } public... instance of the method on which it is use } public String getGrade
Convert the code to GUI
How to Convert the code to GUI   How to convert a code into GUI
Convert the code to GUI
Convert the code   How to convert a code to GUI look alike
How to change the value of a variable which is set in jsp (by jstl method) by calling the function from js?
How to change the value of a variable which is set in jsp (by jstl method) by calling the function from js?  How to change the value of a variable which is set in jsp (by jstl method) by calling the function from js? I set
Convert the code to GUI
Is it possible to convert a code into GUI  Is it possible to convert a code into GUI
how to convert jsp page to class file - JSP-Servlet
how to convert jsp page to class file  hai. iam doing online banking project by using jsp.i completed all the jsp pages.next can you tell me how to convert these jsp pages to class files with example and where to copy these class
Convert the code to GUI
Java Code to GUI   can any one convert My code to GUI code
Servlet setAttribute & getAttribute method example
() method which will fetch the value set in the first servlet using setAttribute...Servlet setAttribute & getAttribute method example In this tutorial you will learn about how to use the setAttribute() & getAttribute() method
Convert the code to GUI
GUI code  GUI code
Convert the code to GUI
GUI Example  GUI Example code to learn
code - Servlet Interview Questions
code  servlet service method along with an example code  Hi Friend, Servlet service() method: Once the servlet starts getting the requests, the service() method is called by the servlet container to respond
Convert the code to GUI
How to create GUI application in Java   How to create GUI application in Java
Convert the code to GUI ??
Convert the code to GUI ??  hi >> can anyone help me to conver this code to GUI ?? /** * @(#)RegistorClass.java * *. * @author...("*** Invalid operation code ***"); halt= true; // break
Convert the code to GUI
Convert the code to GUI   can any one convert My code to GUI code...: System.out.println("*** Invalid operation code... ??? System.out.println(); } } `print("code sample");` thanks
convert this code to GUI
convert this code to GUI  import java.util.*; class Author{ public String name; public BookList<Book>books=new BookList<Book>(); public Author(){ } public boolean equals(Object node){ return name.equals
convert this code to GUI
convert this code to GUI  import java.util.*; class Author{ public String name; public BookList<Book>books=new BookList<Book>(); public Author(){ } public boolean equals(Object node){ return name.equals
Convert the code to GUI
GUI example for beginners  GUI example for beginners  sory ,, I will posted my code again import java.util.Scanner; public class...; default: System.out.println("*** Invalid operation code
servlet code - JSP-Servlet
servlet code  Create a servlet to develop a login application with javascript clientside validations and serverside validations
service method in servlet
service method in servlet In this tutorial you will learn about the service method in servlet that how can it be defined, how to get information from requests , and how the response can be constructed. service method is a method
servlet code - JSP-Servlet
servlet code  how to implement paging or pagination in java code using servlets.  Hi Friend, Try the following code: import java.io.... code, we have used following database table: CREATE TABLE `student
how to send email please give me details with code in jsp,servlet
how to send email please give me details with code in jsp,servlet  how to send email please give me details with code in jsp,servlet
Example for a method in java which returns a class
Example for a method in java which returns a class  Hi, I want to create a 1 class,and declare some methods there.I need to method must returns a classname.when i call that particular method(which returns a class),how can i
servlet code to update password?
servlet code to update password?  Create a servlet page which helps the user to update his password. The user should give the username,old password... users.then Store it into a table. please tell me the code for the above question

Ads