java - WebSphere & Struts2, not going to welcome file -
all,
i have searched , researched , cannot find missing migrating existing project tomcat 7.x websphere 8.0. have created work around problem curiosity getting better of me because don't understand why. problem when first loaded project websphere getting there no action mapped namespace [/] , action name [] associated context path. researched , found couple of things try. added
com.ibm.ws.webcontainer.removetrailingservletpathslash=true com.ibm.ws.webcontainer.mapfilterstoasterisk=true com.ibm.ws.webcontainer.invokefilterscompatibility=true with no avail , added empty action redirected welcome page , well. however, view work-around , not fix. so, guess question why not fall through welcome file list? have missed in setting up/transferring project? misunderstanding how filters work?
i've included below struts2 workaround, web.xml , file structure. guys can with.
jf
web.xml snippit
<filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter</filter-class> </filter> <filter-mapping> <filter-name>securitycontextfilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> struts.xml snippit
<package name="dst" extends="struts-default" namespace="/"> <!-- added workaround problem --> <action name=""> <result>/index.jsp</result> </action> </package> file structure being used
web ----web-inf --------jsp (folder holding jsps) --------lib (extra jars being used) --------web.xml ----index.jsp edit
as per request
index.jsp
<%@ page language="java" import="java.util.*" %> <%@ include file="/web-inf/jsp/include/taglib.jsp" %> <!doctype html public "-//w3c//dtd html 4.01 transitional//en"> <html> <head> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> </head> <body> <div> test page</div> </body> </html>
i ran same thing after following struts2 tutorials, couldn't figure out why wasn't returning index.jsp file listed under <welcome-file-list>.
i figured out problem in our web.xml file.
<filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter</filter-class> </filter> <filter-mapping> <filter-name>securitycontextfilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> the filter-mapping's <url-pattern>/*</url-pattern> saying requests including default blank request should filtered struts2. why index.jsp file or of welcome-files ever returned.
if edit/delete filter-mapping , run again, load welcome files.
it seems misunderstanding of how filter apply root directory.
Comments
Post a Comment