3) store the default as a parameter on the converter an use a Tag or
TagHandler to build the converter instead of loading it by ID.

On Dec 26, 2007 2:01 PM, M Rather <[EMAIL PROTECTED]> wrote:
>
>  Andrew:
>
>  As for first suggestion:
>
>  1) Have the converter use a default value when there is no value
>  It is more like suggested default value for this form, it could be a
> different default in a different form. It is such in my case, where a
> content created from one link defaults to MENU_ITEM, and if content is
> created from another link it defaults to another value. So converter may not
> be a good place to set it, as the same converter will get used at both
> places.
>
>  as for the second suggestion:
>
>  2) Have the backing bean value never be null (always require that it is
> set)
>  I could set the defaults in the managed bean as 'usually' different forms
> will have separate 'managed beans' and defaults could be set there.. But,
> for this option there is a 'what if' question, what if I am using the same
> form+managed bean from different links which should result in defaults of
> different types? As I am writing this, just thinking out loud, it is
> possible that the different links send params to the managed bean with
> default values, and the managed bean sets it in 'add' action method before
> the form is drawn. But the 'what if' question still remains, what if I want
> a default value to be supplied from jsf for each form (if different forms
> are using the same managed bean, or Is that not a good idea?)? Is it not
> possible?
>
>  Thanks
>  MRather
>
>
>
>  Andrew Robinson wrote:
>  1) Have the converter use a default value when there is no value
> or
> 2) Have the backing bean value never be null (always require that it is set)
>
> On Dec 26, 2007 10:48 AM, M Rather <[EMAIL PROTECTED]> wrote:
>
>
>  Hello,
>
> I want a hidden input field with a default value put in JSF page. The
> value that the input field is tied to is of type 'ContentType' (object),
> so I use a converter to convert the string to the object as:
>
> <h:inputHidden value="#{contentForm.content.type}" id="type" >
>  <f:converter converterId="converters.ContentTypeConverter" />
>  </h:inputHidden>
>
> Since the inputHidden is bound to "contentForm.content.type" by virtue
> of me assigning it to the value attribute, and since the content.type by
> default is null, so the input is rendered as:
>
> <input id="contentForm:type" type="hidden" value=""
> name="contentForm:type"/>
>
> note: value="" I would like to have it defaulted to value="MENU_ITEM" as:
>
> <input id="contentForm:type" type="hidden" value="MENU_ITEM"
> name="contentForm:type"/>
>
> but, if I change the h:inputHidden to value="MENU_ITEM", I do get the
> desired input tag, but the value is not then assigned to content object
> upon submission.
>
> So, if I use value="contentForm.content.type", I do get proper linking
> with backing bean properties, but NO default value. and I if provide a
> text value like value="MENU_ITEM", I do get the proper default value,
> but I do NOT get the linking with backing bean. How can this be resolved?
>
> Thanks
> MRather
>
>
>
>
>

Reply via email to