Fórum

How to get URL path with additional request parameter in liferay ?

thumbnail
Pradeep Kumar Badhai, modificado 11 Anos atrás.

How to get URL path with additional request parameter in liferay ?

Junior Member Postagens: 50 Data de Entrada: 06/09/11 Postagens Recentes
Hi dear community members,

I am converting web app into portlet. I am not able to find how I can build the url where response jsp is created using java class and the response jsp has also some link to generate new response with additional request paramater. Here is the sample url build code. But I am not able to get the url to request with new addition request paramater. This is based on Spring MVC portlet framework.

private String buildDetailUrl(String metric) {

String url = "http://testserver/Reports/command/viewDashboard"; // Web app url
sb.append(url);
sb.append("?system=");
sb.append(reportInfo.getSystem());
sb.append("&mngmtCo=");
sb.append(reportInfo.getMngmtCo());
sb.append("&beginDate=");
sb.append(reportInfo.getBeginDate());
sb.append("&endDate=");
sb.append(reportInfo.getEndDate());
sb.append("&outputType=HTML"); // Up to here I can generate the second screen
sb.append("&metric="); //But this is the road block for me; I am not able to add or query for metric [ Metric is just a String and there is if { condition} in the controller.
sb.append(metric);
return sb.toString();
}

Here "metric" is the additional request parameter which has some set of condition to reflect the new jsp.

If any of us has faced this kind of issue might give some hint how I can resolve this issue.

Thank you and have a great day !
Pradeep
thumbnail
David H Nebinger, modificado 11 Anos atrás.

RE: How to get URL path with additional request parameter in liferay ?

Liferay Legend Postagens: 14919 Data de Entrada: 02/09/06 Postagens Recentes
In the portlet world, you don't get/use url parameters, you use either action parameters or request parameters. Url parameters are strictly the purview of the portal, and you don't muck with them directly.
thumbnail
Pradeep Kumar Badhai, modificado 11 Anos atrás.

RE: How to get URL path with additional request parameter in liferay ?

Junior Member Postagens: 50 Data de Entrada: 06/09/11 Postagens Recentes
Thank you David for quick response,

I did this way
<portlet:resourceURL id="dashboardForm" var="dashboardFormURL">
<portlet:param name="system" value="${system}" />
<portlet:param name="mngmtCo" value="${mngmtCo}" />
<portlet:param name="beginDate" value="${beginDate}" />
<portlet:param name="endDate" value="${endDate}" />
</portlet:resourceURL>

<portlet:resourceURL id="dashboardMetricForm" var="dashboardMetricFormURL">
<portlet:param name="metric" value="${metric}" />
</portlet:resourceURL>

<aui:form method="post" action="<%= dashboardFormURL %>" name="<portlet:namespace>Complus Dashboard Reports</portlet:namespace>" target="_blank" >
<fieldset>

<input type="submit" name="runReport" id="runReport" value="Run Report" />
</aui:form>

This works for first one [resourceURL], but I am not able to add the metric [dashboardMetricFormURL],

Any hint to get this working using some hard coded form method ="post" inside above java class/method so that dynamically once the value is passed, it executes the corresponding method and generate the report. ???
thumbnail
David H Nebinger, modificado 11 Anos atrás.

RE: How to get URL path with additional request parameter in liferay ?

Liferay Legend Postagens: 14919 Data de Entrada: 02/09/06 Postagens Recentes
You're building two different resource requests. The first request is the one used in the form. The second resource request is not included in the form.

Since the first resource request does not have the metric parameter, it is not passed in during form submit and is not available on the receiving end.
thumbnail
Pradeep Kumar Badhai, modificado 11 Anos atrás.

RE: How to get URL path with additional request parameter in liferay ?

Junior Member Postagens: 50 Data de Entrada: 06/09/11 Postagens Recentes
Yes David, you are correct. The metric is not as part of input. It is define in array of a class of Reportwriter.java where all iText web generation code are available. So Metric is only populated when Reportwriter class is executed, so it generates the result page jsp where the new links are available with those metric associated values and I need to make functional to those links and generates third jsp of report.