Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Accessing param values using RichFaces Drag n Drop

843844May 25 2009 — edited May 26 2009
Hello everyone,

I'm using RichFaces drag and drop support and I want to pass an additional parameter so that I can access it's value when processing the dragged/dropped object.

My JSP has:
<rich:dragSupport dragIndicator=":indicator" dragType="measure" dragValue="#{measure}">
       <a4j:actionparam name="operator" value="#{aggOp}" assignTo="#{SessionBean.tempAggOp}"/>
       <rich:dndParam name="label" value="#{measure.name} (#{aggOp})"/>
</rich:dragSupport>
<h:outputText value="#{aggOp}" style="font:11px arial;"/>
On my backing bean method that processes the event, I can access the object's properties fine, but the param has a strange behaviour:

The first time I drag an object, the param value is null on the bean. The second time, it has the value it should have for the first dragged object, and so on.

Apparently the param value is being updated after the drop event method is called. Any ideas on how to change this please?

Thanks in advance,
~Ruben

Comments

843844
To solve this problem I used <f:param> instead of actionParam:

On the drag support component:
<rich:dragSupport dragIndicator=":indicator" dragType="measure" dragValue="#{measure}">
                                                    <f:param name="operator" value="#{aggOp}" />
                                                    <rich:dndParam name="label" value="#{measure.name} (#{aggOp})"/>
</rich:dragSupport>
On the backing bean:
    //dropped item processors
    public void processDropSupportTable(DropEvent dropEvent) {
        if (dropEvent.getDragType().compareTo("measure") == 0) {
            SOLAPMeasure dragged = (SOLAPMeasure)dropEvent.getDragValue();
            FacesContext context = FacesContext.getCurrentInstance();  
            Map requestMap = context.getExternalContext().getRequestParameterMap();  
            String tempAggOp = (String)requestMap.get("operator"); 
            System.out.println("dropped: " + dragged.getId() + " named: " + dragged.getName() + " whose operator is: " + tempAggOp);
        }
    }
1 - 1
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 23 2009
Added on May 25 2009
1 comment
196 views