Reputation: 154
JSP page in its lifecycle translated into .java file, but is JSP page itself a java class?
Confused and need help.
Upvotes: 3
Views: 800
Reputation: 1161
A JSP pages compiler is a program that parses JSPs, and transforms them into executable Java Servlets and that java Servlets is a simple java class.
Upvotes: 0
Reputation: 4207
The intend behind JSP is Actually makes easier for JAVA developer + front end Developer to write not only Java code also need to write HTML code and other which is easily stuff with html code too for full fill the task complete.
so, let's say, my jsp page is home.jsp
, then it's translating from .jsp to .java
by home_jsp.java
which will enclosed all non-java code
into java
.
and finally home_jsp.class
file generate which will run on JVM
.
JSP page life cycle and many of the capabilities of JSP pages (in particular the dynamic aspects) are determined by Java Servlet technology.
Now, i hope you are little bit clear on your query that was,
JSP page in its lifecycle translated into .java file, but is JSP page itself a java class?
Best of luck...!!!
Upvotes: 0
Reputation: 6077
From here:
A JavaServer Pages compiler is a program that parses JSPs, and transforms them into executable Java Servlets.
And from here:
Java Servlet technology provides Web developers with a simple, consistent mechanism for extending the functionality of a Web server and for accessing existing business systems. Servlets are server-side Java EE components that generate responses (typically HTML pages) to requests (typically HTTP requests) from clients. A servlet can almost be thought of as an applet that runs on the server side
Since applets are classes, hence, a JSP is a class.
Upvotes: 0
Reputation: 201457
JSPs are compiled into Java Servlets, and Java servlets are classes. So yes, the JSP is compiled to a Java class. The name is usually automatically generated, and is visible in any stack traces (if you throw an Exception
).
Upvotes: 3