How to translate code bewteen JSP to Servlet?
- JSP
scriptlet
(i.e., <% scriptlet %>) andexperssion
(i.e., <%= expression%>), when translated into a servlet, will end up in the body ofdoGet
ordoPost
method. - JSP
declaration
(i.e., <%! declaration %>), when translated into a servlet, will end up being instance variables or methods in the servlet class. - A variable defined inside of a JSP declaration could translate to an instance variable and a variable defined inside of a JSP scriptlet could translate to a local variable in
doGet
ordoPost
method. - You may have
jspInit()
orjspDestroy()
methods defined in the JSP declaration. They are equivalent to Servlet'sinit()
anddestory()
methods.
Most Recent jsp Faqs
- How to get the real requested URI from inside the error page?
- Can I define a method in a JSP page?
- What is the difference between request.getParameter() and request.getAttribute()?
- What is difference between page and pageContext in JSP pages?
- How to config a JSP file in web.xml?
- What is the difference between jsp:forward and response.sendRedirect?
- How to retrieve values from HTML form input elements in JSP?
Most Viewed jsp Faqs
- How to config a JSP file in web.xml?
- How to retrieve values from HTML form input elements in JSP?
- What is difference between page and pageContext in JSP pages?
- How to use comments in JSP pages?
- What is the difference between request.getParameter() and request.getAttribute()?
- How to disable browser caching for a specific JSP?
- How to display all the session variables in an HTML page?