What does this expression language ${pageContext.request.contextPath} exactly do in JSP EL?

The pageContext is an implicit object available in JSPs. The EL documentation says The context for the JSP page. Provides access to various objects including:servletContext: …session: …request: …response: … Thus this expression will get the current HttpServletRequest object and get the context path for the current request and append /JSPAddress.jsp to it to create a … Read more

WebServlet cannot be resolved to a type

Try adding servlet-api.jar instead of servelt-api-3.0 jar.Stop the server. Refresh the project and then start the server and see. I think it should work. Make sure you are adding the servlet-api.jar from tomcat lib folder. Suppose your tomcat is in C:\Tomcat\lib. In eclipse right click your project-properties-javabuildpath-add external jars and then select the servlet-api.jar from … Read more

Using if-else in JSP

It’s almost always advisable to not use scriptlets in your JSP. They’re considered bad form. Instead, try using JSTL (JSP Standard Tag Library) combined with EL (Expression Language) to run the conditional logic you’re trying to do. As an added benefit, JSTL also includes other important features like looping. Instead of: Use: Also, unless you plan on using response.jsp … Read more