Question

I want to do something like this:

<a href"page1/login.action"> Link </a>
<a href"page2/login.action"> Link </a>
<a href"pagen/login.action"> Link </a>

Then every subfolder will use the same login, then I can create dynamic subfolder

How I have to configure struts.xml? This doesn't work

<package name="default" extends="struts-default" namespace="/*/">
  <action name="login" class="package/myclass">
  ...
</package>

Any idea?

Was it helpful?

Solution 2

Finally I do:

<package name="default" extends="struts-default" namespace="/">
  <action name="login" class="package/myclass" method="initCampusList" >
    <result name="success" >/user/pickUser.jsp</result>

I have to put the absolute url of the result Thanks for the answers

OTHER TIPS

We cannot use wildcards in namespace. But u can use wild cards for action mappings.

Use struts url tag in jsp and use wildcards in the action names in struts.xml. see the reference http://struts.apache.org/2.2.3/docs/wildcard-mappings.html

<a href='<s:url name="page1/login.action" namespace="/">'> Link </a>
<a href='<s:url name="page2/login.action" namespace="/">'> Link </a>

Hope this will help you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top