I managed to fix it.

Although the hackish alternative I presented at the end of the message
worked, when I was implementing friendly URLs it didn't work as expected for
the id parameter because it wasn't a part of <portlet:actionURL>.

I found a way to get the ID from the value stack this way

ActionContext.getContext().getValueStack().findValue("resourceId").toString();

so my final code is now

<% String resourceId =
ActionContext.getContext().getValueStack().findValue("resourceId").toString();
%>
<portlet:actionURL windowState="exclusive">
          <portlet:param name="struts.portlet.action"
value="/gdocs/gdocs/moreinformation" />
          <portlet:param name="docid" value="<%= resourceId %>">
</portlet:param></portlet:actionURL>

and it's working perfectly well.

Best Regards,
Ricardo

On Mon, Feb 22, 2010 at 1:47 PM, Ricardo Jorge <rvjs...@gmail.com> wrote:

> Hello.
>
> I'm using Liferay portal to develop a portlet using struts 2. I need to use
> a custom Liferay Window State called exclusive to generate a URL. This
> allows me to make AJAX calls and return only the result generated by the
> action. I have added the <custom-window-state> tag to my portlet.xml
>
> I tried
>
> <s:url windowState="exclusive" action="moreinformation">
>           <s:param name="id" value="resourceId" />
> </s:url>
>
> but the windowState in the URL always ends up being 'normal' (I presume
> this is the default). I did a quick look through the Struts2 code but I
> couldn't find the place where this default value was processed (I will look
> in more detail later).
>
> I also tried
>
> <portlet:actionURL windowState="exclusive">
>           <portlet:param name="struts.portlet.action"
> value="/gdocs/moreinformation" />
>           <portlet:param name="id" value="---------------------" />
> </portlet:actionURL>
>
> and it works but I need to add a dynamic parameter (id) from the Value
> Stack (I'm using s:iterator) but I have no idea how to put it there.
> <s:property> doesn't work, using %{} or ${} doesn't work either.
>
> Finally, I solved this problem the following way
>
> <portlet:actionURL windowState="exclusive">
>                   <portlet:param name="struts.portlet.action"
> value="/gdocs/moreinformation" />
> </portlet:actionURL>&amp;<portlet:namespace />id=<s:property
> value="resourceId" />
>
> but it feels kind of hackish and I think that there has to be a better way.
>
> Any suggestions?
>
> Best Regards,
> Ricardo
>

Reply via email to