File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes struts2 doubt regarding result name= Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts2 doubt regarding result name="input"" Watch "struts2 doubt regarding result name="input"" New topic
Author

struts2 doubt regarding result name="input"

Dilip Mallik
Ranch Hand

Joined: Sep 19, 2008
Posts: 40
Hi All,

I am using struts2 2.0.6 ,

I want to know that when the result="input" is matched.

I have an Index.jsp page there I have a link to Login.jsp

when I click on login link Login page appears now after filling the login page and clicking on submit button my LoginAction class is called and returns success on successful validation else returns error.

so my doubt is in the struts.xml why we add
Please clarify my doubt and If any thing else is required to make my question clear then Please tell me.

Thanks
Dilip
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I'm not sure what you're asking.

The "input" result is the default result returned by the framework when there is a validation error.
Dilip Mallik
Ranch Hand

Joined: Sep 19, 2008
Posts: 40
Thanks David,
I got it that if there is an error then the framework returns result="input" by default

<action name="doLogin" class="net.roseindia.Login">
<result name="input">/pages/login.jsp</result>
<result name="error">/pages/login.jsp</result>
<result>/pages/loginsuccess.jsp</result>
</action>

Now David
in the above mapping of result if the action class returns "error then the framework will map the result with name="error" so why there is a result name="input" and when this will be matched by framework
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I already told you: "input" is returned by the framework on validation errors.

If you're not using the validation framework, and no action methods return "input", then I have no idea why you'd define an "input" result--only whoever put it in there can answer that.
Dilip Mallik
Ranch Hand

Joined: Sep 19, 2008
Posts: 40
Thanks David

I am learning struts2 and I found the example from a site but the tags were not explained that why they are there . Thats why I asked,

Anyway thanks a lot for answering so soon
 
jQuery in Action, 2nd edition
 
subject: struts2 doubt regarding result name="input"