Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners how to convert jspcode into servlet code usig which method
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Dangeti Ramprasad
how to convert jspcode into servlet code usig which method
1 Answer(s)      2 years and 8 months ago
Posted in : Java Beginners


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


Advertisement
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:
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
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
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 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 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
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
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... initialize an array using following code: //initialization String Arrays
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
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 String to Date?
How to Convert String to Date?  Hi, I am new in Java and learning the Date manipulation in Java. I have to write a program in Java which converts... have to convert it to Date object. Tell me How to Convert String to Date? Thanks
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
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
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
Java Code to GUI   can any one convert My code to GUI code
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 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
How to convert a String to an int?
How to convert a String to an int?  I my program I am taking... format. Now I want to convert into int value. Tell me How to convert a String... contains the value 1025, then you can use the following code to convert the String
sir, how to convert excel file to csv file using java? please send me sample code.
sir, how to convert excel file to csv file using java? please send me sample code.  please send me sample code for converting excel file into csv file uisng java
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
How to convert NSString to NSInteger?
How to convert NSString to NSInteger?  Hi, Provide me code to convert NSString into NSInteger. Thanks   Hi, Use the following code example: NSString * s= @"100"; NSInteger i = [s intValue]; Thanks
How to convert into to String in Java?
How to convert into to String in Java?  Hi, How to convert into to String in Java? Thanks
 

 

 

DMCA.com