Mahmoud Saleh
Mahmoud Saleh

Reputation: 33605

Redirect with parameters in PrettyFaces

i have mapping like this:

@URLMapping(id = "edituser", pattern = "/edituser/#{ id: userBean.userId}", viewId = "/faces/pages/users/editUser.xhtml")

and i want to redirect to it from an action method, so i tried the following:

return "pretty:edituser/" + userObj.getId();

but it didn't work, it reloads current page, please advise, thanks.

Upvotes: 3

Views: 2513

Answers (1)

chkal
chkal

Reputation: 5668

In your case something like this should work:

return "/faces/pages/users/editUser.xhtml?faces-redirect=true&id=" + userObj.getId();

Another option would be to obtain the UserBean, set the id property and then return pretty:editust. Something like this:

public class Whatever {

  @Inject
  private UserBean userBean;

  public String action() {

    // do something

    userBean.setUserUd( someId );
    return "pretty:edituser";

  }

}

Upvotes: 2

Related Questions