All request parameters are in EL available by the #{param}
map. Thus, this should do:
<p>Username: #{param.txtUsername}</p>
<p>Password: #{param.txtPassword}</p>
If you need to preprocess them by Java code, better put them as managed properties or view parameters in the backing bean class associated with login.xhtml
.
Managed property example:
@ManagedBean
@RequestScoped
public class Login {
@ManagedProperty("#{param.txtUsername}")
private String username;
@ManagedProperty("#{param.txtPassword}")
private String password;
@PostConstruct
public void init() {
// Do here your thing with those parameters.
System.out.println(username + ", " + password);
}
// ...
}
View parameter example:
<f:metadata>
<f:viewParam name="txtUsername" value="#{login.username}" required="true" />
<f:viewParam name="txtPassword" value="#{login.password}" required="true" />
<f:event type="preRenderView" listener="#{login.init}" />
</f:metadata>
with
@ManagedBean
@RequestScoped
public class Login {
private String username;
private String password;
public void init() {
// Do here your thing with those parameters.
System.out.println(username + ", " + password);
}
// ...
}
See also: