0

I am developing a jsf web application, i want to call a method from the managed bean through normal href url. My question is i am sending an email with the application link like

http://192.168.1.10/app/password.xhtml

I have appended some parameters like

http://192.168.1.10/app/password.xhtml?no=DBzMMeIE7SY=

I need to get the request parameter "no" as "DBzMMeIE7SY=" and the method of managed bean class PasswordBean.java with change() method should be called where i can  get the parameters through request. I have given the initialize method also init method it is not called.

I need the parameter value through managed bean method when the url loads in the browser, can anyone help me to proceed with it.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Manoj Kumar
  • 29
  • 1
  • 2
  • 6

1 Answers1

0

There is example how to get request parameter in managed bean.

Bean implementation:

@ManagedBean
@ViewScoped
public class PasswordBean {

private String no;


    public void init() {
        if (!FacesContext.getCurrentInstance().isPostback()) {
            if (!StringUtils.isEmpty(no)) {
                // do some actions
            }
        }
    }}

And inside password.xhtml:

    <f:metadata>
        <f:viewParam name="no" value="#{passwordBean.no}" />
        <f:event type="preRenderView" listener="#{passwordBean.init}" />
    </f:metadata>
sQer
  • 1,136
  • 8
  • 9