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

How to Configure interface Preparable in Struts2..

Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

Hi friends...

i have a little question..

Do we have to implements Preparable?..
what conditions we have to use interface Preparable?..
How to setup the implements Preparable?..

Thank's in advance..


Sorry, perhaps my english language isn't too good.. Prepare for SCJP 6, Please God help me.. ☼
References : [Java.Boot] [JavaChamp] [JavaPrepare]
Mudit Srivastava
Ranch Hand

Joined: Apr 30, 2007
Posts: 38
Include the prepare interceptor in your interceptor stack or use the defaultStack which has a specific place for the prepare interceptor. Implement your action with the Preparable interface by defining a prepare() method. When the prepare interceptor executes, it looks for the prepare() method in your action which will allow for any sort of preprocessing to occur. .

Prepare Interceptor

Cheers

Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

Thanks @Mudit for your post reply..

in that URL explained that the Preparable Interface used to ensure some logic runs before the actual execute method runs.
i have Class DeleteAction..
in that class iam not implement Preparable..
the class shown like this..



is it the code good for implementation?..
or i have to use Preparable and declare category as private property with getter and setter?..


Thanks in advance..
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I'm not sure what that has to do with the original question, which was about implementing Preparable. If you don't have anything to prepare, there's really no reason to implement Preparable.
Mudit Srivastava
Ranch Hand

Joined: Apr 30, 2007
Posts: 38
Yeah I agree with David. For the code you've written, I don't see the need for the interceptor.
Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

Thanks in advance..

 
jQuery in Action, 2nd edition
 
subject: How to Configure interface Preparable in Struts2..