掲示板

How to make a forward to a specific tab?

thumbnail
14年前 に Leticia Borrajo によって更新されました。

How to make a forward to a specific tab?

New Member 投稿: 19 参加年月日: 09/09/14 最新の投稿
Hi,

I believe this must be quite simple, but I am a newbie in Liferay and struts, and it doesn't seem I can find the solution by myself.

I have created a portlet with tabs.


<%

String tabs1 = ParamUtil.getString(request, "tabs1", "Proyectos");

PortletURL portletURL = renderResponse.createRenderURL();

portletURL.setWindowState(WindowState.NORMAL);

portletURL.setParameter("struts_action", "/ext/project/view");
portletURL.setParameter("tabs1", tabs1);

String tabNames = "Proyectos,Cuestionario Criticidad,Tipología";

%>

<liferay-ui:tabs names="<%= tabNames %>" url="<%= portletURL.toString() %>" refresh="true" />

<c:if test="<%= tabs1.equals(&quot;Proyectos&quot;) %>">
  <liferay-util:include page="/html/portlet/ext/project/viewListProjects.jsp" />
</c:if>
<c:if test="<%= tabs1.equals(&quot;Cuestionario Criticidad&quot;) %>">
  <liferay-util:include page="/html/portlet/ext/project/viewCriticidad.jsp" />
</c:if>
<c:if test="<%= tabs1.equals(&quot;Tipología&quot;) %>">
  <liferay-util:include page="/html/portlet/ext/project/viewProject.jsp" />
</c:if>


In the second one, viewCriticidad, I have a form, and when I process it, I want it to go back to that same page. The problem is, that if I make the forward to ViewCriticidad, the tabs don't appear.

Instead, if I send it to view (the file with the tabs), I go back to the default page (viewListProjects).

I guess there is some way of specifying a tab, but I can't find it.

Any idea?

Thanks,

Leticia
thumbnail
14年前 に Wilson Man によって更新されました。

RE: How to make a forward to a specific tab?

Liferay Master 投稿: 581 参加年月日: 06/06/21 最新の投稿
basically, you need to set the "tabs1" parameter in your forward ... check in your Action class and see if you can set that parameter.
thumbnail
14年前 に Leticia Borrajo によって更新されました。

RE: How to make a forward to a specific tab?

New Member 投稿: 19 参加年月日: 09/09/14 最新の投稿
I tried that, but I am not sure if I did it correctly. I wrote:

req.setAttribute("tabs1", "Cuestionario%20Criticidad");
setForward(req,"portlet.ext.project.view");

Since it has a space in the middle, I am not sure if I should let it like "Cuestionario Criticidad" or "Cuestionario%20Criticidad". Anyway, I tried both and it didn't work.

What am I doing wrong?
thumbnail
14年前 に Wilson Man によって更新されました。

RE: How to make a forward to a specific tab?

Liferay Master 投稿: 581 参加年月日: 06/06/21 最新の投稿
hmmm, setting an attribute is not the same as setting a param, but your JSP can also check the request attribute for the same data if the request parameter doesn't carry it.

So in your JSP, if the tab is not found try also to getAttribute with the same key.
thumbnail
14年前 に Leticia Borrajo によって更新されました。

RE: How to make a forward to a specific tab?

New Member 投稿: 19 参加年月日: 09/09/14 最新の投稿
And how do I set a param?
thumbnail
14年前 に Leticia Borrajo によって更新されました。

RE: How to make a forward to a specific tab?

New Member 投稿: 19 参加年月日: 09/09/14 最新の投稿
It doesn't matter, I was able to do it.

Thank you for your help.