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

dispatchMethod in DispatchAction

san geetha
Ranch Hand

Joined: Sep 07, 2004
Posts: 44
Scenario:
To implement pagination i have an action class that extends the DispatchAction. Have also declared the parameter attribute in the config.xml
At runtime i want to set the method to be called in the action class. Say sthg like, either first, prev, next, last... anything can be clicked, depending upon what is being clicked the respective method in the action class should be called.
I dont want to do this in javascript... is there any other way?
while going thru the API i saw the dispatchMethod()... wud that help?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
San,

In order to do this, you simply create a new java class that extends DispatchAction and has methods named prev(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception .. another named next with the same signature, another named first, etc.

Then in your html code, you would create a link such as:


The action will call a method named for whatever value you put in the parameter "method".

For further information, see the documentation:

http://struts.apache.org/api/org/apache/struts/actions/DispatchAction.html

Merrill


Merrill
Consultant, Sima Solutions
san geetha
Ranch Hand

Joined: Sep 07, 2004
Posts: 44
Merrill,
Thats what iam doing now. but i dont want to pass it in a querystring.
Any other way.
san geetha
Ranch Hand

Joined: Sep 07, 2004
Posts: 44
Any idea about the dispatchMethod?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: dispatchMethod in DispatchAction