You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Allistair Crossley <Al...@QAS.com> on 2005/05/05 17:53:17 UTC

Action mapping order and using wildcards

Hi,

My scenarion is that I need all URLs into our domain to route to the struts controller. Furthermore, we do not want to add new action mappings when we come up with new pages. Our "pages" are actually database driven by the inbound URL, e.g

http://www.domain.com/this/is/a/page
http://www.domain.com/so/is/this

When we add new "pages" in the database, we want those immediately available on the site without new action mappings, without restarts and so fourth.

My plan is as follows. My web.xml drills through everything with 

<servlet-mapping>
  <servlet-name>controller</servlet-name>
  <url-pattern>/*</url-pattern>
</servlet-mapping>

Then in the struts-config a wildcard will allow us to capture everything
	
<action path="/**" 
    type="com.qas.newmedia.internet.core.page.action.PageAction" />

In the action we can then call getPath and we have the path the user used to tie-up with the database to get our page.

Great.

The problem seems to be that now that I want to add a more specific action mapping, e.g

<action path="/view" forward="/jsp/views/view.jsp" />

the request http://www.domain.com/view is being picked up by the /** wildcard action mapping even though it appears in struts-config before the wildcard.

My question therefore is, do struts-config action mappings not get loaded for matching in order of appearance? and if not, any tips on how to get around this problem?

Thanks, Allistair.


<FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE> 
-------------------------------------------------------
QAS Ltd.
Developers of QuickAddress Software
<a href="http://www.qas.com">www.qas.com</a>
Registered in England: No 2582055
Registered in Australia: No 082 851 474
-------------------------------------------------------
</FONT>


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