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?

Était-ce utile?

La 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

Autres conseils

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top