3

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.

Mahmoud Saleh
  • 33,303
  • 119
  • 337
  • 498

1 Answers1

2

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";

  }

}
chkal
  • 5,598
  • 21
  • 26