myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Torrefranca <storrefra...@branders.com>
Subject Re: setting default value for input field?
Date Mon, 12 Mar 2007 16:36:07 GMT
I am also a JSF newbie but I think for default values you can try 
managed property

In you faces-config.xml you do something like

  <managed-bean>
    <managed-bean-name>theBackingBean</managed-bean-name>
    <managed-bean-class>
    com.whatever.com.TheBackingBean</managed-bean-class>
    <managed-bean-scope>
    session</managed-bean-scope>
      <managed-property>
          <property-name>theProperty</property-name>
          <value>theDefaultvalue</value>
      </managed-property>
  </managed-bean>




David Delbecq wrote:
> Hello,
>
> I need to design a form in JSF where there are various default value for
> various fields.
> However, the default value is separated from the backing bean (it's
> something to display in initial form). I am not sure how to do this, i
> don't see in h:inputHidden anything that relate to a default value.
>
> I need to convert this struts form:
>
>
>         <html:hidden property="scope" value="${param.searchScope}"/>
>         <html:hidden property="requestedNodeResults" value="15"/>
>         <html:text property="query" styleClass="search"/>
> to a JSF form, but i don't know where to put the '15' and
> 'param.searchScope' in JSf
>
> setting <h:inputHidden value="#{theForm.requestedNodeResults}"/> does
> not set the default value to 15.
>
> Any suggestion to set default value? Do i have to do
> <h:inputHidden
> value="#{theForm.requestedNodeResults}">15</h:inputHidden> or something
> like that? Can't find documentation on setting default form values...
>
> Help appreciated.
>
>
>   


Mime
View raw message