cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing node properties from custom action UI

spdaly01
Champ in-the-making
Champ in-the-making
I am writing a custom action with a corresponding JSP.  I would like to show properties of the content node in the JSP.  How and I access properties of the actioned upon node from within the JSP?

I did some digging into the SDK examples and found a bean called DocumentDetailsBean.  The code is below.  It didn't work.

Thoughts??


<tr>
   <td><nobr><h:outputText value="Subject Name:"/></nobr></td>
   <td width="95%">
      <td><h:outputText value="#{DocumentDetailsBean.subject_name}"/></td>
   </td>
</tr>
1 REPLY 1

hap234
Champ in-the-making
Champ in-the-making
Hi,

First thing is you have to take currentnode NodeRef on click of that action, that you can pass as a parameter form action that you have configured in web-client-config-custom.xml .

<action id="template-form">
            <label>Extract Properties</label>
            <show-link>true</show-link>
            <image>/images/icons/invite.gif</image>
            <action-listener>
               #{ExtractPropBean.setupTemplateFormAction}
            </action-listener>
            <action>#{ExtractPropBean.setupTemplateFormAction}</action>
            <params>
               <param name="id">#{actionContext.id}</param>
            </params>

         </action>
Here ExtractPropBean is a Bean in which you have to defined setupTemplateFormAction method.
public void setupTemplateFormAction (ActionEvent event)
    {
        UIActionLink link = (UIActionLink) event.getComponent();
        Map<String, String> params = link.getParameterMap();
        String id = params.get("id");
       NodeRef nodeRef = new NodeRef(Repository.getStoreRef(), id);
    }

Once you get that NodeRef , using nodeService you can get all properties of that node , that you can set in java bean properties and populate it on jsp.

Best Regards,
Hetal Patel