How can I print error stack trace in JSP page?

get the parameter from request that is set internally and use it to print and deal with other information like cause, message <c:set var=”exception” value=”${requestScope[‘javax.servlet.error.exception’]}”/> and to print stacktrace <!– Stack trace –> <jsp:scriptlet> exception.printStackTrace(new; </jsp:scriptlet> See Also JSPIntro4 – Handling Errors

Can not find the tag library descriptor of springframework

I know it’s an old question, but the tag library is provided by spring-webmvc package. With Maven it can be added to the project with the following lines to be added in the pom.xml <properties> <spring.version>3.0.6.RELEASE</spring.version> </properties> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${spring.version}</version> </dependency> Without Maven, just add that jar to your classpath. In any … Read more

how to get the base url from jsp request object?

So, you want the base URL? You can get it in a servlet as follows: String url = request.getRequestURL().toString(); String baseURL = url.substring(0, url.length() – request.getRequestURI().length()) + request.getContextPath() + “/”; // … Or in a JSP, as <base>, with little help of JSTL: <%@taglib prefix=”c” uri=”” %> <%@taglib prefix=”fn” uri=”” %> <c:set var=”req” value=”${pageContext.request}” /> … Read more

Get request URL in JSP which is forwarded by Servlet

If you use RequestDispatcher.forward() to route the request from controller to the view, then request URI is exposed as a request attribute named javax.servlet.forward.request_uri. So, you can use request.getAttribute(“javax.servlet.forward.request_uri”) or ${requestScope[‘javax.servlet.forward.request_uri’]}

I can pass a variable from a JSP scriptlet to JSTL but not from JSTL to a JSP scriptlet without an error

Scripts are raw java embedded in the page code, and if you declare variables in your scripts, then they become local variables embedded in the page. In contrast, JSTL works entirely with scoped attributes, either at page, request or session scope. You need to rework your scriptlet to fish test out as an attribute: <c:set … Read more