1

Whenever my web application starts, I need to provide the welcome or index or first file inside the <welcome-file-list>.

There after, I am able to post requests to the struts engine using actions in <s:form> or in <s:a> I want to load the index page or the first page of my web application through Struts 2 i.e. the initial request itself should pass through the engine, and the response should come from the engine only, is it possible?

Roman C
  • 49,761
  • 33
  • 66
  • 176
Udit Mishra
  • 150
  • 11

1 Answers1

1

If you are using Struts tags inside JSP page, either it welcome file listed or not it should be a dispatcher result of an action. Welcome file list files could be handled by the web container if you navigate to the folder of your web content hierarchy and there's a welcome file inside it, and there's no action mapped to that URL. In this case you cannot use struts tags inside the welcome file because you are trying to run it without associated filter, or the struts2 filter is already handled another request.

See the examples of Hello World application or Hello World using Struts2 that would show you how to create action configuration that utilize an index action or use actionless results using Convention Hello World example.

Roman C
  • 49,761
  • 33
  • 66
  • 176
  • I saw that example, but there I need to provide the URL as [link](http://localhost:8080/tutorial/HelloWorld.action) which I do not want, suppose this application is developed for naive client who is oblivious of actions atall, he just wants some page to get loaded when he hits the URL, say [link](http://www.example.com/) – Udit Mishra Jun 20 '14 at 10:19
  • You can use default action `""` but without welcome files or try [this](http://stackoverflow.com/a/12090172/573032) solution. – Roman C Jun 20 '14 at 16:00