• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

custom component problem

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the jsp page that using my
custom component that I developed. The tag syntax try to follow Tree2 implementation of the Tomahawk project.

<rf:objectPanel numColumns="3" value="#{userData.users}" var="user" varSelector="s" >
<f:facet name="ICON1_TYPE">
<h:panelGroup id="pg1" >
<h:commandLink immediate="true" actionListener="#{s.setItemSelected}">
<h:graphicImage value="/user1Icon.jpg"/>
<h:outputText value="#{user.name}"/>
<f:param name="paramOne" value="#{user.name}" />
</h:commandLink>
</h:panelGroup>
</f:facet>

....

</rf:objectPanel>

In Renderer, the facet will be rendered as table grid. depending on the number of users in the userData object,
a number of Icon & username will be renderer a a list in a pannel.

The <f:param name="paramOne" /> is supposed to be
posted back to the server, on the client side, the javascript
generated by Framework will send paramOne as hidden field when
user click the commandlink. But when the ActionListener called back, I try to get the param value from
the ActionEvent, but the paramOne value is alway null. Could anyone give me some hint for this problem??

BTW, if I hard-coded the paramONe value in jsp page,
everything is fine.


This method is in the sub-class of UIComponentBase class (called UIObjectPanel), the UIObjectPanel object is
exposed by value binding as indicated in the Tag, varSelector="s", in the UIObjectPanel class,
s is mapped to this UIComponent subclass by value binding.

I have declared userData as managed bean with session scope.
Here is the EventHandler when user click commandLink:

public void setItemSelected(ActionEvent event){

log.debug("command button id : " +event.getComponent().getId());
List children = event.getComponent().getChildren();
log.debug("number of child : " + children.size());
for( int i =0; i <children.size(); i++){
Object obj = children.get(i);

if (children.get(i) instanceof UIParameter ){
UIParameter currentParam = (UIParameter)children.get(i);
log.debug("param name : " + currentParam.getName() +"; param value : "+ currentParam.getValue());
if (currentParam.getName().equals("itemId") && currentParam.getValue() != null){
String paramValue = currentParam.getValue().toString();
log.debug("param value for itemId : " + paramValue);
((ListDataModelWithState)getDataModel()).getState().setSelected(paramValue);
}}}}

Thank you very much in advance!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic