You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Mitchell, Steven" <St...@umb.com> on 2009/06/02 22:15:05 UTC

Adding Struts 2.1.6 on WAS 6.1 breaks welcome-file in web.xml

Having learned that form-based authentication currently does not
currently work with Struts 2.1.x on WAS 6.1 or WAS 7 I stepped back to
see what does work. I gutted my web.xml and struts.xml and set about
turning things on one at a time.  This is what I found:

	1. Basic hello world app with only a welcome-file worked.
	2. Adding Spring 2 listener and Sitemesh filter worked.
	3. Adding Struts2 dispatcher breaks the welcome-file!?? 

With Struts 2 enabled, I observed the following:

	Typing http://servername/context/ results in "Error 404: There
is no Action mapped for namespace / and action name ." 
	Typing http://servername/context/index.jsp results is display of
the JSP fully decorated by Sitemesh (that should have been displayed
above).
	Typing http://servername/context/hello (or hello.action)
displays the hello world JSP fully decorated by Sitemesh.
	Typing http://servername/context/helloWorld (or
helloWorld.action) displays the hello world JSP fully decorated by
Sitemesh.

We have com.ibm.ws.webcontainer.invokefilterscompatibility = true.
Attached are my gutted web.xml and struts.xml contents (slightly
obfuscated). 

Why does adding the Struts2 filters break the welcome-file from web.xml?


<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
	version="2.4">
	<display-name>My GUTTED Application</display-name>	
	<context-param>
	
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
		<param-value>ApplicationResources</param-value>
	</context-param>    
    <filter>
        <filter-name>struts2-prepare</filter-name>
        <filter-class>
 
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-clas
s>
    </filter>   
    <filter>
        <filter-name>sitemesh</filter-name>
 
<filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter
-class>
    </filter>    
    <filter>
        <filter-name>struts2-execute</filter-name>
        <filter-class>
 
org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</filter-clas
s>
    </filter>
    <filter-mapping>
        <filter-name>struts2-prepare</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>    
    <filter-mapping>
        <filter-name>sitemesh</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>    
    <filter-mapping>
        <filter-name>struts2-execute</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>  
	<welcome-file-list>
		<welcome-file>index.jsp</welcome-file>
	</welcome-file-list>
	<listener>
	
<listener-class>org.springframework.web.context.ContextLoaderListener</l
istener-class>
	</listener>
</web-app>

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
    "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts> 
     <package name="base" extends="struts-default" >  
	    <action name="hello"   >
	            <result>/helloworld.jsp</result>
	    </action>
          <action name="helloWorld"
class="com.mypackage.action.HelloWorldAction" >
                <result name="success" type="dispatcher"
>/helloworld.jsp</result>
        </action>
    </package>
</struts>

NOTE: I tested with and without a package namespace of "/". 


Steven C. Mitchell
Byteworks, Inc. <http://www.ByteworksInc.com> 
	


------------------------------------------------------------------------------
NOTICE:  This electronic mail message and any attached files are confidential.  The information is exclusively for the use of the individual or entity intended as the recipient.  If you are not the intended recipient, any use, copying, printing, reviewing, retention, disclosure, distribution or forwarding of the message or any attached file is not authorized and is strictly prohibited.  If you have received this electronic mail message in error, please advise the sender by reply electronic mail immediately and permanently delete the original transmission, any attachments and any copies of this message from your computer system. Thank you.

==============================================================================


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org