• Post Reply Bookmark Topic Watch Topic
  • New Topic

Issue with default Action set to application Context  RSS feed

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have an issue redirecting to default action in struts 2.3.15.3.

I want to redirect to a welcome action when some one request the app.

locahost:8080/myapp should take me to locahost:8080/myapp/welcomeAction.do

I was using Struts 2.2.3 Version before.It was working with bellow code.

<action name="" >
<result type="redirectAction">
<param name="actionName">welcomeAction</param>
</result>
</action>


Any help will be appreciated.


 
Bartender
Posts: 9462
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jaya Sasindra Kanneganti wrote:
I was using Struts 2.2.3 Version before.It was working with bellow code



It sounds like you may have been exploiting a bug in the framework. The problem with welcome pages and struts is that the container config determines the welcome page(s) and it doesn't know anything about struts. Have a look at this discussion for some alternatives. Personally, I use the index.jsp and embedded forward solution.
 
Jaya Sasindra Kanneganti
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried adding welcomefile but it doesnt work either.

Here is my web.xml code:

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!--Parameter to define the ApplicationContext.xml location in the war file -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/classes/applicationContext.xml
</param-value>
</context-param>

<welcome-file-list>
<welcome-file>enrollWelcome.do</welcome-file>
</welcome-file-list>
 
Joe Ess
Bartender
Posts: 9462
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jaya Sasindra Kanneganti wrote:

<welcome-file-list>
<welcome-file>enrollWelcome.do</welcome-file>
</welcome-file-list>



Again, you can't make an action a welcome file as the container doesn't know how to serve a .do. See the link I gave you for the alternatives.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!