• Post Reply Bookmark Topic Watch Topic
  • New Topic

Setting hidden field attributes through custom viewhandler  RSS feed

Ranadhir Nag
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We add a hidden field to the view through a custom Viewhandler.

public UIViewRoot createView(FacesContext context, String viewName) {
Application application=context.getApplication();
UIViewRoot viewRoot = baseViewHandler.createView(context, viewName);
UIComponent component = application.createComponent(HtmlInputHidden.COMPONENT_TYPE);
if (component == null) {
String msg = "No component class registered for 'type' " ;
throw new IllegalArgumentException(msg);
HtmlInputHidden hidden=(HtmlInputHidden)component;


return viewRoot;

Although fields gets displayed in the html;but it does not pick up the set attributes.
The resulting HTML is thus:
<input type="hidden" name="_id0" value="_id0" />

Why are the id and value attributes not getting picked up?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!