This week's book giveaway is in the Artificial Intelligence forum.
We're giving away four copies of Pragmatic AI and have Noah Gift on-line!
See this thread for details.
Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

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: 9511
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: 9511
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!