There is no action mapped for Namespace/and action name wildcard problem

Source: Internet
Author: User

Have seen some struts2 videos before.

Now review the next struts2. Found this problem

Most of the solutions on the web don't mention this, and 1% of the articles mention the new version of the method in struts.

There is no Action mapped for Namespace/and action name XXX

Http://localhost:8080/Struts2Learn/loginAction_login.action

The reason is unknown.

Workaround:

The use of the wildcard * method.

The method attribute is not required in the configuration of action in Struts.xml under the struts-2.5.10.1 version

Struts.xml

1<?xml version= "1.0" encoding= "UTF-8"?>2 3<!DOCTYPE Struts4Public "-//apache software foundation//dtd Struts Configuration 2.5//en"5"Http://struts.apache.org/dtds/struts-2.5.dtd" >6<struts>7< PackageName= "User" namespace= "/"extends= "Struts-default" >8<action name= "Loginaction_*"class= "Com.learn.LoginAction"Method={1}><!--do not need method={1}-->9<result name= "Success" >/loginSuccess.jsp</result>Ten<result name= "fail" >/loginFail.jsp</result> One</action> A</ Package> -</struts>
Com.learn.LoginAction

1  PackageCom.learn;2 3 ImportCom.opensymphony.xwork2.ActionSupport;4 5  Public classLoginactionextendsActionsupport {6 7     Private Static Final LongSerialversionuid = 1L;8     PrivateString username;9     PrivateString password;Ten  One      PublicString GetUserName () { A         returnusername; -     } -  the      Public voidSetusername (String username) { -          This. Username =username; -     } -  +      PublicString GetPassword () { -         returnpassword; +     } A  at      Public voidSetPassword (String password) { -          This. Password =password; -     } -      PublicString Loginn ()throwsException { -SYSTEM.OUT.PRINTLN ("Login ()"); -         return"Success"; in  -     } to  +}

Access connection

Http://localhost:8080/Struts2Learn/loginAction_loginn.action

There is no action mapped for Namespace/and action name wildcard problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.