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?

有帮助吗?

解决方案 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

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top