Hi everybody!

I have a strange behavior while using Struts 2, s:form, and action with
wildcard. Can you please help me?

Here is my struts.xml file, with a wildcard mapping, very straightforward:

<action name="Authentification!*" method="{1}"
class="com.authentification.AuthentificationAction">
        <result>/jsp/login.jsp</result>
</action>

When I go to http://localhost:8080/Authentification.action, I got a "no
action found" error.


If I change struts.xml file like:
<action name="Authentification"
class="com.authentification.AuthentificationAction">
        <result>/jsp/login.jsp</result>
</action>

(I removed the wildcard mapping)
everything goes fine, the action is found.

It's surprising since I have another action with a wildcard:

<action name="Banner!*" method="{1}" class="banner.BannerAction">
        <result>/bannersAdministration.jsp</result>
</action>

and it works fine!


And here is the mysterious part:
when I have the struts xml version without the wildcard mapping, like:
<action name="Authentification"
class="com.authentification.AuthentificationAction">
        <result>/jsp/login.jsp</result>
</action>

and if I have the following in my jsp:
<s:form action="Authentification!displayQuestion" id="displayQuestionForm" >
        <s:hidden id="aliasFieldForQuestionForm" name="alias" value=""/>
</s:form>

everything work perfectly! It calls the action, and the displayQuestion
method (not the execute method), as if I put a wildcard mapping for this
action (but I did not, since the action is not found when I put one).

Isn't all of this very strange?

My action is:

public class AuthentificationAction extends ActionSupport {

        private AuthentificationService loginService = new
AuthentificationServiceWebServiceImpl();

        private String alias = "";
        private String question = "";
        
        public String execute() {
                return display();
        }
        public String display() {
                return SUCCESS;
        }
        public String displayQuestion() {
                
                question = loginService.getQuestion(alias);
                
                return display();
        }
        public String getAlias() {
                return alias;
        }
        public void setAlias(String alias) {
                this.alias = alias;
        }
        public String getQuestion() {
                return question;
        }
        public void setQuestion(String question) {
                this.question = question;
        }
}

Do you have an idea about that?

Thanks!
Cyril
-- 
View this message in context: 
http://www.nabble.com/-S2--Action-with-wildcard-not-found-and-strange-behavior-of-s%3Aform-tf3964495.html#a11251637
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to