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