want to create a link to other pages of portlet in my own taglib with out.print()
but in execution liferay can't render <portlet:renderURL>
taglibs : taglib code :
int counter = 0;
while (rs.next()) {
counter++;
int spcPk = Integer.parseInt(rs.getString("tCommodityGroupSpcPK"));
result = "<tr>" +
" <td id=\"group-"+counter+"\">" +
" <a href=\"<portlet:renderURL><portlet:param name='jspPage'" +
" value='subGroup.jsp?p1="+spcPk+"' /></portlet:renderURL>\" /> " +
" "+rs.getString("xa")+" " +
" </a> " +
" </td> " +
" <td id=\"group-"+counter+"\">"+rs.getString("xx")+"</td> " +
" <td id=\"group-"+counter+"\">"+rs.getString("aa")+"</td> " +
" <td id=\"group-"+counter+"\">"+rs.getString("Result")+"</td> " +
" </tr>";
out.print(result);
}
rs.close();
// out.println(result);
cstmt.close();
in execution of view.jsp and other tags has been rendered successfully but the liferay taglibs don't .. when i click on links i have somthing like this in my url !!
localhost:8081/%3Cportlet:renderURL%3E%3Cportlet:param%20name='jspPage'%20value='subGroup.jsp?p1=3'%20/%3E%3C/portlet:renderURL%3E
can anybody help me in rendering that taglibs in custom taglib class ?
Thats obvious, JSP Engine
consider your tag as any other markup. You have to use the API
rather than Tag
like mentioned below
PortletURL portletURL = renderResponse.createRenderURL();
portletURL.setParameter("jspPage", "subGroup.jsp?p1="+spcPk);
then inject portletURL.toString()
into the markup
You should have access to both renderRequest
and renderResponse
implicitly if you define <portlet:defineObjects />
in your JSP
.
The other way to get them from normal request
object is
PortletResponse portletResponse = (PortletResponse)request.getAttribute(JavaConstants.JAVAX_PORTLET_RESPONSE);
You can refer to the source code of any of the existing Liferay UI
Tags like asset-categories-navigation
for more information.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.