Hi,
I am a struts newbie and am exploring struts2 for a website rewrite.
I don't want the user to know whether or not they are accessing an
action - and I don't want to expose the .action suffix in the url.
examples:
http://www.junitfactory.com/demo
- needs to go via DemoAction to /demo/index.jsp
http://www.junitfactory.com/faq
- will go straight to /faq/index.html
I came up with a way to do it.
My web.xml looks like this:
<display-name>JUnit Factory</display-name>
<filter>
<filter-name>struts</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>main.action</welcome-file>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
It looks like tomcat won't use main.action unless a file main.action
exists in the directory.
Most of the pages don't require an action and will just fall through to
index.html or index.jsp. For the pages that do require an action, I'll
create a main.action in the directory and an entry in struts.xml:
<package name="demo" extends="struts-default" namespace="/demo">
<action name="main" class="demo.DemoAction">
<result>/demo/main.jsp</result>
</action>
</package>
It seems to work in a simple example but, before I go too far, am I
missing something that is obviously stupid? Is there a better way to do
this?
Thanks,
Kevin
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]