How to get the original request url from a servlet/jsp after multiple servlet forwards

I found a better answer in this post [ How do you detect the URL in a Java Servlet when forwarding to JSP? ] On the target JSP use: request.getAttribute(“javax.servlet.forward.request_uri”) To find out what the original URL was. It doesn’t require you to take any extra steps on the forwarding servlet

Where are compiled JSP Java (*__jsp.java) files?

The compiled JSP files are by default available in the /work folder of the Tomcat environment. There should be a subfolder Catalina which in turn has a subfolder representing the domain name which defaults to localhost. There in turn should be the project folder which in turn contains package hierarchy org.apache.jsp with therein the compiled … Read more

How can I set the welcome page to a struts action?

Personally, I’d keep the same setup you have now, but change the redirect for a forward. That avoids sending a header back to the client and having them make another request. So, in particular, I’d replace the <% response.sendRedirect(“/myproject/MyAction.action”); %> in index.jsp with <jsp:forward page=”/MyAction.action” /> The other effect of this change is that the … Read more

Java Component based vs Request based frameworks

They were most likely looking for examples of web frameworks – for example, JSF is a component-based framework, and Struts is a request-based framework. Request-based frameworks generally make it clear through their APIs that they’re working with parsing an HTML request / generating an HTML response, while Component-based frameworks attempt to abstract this away and … Read more

$null check in velocity

To check if a variable is not null simply use #if ($variable) #if ($variable) … do stuff here if the variable is not null #end If you need to do stuff if the variable is null simply negate the test #if (!$variable) … do stuff here if the variable is null #end

tech