Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

in which phase of JSP JSTL is evaluated?

Tags:

jsp

jstl

I know the life cycle of JSP page but i wondered when i started to use JSTL. My question is that in which phase of JSP life cycle this JSTL tags evaluates? for example in jsp translation phase or in service phase.

like image 297
Keyur Ardeshana Avatar asked Sep 29 '15 13:09

Keyur Ardeshana


People also ask

What is the use of JSTL tags in JSP?

JSTL stands for JSP Standard Tag Library. JSTL is the standard tag library that provides tags to control the JSP page behavior. JSTL tags can be used for iteration and control statements, internationalization, SQL etc.

What is JSP translation phase?

During the translation phase each type of data in a JSP page is treated differently. Static data is transformed into code that will emit the data into the response stream. JSP elements are treated as follows: Directives are used to control how the web container translates and executes the JSP page.

Which of the following tags are a part of JSTL?

The JSTL core tag provide variable support, URL management, flow control, etc. The URL for the core tag is http://java.sun.com/jsp/jstl/core. The prefix of core tag is c. The functions tags provide support for string manipulation and string length.


2 Answers

At translation phase

Custom tags are converted into calls to the tag handler that implements the custom tag.

When you execute that JSP (which happens after successful compilation(translation)), they actually run and render the output to response.

like image 57
Suresh Atta Avatar answered Sep 21 '22 22:09

Suresh Atta


JSTL is evaluated during JSP compilation (or translation) phase. You can check that by the stacktrace if an exception is thrown:

org.apache.jasper.JasperException: /index.jsp (line: 8, column: 23) No tag "urfafl" defined in tag library imported with prefix "c"
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:408)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:199)
org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1215)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1452)
org.apache.jasper.compiler.Parser.parse(Parser.java:138)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:242)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:102)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
like image 37
Aurasphere Avatar answered Sep 20 '22 22:09

Aurasphere