0

I'm working on Spring MVC with richfaces. Is there a way to call a method in a managed bean Controller from URL?

e.g: website.com/somecontroller/somemethod?x=1

I tried @RequestMapping but didn't work.

Thanks in advance

Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332
Sara
  • 71
  • 1
  • 13

1 Answers1

1

When the browser client want to access to an URL, the managed beans declared in the page will be created, the constructor and @PostConstruct methods will be invoked server side.

You can recover the parameters using @ManagedProperty as proposed by BalusC (as he says, the JSF-ish way):

If that answer doesn't fit for your needs, you can recover the request object and get the parameters one by one, as stated in the question:

HttpServletRequest request = (HttpServletRequest)FacesContext.
    getCurrentInstance().getExternalContext().getRequest();
String clipId = request.getParameter("x");
Community
  • 1
  • 1
Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332