It's possible to use a welcome file list, you should configure it in web.xml
or web server default configuration file the files used as welcome files. When you access the web folder that contains this file the content of the the file will be loaded by web server regardless struts2 maps this folder or not as its action. Then in the welcome file you should place the code that redirect to the action. For example index.jsp
is welcome file
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
index.jsp
<% response.sendRedirect("showcase.action"); %>
Second question already discussed here, initializing the beans in the constructor is a bad idea, the constructor is used by the container to instantiate the action. At the moment when it's doing it you can't access some features or services because they are not available. Better do lazy initialization after the action is created and features are available, for example when the action is executed. If you want all actions to initialize before their execution than there's Preparable
interface which is by default implemented by ActionSupport
which you action should extend and override prepare
method.
It's your responsibility to initialize the objects. Other objects that are submitted could be created by OGNL to populate your collections.
You could use Log4j with struts2 but it requires configuration in the project and on the server. For debug purposes you could write to the System.out
which is redirected in the most IDEs to the console.
Really, I don't know what you are trying to do but normally return SUCCESS
if no errors are found, or ERROR
if there are errors.