Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Clear Forms

 
gokul subramanian
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to clear values after submit without using javascript
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Without further information it's impossible to help.
 
gokul subramanian
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
*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
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic