Foren

struts action in a portlet

Brahim TARNAOUI, geändert vor 13 Jahren.

struts action in a portlet

Junior Member Beiträge: 64 Beitrittsdatum: 15.06.10 Neueste Beiträge
hello,

i'm trying to devellop a portlet and i put in my jsp portlet a link to a liferay core struts action.

<portlet:renderURL var="rowURL">
<portlet:param name="struts_action" value="/document_library/view" />
<portlet:param name="folderId" value="<%= String.valueOf(11530) %>" />
</portlet:renderURL>
<a href="<%= rowURL %>" >my-Directory</a>


when i click, nothing is showing.
any idea please
Nicholas Tenczar, geändert vor 13 Jahren.

RE: struts action in a portlet

Junior Member Beiträge: 53 Beitrittsdatum: 15.07.10 Neueste Beiträge
Use <portlet:actionURL> instead of <portlet:renderURL>.
Brahim TARNAOUI, geändert vor 13 Jahren.

RE: struts action in a portlet

Junior Member Beiträge: 64 Beitrittsdatum: 15.06.10 Neueste Beiträge
hello,
thx for your response, bbut my problem is how to call a struts action predefined by LifeRay in my portlet, i get this error:


javax.portlet.UnavailableException: No matching handler method found for portlet request: mode 'view', type 'action', parameters map['struts_action' -> array<String>['/document_library/view'], 'folderId' -> array<String>['11530']]

the question is, how to call aciton /document_library/view in Library portlet from my portlet namming myPortlet?

NB: for developping my portlet i use spring

best regards
thumbnail
Alexandre FILLATRE, geändert vor 13 Jahren.

RE: struts action in a portlet

Junior Member Beiträge: 80 Beitrittsdatum: 02.12.10 Neueste Beiträge
Hi Brahim,

You were right to use a renderURL. Though this taglib creates a render URL within the current portlet context, which means that the generated URL will try to resolve a render method in your current portlet's controller.
This is not what you want to do. You want to resolve the render method of the document_library portlet. In order to do this, youcannot use this taglib, but you have to generate the requested URL instead. I'd suggest that you do that in your Spring render method, and pass the URL in the model object, instead of doing it directly in the JSP.

The code you need should be something like

// Create render URL
PortletURL redirectURL = PortletURLFactoryUtil.create(PortalUtil.getHttpServletRequest(request),
	PortletKeys.DOCUMENT_LIBRARY, themeDisplay.getPlid(), ActionRequest.RENDER_PHASE);
redirectURL.setWindowState(WindowState.NORMAL);
redirectURL.setParameter("struts_action", "/document_library/view");
return redirectURL.toString();


Regards,
Alexandre FILLATRE
Brahim TARNAOUI, geändert vor 13 Jahren.

RE: struts action in a portlet

Junior Member Beiträge: 64 Beitrittsdatum: 15.06.10 Neueste Beiträge
Hi Alexandre,

i have an error in this constant : ActionRequest.RENDER_PHASE
for this class ActionRequest, i have just the following Cte USER_INFO FORM_AUTH DIGEST_AUTH CLIENT_CERT_AUTH BASIC_AUTH
thumbnail
Alexandre FILLATRE, geändert vor 13 Jahren.

RE: struts action in a portlet

Junior Member Beiträge: 80 Beitrittsdatum: 02.12.10 Neueste Beiträge
Hi,

Are you using javax.portlet.ActionRequest ? The class comes from portlet.jar located in EXT/lib/global libs.

Regards,
Alexandre FILLATRE
Brahim TARNAOUI, geändert vor 13 Jahren.

RE: struts action in a portlet

Junior Member Beiträge: 64 Beitrittsdatum: 15.06.10 Neueste Beiträge
hi,

yes, i'm using javax.portlet.ActionRequest ? The class comes from portlet.jar located in $TOMCAT/lib/ext

thx
thumbnail
Alexandre FILLATRE, geändert vor 13 Jahren.

RE: struts action in a portlet

Junior Member Beiträge: 80 Beitrittsdatum: 02.12.10 Neueste Beiträge
Try
javax.portlet.PortletRequest

instead.

Using ActionRequest here is not a good idea anyway, because the future request state should not depend on a previous state anyway. I guess this has been refactored a bit.

Regards,
Alexandre FILLATRE
Brahim TARNAOUI, geändert vor 13 Jahren.

RE: struts action in a portlet

Junior Member Beiträge: 64 Beitrittsdatum: 15.06.10 Neueste Beiträge
Hi Alexandre,

also PortletRequest have the same Cte of ActionRequest :

BASIC_AUTH
CLIENT_CERT_AUTH
DIGEST_AUTH
FORM_AUTH
USER8INFO


thx
thumbnail
Alexandre FILLATRE, geändert vor 13 Jahren.

RE: struts action in a portlet

Junior Member Beiträge: 80 Beitrittsdatum: 02.12.10 Neueste Beiträge
Constants in those classes come from JSR 168 and JSR 286. It is not possible that they are not here.

Which version of Liferay are you using ? How did you install it ? What is the version of the portlet.jar lib ?

Regards,
Alexandre FILLATRE
Brahim TARNAOUI, geändert vor 13 Jahren.

RE: struts action in a portlet

Junior Member Beiträge: 64 Beitrittsdatum: 15.06.10 Neueste Beiträge
Hi,

  • version of Liferay is : 6.0.5
  • i install it by unzipping the zip file containing LifeRay with Tomcat
  • the version of the portlet jar is that comming with LifeRay



thx
Nicolas Lafaury, geändert vor 10 Jahren.

RE: struts action in a portlet

New Member Beiträge: 3 Beitrittsdatum: 25.09.12 Neueste Beiträge
Hello

I don't know why but

<portlet:renderURL var="urlComp" windowState="<%= LiferayWindowState.POP_UP.toString() %>">
<portlet:param name="struts_action" value="/chargesemployeur/viewArticle.do" />
<portlet:param name="articleID" value="<%=urlCompPref%>" />
</portlet:renderURL>


Do not work but


<portlet:renderURL var="urlComp" windowState="<%= LiferayWindowState.POP_UP.toString() %>">
<portlet:param name="struts_action" value="/chargesemployeur/viewArticle.do" />
<portlet:param name="_spage" value="/chargesemployeur/viewArticle.do" />
<portlet:param name="articleID" value="<%=urlCompPref%>" />
</portlet:renderURL>



Any idea why I have to add this parameter?

Many thanks

Nicoals