aspose file tools*
The moose likes Struts and the fly likes Links on the page and Actions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Links on the page and Actions" Watch "Links on the page and Actions" New topic
Author

Links on the page and Actions

Dilip kumar
Ranch Hand

Joined: Oct 16, 2000
Posts: 360
Hello All -

Here is my application flow :

Category Selection Screen (action=submitCagetoryForm.do) takes to Parameter Selection Screen

Parameter Selection Screen (action=submitParameterSelectionForm.do) takes to
Report screen

In Report screen I need to have links to
- Category Selection Screen
- Parameter Selection Screen

Do I need to create 2 separate actions in struts-config.xml to handle these 2 links ?

Really appreciate any suggestions.

Thanks
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
It is generally a good idea to create a separate action that simply displays a page. For example, you really can't use the action submitCagetoryForm to display the ParameterSelection JSP because that action is expecting to process input from another form.

While it is possible to simply create a link to the JSP itself, it's not considered best practice. Best practice is to hide all of your JSPs behind an action. Besides, usually there is some type of processing necessary before displaying a page such as pre-populating values or filling options in drop-down boxes.

If there is no processing needed to display a page, you can use a "forward action mapping". This type of action mapping doesn't use an Action class, but just forwards to the JSP. Example:

<action name="myForm" path="/myForwardAction" forward="/myPage.jsp" />


Merrill
Consultant, Sima Solutions
Dilip kumar
Ranch Hand

Joined: Oct 16, 2000
Posts: 360
I tried to call the .do from HREF and it looks like the app didn't like it.

(a href='/APP/LinkToReportSelection.do')

I'm getting error message

type : Status report

message : Invalid path /LinkToReportSelection was requested

description : The request sent by the client was syntactically incorrect (Invalid path /LinkToReportSelection was requested).

I really appreciate any suggestions.

Thanks
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The most likely explanation for this is a spelling error.

Please show us the action mapping for this action in your struts-config.xml file. Also, is /APP the context root for your application?
Dilip kumar
Ranch Hand

Joined: Oct 16, 2000
Posts: 360
You are right. I found the mistake.
Thanks much.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Links on the page and Actions