<h:inputText id="username" value="#{mylogin.username}" required="true" />
, . , ? , harto , , ( ) .
<h:inputText id="username" value="some_value" required="true" />
, . ExternalContext API- bean :
FacesContext facesContext = FacesContext
.getCurrentInstance();
ExternalContext extContext = facesContext
.getExternalContext();
Map<String, String> params = extContext
.getRequestParameterMap();
But, aside from violating the model-view-presenter contract, you can run into some practical problems. The parameter key may not be "username", but might be something like "j_id_jsp_115874224_691:username", depending on whether you make the component a child of any NamingContainer(like UIForm - see the prependId attribute) or if the view is namespaced. Hard-coding this value anywhere is probably a bad idea. You can read about the relationship between JSF component IDs and rendered HTML IDs here. If you want to use UIComponent.getClientId to generate the the key, you are back to component binding because you need to get a reference to the component.
- bean..?
. ExternalContext.getSessionMap.