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



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

Have Programming Question? Ask it here!
 
 
 


Dangeti Ramprasad
how to convert jspcode into servlet code usig which method
1 Answer(s)      2 years and 4 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
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
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
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 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
Convert the code to GUI
Java Code to GUI   can any one convert My code to GUI code
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
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 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 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
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
Java code to convert pdf file to word file
Java code to convert pdf file to word file  How to convert pdf file to word file using Java
how to convert ACSII to HEX
how to convert ACSII to HEX  How to convert perticular ASCII... value of ~:00   The given code accepts the string and convert...() to convert it to Hex value. class ConvertAsciiToHex { public static void
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 code  GUI code
Convert the code to GUI
GUI Example  GUI Example code to learn
Convert the code to GUI
How to create GUI application in Java   How to create GUI application in Java
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 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
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 to convert entity character to html character
How to convert entity character to html character  Please help me to "convert entity character to html character" in java. If possible please provide source code which take String as input and return as String
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
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
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
how to convert jsp to exe
how to convert jsp to exe  hello sir, i am doing webapplication. the configuration is windows xp operating system,IE6.0,apache... to another system. so i want to convert this to exe. that will executed only internet
How to convert eclipse project to Maven
How to convert eclipse project to Maven  Hi, I have a Eclipse Project which is developed using Eclipse. Now I want to use the Maven to build the project. Let's know how to convert it to the Maven Project. Thanks
 

 

 

DMCA.com