0

The following code is giving error as:

There is no Action mapped for namespace / and action name .

code: .jsp file:

<a href="<s:url action='DisconnectAction' />">Disconnect</a> 

struts.xml

<action name="DisconnectAction" class="ActionPackages.DisconnectAction">
    <result name="success">/JSP/mytemplate.jsp</result>
    <result name="input">/JSP/mytemplate.jsp</result>
    <result name="error">/JSP/mytemplate.jsp</result>
    <result name="failure">/JSP/mytemplate.jsp</result>
</action>

I want to perform action and keep the current accessing page only which is mytemplate.jsp

Roman C
  • 49,761
  • 33
  • 66
  • 176
pankaj
  • 81
  • 1
  • 2
  • 7

3 Answers3

0

According to your question the problem was in your <s:url/> tag you have to give action after DisconnectAction & it will work fine as you want.

<a href="<s:url action="DisconnectAction.action"/>">Disconnect</a>

Struts.xml

<action name="DisconnectAction" class="ActionPackages.DisconnectAction">
    <result name="success">/JSP/mytemplate.jsp</result>
    <result name="input">/JSP/mytemplate.jsp</result>
    <result name="error">/JSP/mytemplate.jsp</result>
    <result name="failure">/JSP/mytemplate.jsp</result>
</action>
Raki
  • 361
  • 2
  • 13
0

It seems that you have not given ".action " extension in struts tag. When you are using

<s:form action="someAction"></s:form>

you dont need to give .action extension to your action name. But since you are embedding it in HTML tag, you have to give .action Extension.

(Answer Verified on Live)

 <a href="<s:url action="urlTagAction.action" />"> Disconnect </a>
Aditya Ekbote
  • 1,493
  • 3
  • 15
  • 29
0

Though your question is not clear so better give details about the problem but if i read the subject you want to call action using so here is the struts2 standard way

<s:a cssClass="table_tabs_dis" href="%{GenURL}">General</s:a>

and here is one more

<a href="<s:url action=MyAction" namespace="/abc/xyz" />">ClickME</a>
Umesh Awasthi
  • 23,407
  • 37
  • 132
  • 204