I have a jsp where I display some data of some people say employees. The data of each employee is displayed as a row. I have made each row as a link so that when a user clicks on any row which gives details of a particular employee, the user is directed to a jsp which displays the same data of the employee so that further processing could be done.
My question is how should I pass the data of an employee when a user clicks on the row which contains that particular employee information?
What I have right now done is this:
<portlet:renderURL var="viewPendingLeaveApplicationsURL"/>
<liferay-ui:search-container delta="20" emptyResultsMessage="No Results Found">
<liferay-ui:search-container-results total="<%= pendingApprovals .size() %>"
results="<%= ListUtil.subList(pendingApprovals , searchContainer.getStart(), searchContainer.getEnd()) %>" />
<liferay-ui:search-container-row keyProperty = "empId" modelVar="search"
className="com.corpserver.mallyas.mis.portal.model.LeaveApplication">
<portlet:renderURL var="leaveApplicationURL">
<portlet:param name="jspPage" value="/admin/AddCompany.jsp" />
<portlet:param name="search" value='<%String.valueOf(search.getEmpId());%>'/>
</portlet:renderURL>
<liferay-ui:search-container-column-text name='Leave Duration' value='<%=String.valueOf(search.getLeaveDuration())%>' href="<%= leaveApplicationURL.toString()%>" />
<liferay-ui:search-container-column-text name="From" value='<%=String.valueOf(search.getLeaveFromDate())%>' href="<%= leaveApplicationURL.toString()%>"/>
<liferay-ui:search-container-column-text name="To" value='<%=String.valueOf(search.getLeaveToDate())%>' href="<%= leaveApplicationURL.toString()%>"/>
<liferay-ui:search-container-column-text name="Reason" value='<%=String.valueOf(search.getLeaveReason())%>' href="<%= leaveApplicationURL.toString()%>"/>
<liferay-ui:search-container-column-text name="Remarks" value='<%=String.valueOf(search.getLeaveRemarks())%>' href="<%= leaveApplicationURL.toString()%>"/>
</liferay-ui:search-container-row>
<liferay-ui:search-iterator/>
</liferay-ui:search-container>
In the above code I am trying to pass the empId
of the row which the user selects.
But nothing gets displayed in the second jsp. I want to pass all of this information on second jsp.
You need to use
<portlet:actionURL />
instead of render one.Then use this parameters in your render method.
Well I see a small problem in the code, problem is in the way the URL is generated:
This line:
should be:
did you notice this:
<%=
String.valueOf(search.getEmpId())%>
, the starting is added like<%=
and the trailing;
is removed.So in short you need an
jsp expression
instead of scriptlet code block in thevalue
attribute.