WebSphere Portal Server - Cooperative (JSF) Portlets & Commandbutton

This is Interesting: Free IT Magazines  
Home > Archive > WebSphere Portal Server > March 2007 > Cooperative (JSF) Portlets & Commandbutton





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Cooperative (JSF) Portlets & Commandbutton

2007-03-20, 1:21 pm

Hi,

Short explanation of the problem:
<h:commandButton> does not lead to processAction being called when using cooperative Portlets, while <h:commandLink> does.

This is the relevant part of my jsp:

<hx:commandExButton type="submit" value="Submit" id="button2" styleClass="commandExButton" action="#{pc_MenueView.doCooperativeButtonAction}">
<f:param id="parameter1" name="SendCookie" value="Cookie"></f:param>
</hx:commandExButton>
<h:commandButton type="submit" value="Submit" id="button1" styleClass="commandButton" action="#{pc_MenueView.doCooperativeButtonAction}">
<f:param id="parameter2" name="SendCookie" value="Cookie"></f:param>
</h:commandButton>
<h:commandLink id="link1" styleClass="commandLink" action="#{pc_MenueView.doCooperativeButtonAction}">
<f:param id="parameter3" name="SendCookie" value="Cookie"></f:param>
<h:outputText id="text3" styleClass="outputText" value="link"></h:outputText>
</h:commandLink>

All use the same page code method and the page code method is called by all them when executed, but only <h:commandLink> triggers processAction in the target Portlet.

This has been discussed before, but no solution was found at that time:
http://www-128.ibm.com/developerwor...um=168#13875981

Almost a year has passed since the initial question, so maybe somebody has found a fix / solution to the problem.

Thanks in advance
Michael Jahn
yurykats

2007-03-21, 1:36 am

The problem with commandButton is that it does not put its parameters into the URL (while commandLink does). Therefore your "SendCookie" param isn't going anywhere and thus no action is triggered. To workaround this, you can put the param into a hidden fi
eld on the form, instead of defining it as f:param on the button:
< INPUT type="hidden" name="SendCookie" value="Cookie" />
I haven't tried this, but I believe this should do the trick.
Michael Jahn

2007-03-23, 7:28 am

Thanks a lot. This worked.

Michael Jahn

PS: The functionality in RAD 7 should be adjusted IMHO. When editing a jsp in design view and inserting a cooperative source trigger (right mouse button->insert->portlet->cooperative source trigger) one can choose between command link and command button.
Command link works fine, but selecting command button results in f:param being used, which doesn't work as you just explained. It should generate input type="hidden" - Tags instead.

2007-03-23, 1:23 pm

Hi

Alternatively you can use the j4j:param (http://www.jsftutorials.net/param.html) that does the same as f:param or the hidden input field. Only difference between this tag and the f:param is that the f:param is associated to a commandLink whereas the j4j:p
aram is for the whole form (much like the hidden input field).

But even this is limiting in case you wanted multiple actions (command buttons) that are part of the same form and that all trigger inter-portlet communication. You can't because then both action params will be set

Is there any way to add the ACTION_NAME_PARAM programmatically? I tried putting it on the RequestParameterMap but this doesn't work.

Ross



2007-03-23, 1:23 pm

> PS: The functionality in RAD 7 should be adjusted

Agreed -- the functionality as well as the documentation within RAD regarding this issue is wrong as they give examples / generate code where f:param is being used with faces button

Ross
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com