Re: JSF forced page refresh
- From: "Danno" <dh.evolutionnext@xxxxxxxxx>
- Date: 16 Jun 2006 12:02:41 -0700
BlackIce wrote:
Danno wrote:
BlackIce wrote:
Danno wrote:
BlackIce wrote:But how is that going to force the page to create a new view with no
I am trying to force a JSF page to refresh all of its components so
that they will all be empty instead of the original values. I am
trying to come from another page using a JSF hyperlink to reach the
destination page, and when the destination page is reached it should be
cleared of all previous values. Any help would be appreciated.
Thanks
Create a "creator bean" that clear itsself when you are done submitting
public class AccountBean {
private Account account;
public AccountBean() {
account = new Account();
}
//setters and getters
public void submit() {
//persist to DB
account = new Account();
}
}
values?
It reflects the backend bean. So there will be no values after you
submit....
Take a look at the submit method I sent.
A little more detail and explanation would be helpful. Thanks.
public class AccountBean {
private Account account;
public AccountBean() {
account = new Account();
}
//setters and getters
public void submit() {
//persist to DB
account = new Account(); //create a new account after
submit
}
}
Well, taking a look at this bean notice the account = new Account()
line in the submit method. That means that after an account is created
via the submit method the bean will hold a blank new account which will
hold no information whatsoever. When you visit the page all the
information will be blank. Another strategy is to remove that
line...
public class AccountBean {
private Account account;
public AccountBean() {
account = new Account();
}
//setters and getters
public void submit() {
//persist to DB
//account = new Account(); //this line is removed
}
}
and just make sure that the AccountBean is of request scope and you
will get the same functionality.
.
- Follow-Ups:
- Re: JSF forced page refresh
- From: BlackIce
- Re: JSF forced page refresh
- References:
- JSF forced page refresh
- From: BlackIce
- Re: JSF forced page refresh
- From: Danno
- Re: JSF forced page refresh
- From: BlackIce
- Re: JSF forced page refresh
- From: Danno
- Re: JSF forced page refresh
- From: BlackIce
- JSF forced page refresh
- Prev by Date: Problem using dynamic variable as HashMap key
- Next by Date: Re: running unix script from java app
- Previous by thread: Re: JSF forced page refresh
- Next by thread: Re: JSF forced page refresh
- Index(es):
Relevant Pages
|