Maya Muchnik wrote:

> Hi,
>
> How make a link or JSP URL "invisible" to a browser? I have read some chapter
> in a book, I know that this is possible. Is it possible with Struts?  Is it
> some property "visible=true / false"?
>

Another Craig knew the JavaScript trick for this one :-).

>
> The second question is about "input" parameter in "Action Mapping" section of
> struts-config.xml. For example, struts-example has no "input" for "Edit user
> registration", but has "forward" for "success". On the other hand, "A walking
> tour of the example application"
> (http://localhost:8080/struts-example/tour.htm) has both (paragraph
> "CheckLoginTag.java":
>

I suspect this part of the walking tour was based on an older version of
the
example code.




> -------
>             <!-- Edit user registration -->
>             <action path="/editRegistration"
>             type="org.apache.struts.example.EditRegistrationAction"
>             name="registrationForm"
>             scope="request"
>             validate="false"
>             input="/registration.jsp">
>             <forward name="success" path="/registration.jsp"/>
>             </action>
> ------
> What is right?
>

The "official" version of the example (that is, the code that is
actually
executed when you run the example), does not have an "input" attribute
on the
"/editRegistration" action.  The reasoning is this:  the
"/editRegistration"
action is never used as the target of a form submit, so there is no
concept of
returning to an input form after a validation error.  This action is
invoked to
"set up" a new form bean before transferring to "registration.jsp" for
entry, so
there is no need for input processing before it is invoked.

One of the places that "/editRegistration.do" is referenced is on the
main menu
page -- it is the destination of the hyperlink for the "Edit your user
registration profile".  So, if we follow through on what happens when
you run the
app:
(1) Log on and go to the main menu.
(2) Click the hyperlink for "/editRegistration.do"
(3) This action sets up a form bean, populated from your current
    user information.
(4) This action returns a forward to the "success" page,
registration.jsp
(5) The registration page displays, accepts your input,
    and submits to the "/saveRegistration" action
(6) This action has an input form declared, so the validation occurs.
    If there are any errors, returns to (5) with the error messages
object
    created
(7) If there are no errors, the save registration action is called.

So, you should use an "input" attribute only on actions that actually
accept an
input form (and therefore might detect validation errors and need to
return).
Actions that don't do this do not need an "input" attribute.

>
> Maya

Craig

Reply via email to