File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts2 doubt regarding result name="input"

 
Dilip Mallik
Ranch Hand
Posts: 40
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 40
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 40
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic