File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Clear Forms Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Clear Forms " Watch "Clear Forms " New topic
Author

Clear Forms

gokul subramanian
Greenhorn

Joined: Apr 06, 2010
Posts: 8
How to clear values after submit without using javascript
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Depends. I'm assuming you have a session form bean, in Struts 1 (but I have no way of knowing because you didn't TellTheDetails). If that's the case, you can just set the form values to their defaults in the action. Or just don't use a session bean.
gokul subramanian
Greenhorn

Joined: Apr 06, 2010
Posts: 8
i am using struts2 and i found that to initialize the fields load prepare interceptors is to be used. But when i trying this it always printing the null value
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Without further information it's impossible to help.
gokul subramanian
Greenhorn

Joined: Apr 06, 2010
Posts: 8
is it possible that after executing the action then prepare interceptor is to be executed..? if it is possible.

thanks in advance
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

*After* executing the action? That would make no sense: prepare() prepares the action to be executed.

It'd be easier if you just posted the code and explained the problem better.
gokul subramanian
Greenhorn

Joined: Apr 06, 2010
Posts: 8
i have used interceptors as follows


<action name="xx" method="xx" class="xx">
<result name="xx">/xx.jsp</result>
<interceptors-ref="prepare"/>
</action
and implemented the prepare in action as follows
public class xx extends ActionSupport implements Preparable {

public void prepare(){


}

public String xx() throws Exception {

return "xx";

}

}

thanks
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I understand how the interceptor and preparable works. I'm asking what you're actually trying to *do*, because it makes no sense to want to call an action method after the action runs--after the action runs and the response is returned the action no longer exists: they're instantiated per-request.

What are you actually trying to do?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Clear Forms