File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes why resutl name='input' dose not work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "why resutl name= Watch "why resutl name= New topic

why resutl name='input' dose not work

heng zhang

Joined: Jul 12, 2010
Posts: 16
Hi I have a simple action. the configuration is below

when i enter the URL in the browser: http://localhost:8080/DonorRegistration/donor/dr.action

it directly went to the thank you page, which is result name='success'.
to my understanding, the input page should show up first.

do I do something wrong?

Ankit Garg

Joined: Aug 03, 2008
Posts: 9465

Did you return input mapping from your action?? Input page will be shown in cases when some input is missing (or validation fails). Like if your action is expecting a name and password and if you invoke your action without it, then the input page will be shown (if you've applied validations)...

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
heng zhang

Joined: Jul 12, 2010
Posts: 16
i am a little confused about the behavior of this code:
<result name="input">/jsp/donor-signup.jsp</result>

donor-signup.jsp is the input form of the action class DonorRegistration.
so when i enter:

first , perpare method is invoked. then donor-signup.jsp shows up
then i fill up the form and hit submit, execute method of DonorRegistion is involked.
then thank you page shows up.

i thought <result name="input"> defines the first input page of the action,which shows up before the execute method returns.

in my action, it returns success.

my understanding to <result name="input"> is right?

heng zhang

Joined: Jul 12, 2010
Posts: 16
ok! fixed.

if you want to get the behavior i want, you need implement validation for that action by either creating a xml file or implementing validate method.
I agree. Here's the link:
subject: why resutl name='input' dose not work
It's not a secret anymore!