Foros de discusión

The struts path X does not belong to portlet Y.

François LE QUEMENER, modificado hace 14 años.

The struts path X does not belong to portlet Y.

Junior Member Mensajes: 48 Fecha de incorporación: 18/09/09 Mensajes recientes
Hi,
Im trying to do a portlet in EXT, which will launch a search. Basically, it's just a form that sends the data to /search/search action.

It works great, except when I'm logged in. When it's the case (logged as user or power user) , I have this message :
The struts path ext does not belong to portlet EXT_8. Check the definition in liferay-portlet.xml

I also have this message instead of the portlet :
You do not have the roles required to access this portlet.

It seems that the guest user has more rights than the others !

How is it possible, and how do I fix it ?

Here is my portlet code :


<%
String namespace = "_" + PortletKeys.SEARCH + "_";

long groupId = ParamUtil.getLong(request, "groupId");

Group group = layout.getGroup();

String defaultKeywords = LanguageUtil.get(pageContext, "search") + "...";
String unicodeDefaultKeywords = UnicodeFormatter.toString(defaultKeywords);

String keywords = ParamUtil.getString(request, namespace + "keywords", defaultKeywords);

PortletURL portletURL = new PortletURLImpl(request, PortletKeys.SEARCH, 18805, PortletRequest.RENDER_PHASE);
portletURL.setWindowState(WindowState.MAXIMIZED);
portletURL.setPortletMode(PortletMode.VIEW);
portletURL.setParameter("struts_action", "/search/search");

%>


<div class="search-form">

	<h1><liferay-ui:message key="search.rechercher" /></h1>
	
	<div class="content">
	
		<form action="<%= portletURL.toString() %>" method="post" name="<%= namespace %>fm" onSubmit="submitForm(this); return false;">
		
			<input name="<%= namespace %>keywords" size="30" type="text" value="<%= HtmlUtil.escape(keywords) %>" onBlur="if (this.value == '') { this.value = '<%= unicodeDefaultKeywords %>'; }" onFocus="if (this.value == '<%= unicodeDefaultKeywords %>') { this.value = ''; }">
			
			<input type="hidden" name="<%= namespace %>groupId" value="0">
			
			<input align="absmiddle" border="0" src="<%= themeDisplay.getPathThemeImages() %>/icons/icon_puce.png" title="<liferay-ui:message key=" search">" type="image" /&gt;
		
		</form>
	
	</div>

</div>
thumbnail
Juan Fernández, modificado hace 14 años.

RE: The struts path X does not belong to portlet Y.

Liferay Legend Mensajes: 1261 Fecha de incorporación: 2/10/08 Mensajes recientes
Hi!
This error happens when you use a struts path of a portlet that is not yours. I mean, in your portlet, you have to use your own paths.
If your new portlet is called for example "my_portlet" you have to write in your file this:

portletURL.setParameter("struts_action", "/my_portlet/search");


And then, in struts, call the class you want to be executed

I hope you understand
Regards
Juan Fernández
François LE QUEMENER, modificado hace 14 años.

RE: The struts path X does not belong to portlet Y.

Junior Member Mensajes: 48 Fecha de incorporación: 18/09/09 Mensajes recientes
OK that's one point I understood. Howerver, the problem is still there.
I insist on the fact that works when I'm guest, and not when I'm logged in (that's why I doubt about a wrong struts configuration)
thumbnail
Juan Fernández, modificado hace 14 años.

RE: The struts path X does not belong to portlet Y.

Liferay Legend Mensajes: 1261 Fecha de incorporación: 2/10/08 Mensajes recientes
François LE QUEMENER:

I insist on the fact that works when I'm guest, and not when I'm logged in (that's why I doubt about a wrong struts configuration)


Ok:
check these properties in portlet-ext.xml:


    <security-role-ref>
			<role-name>administrator</role-name>
		</security-role-ref>
		<security-role-ref>
			<role-name>guest</role-name>
		</security-role-ref>
		<security-role-ref>
			<role-name>power-user</role-name>
		</security-role-ref>
		<security-role-ref>
			<role-name>user</role-name>
		</security-role-ref>


I think it may have something to do with that
Regards
Juan Fernández
François LE QUEMENER, modificado hace 14 años.

RE: The struts path X does not belong to portlet Y.

Junior Member Mensajes: 48 Fecha de incorporación: 18/09/09 Mensajes recientes
That's what I guessed first, but I already had these lines.
Here is my portlet-ext.xml :

	<!-- ARDI Search -->
	<portlet>
		<portlet-name>EXT_8</portlet-name>
		<display-name>ARDI Search</display-name>
		<portlet-class>com.liferay.portlet.StrutsPortlet</portlet-class>
		<init-param>
			<name>view-action</name>
			<value>/ext/search</value>
		</init-param>
		<expiration-cache>0</expiration-cache>
		<supports>
			<mime-type>text/html</mime-type>
		</supports>
		<resource-bundle>com.liferay.portlet.StrutsResourceBundle</resource-bundle>
		<security-role-ref>
            <role-name>administrator</role-name>
        </security-role-ref>
        <security-role-ref>
            <role-name>guest</role-name>
        </security-role-ref>
        <security-role-ref>
            <role-name>power-user</role-name>
        </security-role-ref>
        <security-role-ref>
            <role-name>user</role-name>
        </security-role-ref>
	</portlet>
William B, modificado hace 13 años.

RE: The struts path X does not belong to portlet Y.

New Member Mensajes: 13 Fecha de incorporación: 5/07/10 Mensajes recientes
I'm having the EXACT same problem...
Anyone care to help?
thumbnail
Andrés Cerezo, modificado hace 13 años.

RE: The struts path X does not belong to portlet Y.

Junior Member Mensajes: 92 Fecha de incorporación: 11/11/10 Mensajes recientes
Me too, anyone jnows the solution?

Thanks.
Seyed Mohammad Hossein Jamali, modificado hace 10 años.

RE: The struts path X does not belong to portlet Y.

Junior Member Mensajes: 77 Fecha de incorporación: 13/12/09 Mensajes recientes
Is there any solution? I have the same problem.