Gajjini
Gajjini

Reputation: 283

portlet:renderURL not working

I am working on liferay 6 Portlet development. I am new to it. I need to keep a Hyperlink to another jsp this way as shown.

<a href="<portlet:renderURL>
    <portlet:param name="jspPage" value="/WEB-INF/view/page2.jsp" />
    </portlet:renderURL>">
</a>

I have another JSP called page2.jsp , but this isn't working (Means when i click on the hyper link , it aain displays the First JSP only

But this isn't working

This is my page1.jsp

<%@ taglib prefix="s" uri="/struts-tags" %>

<s:form action="helloForm" method="POST" theme="simple">
    Enter Your Name:<s:textfield name="namer" value="%{name}" required="true"/>
    <s:submit/>
</s:form>


<a href="<portlet:renderURL>
<portlet:param name="jspPage" value="/WEB-INF/view/page2.jsp" />
</portlet:renderURL>">
</a>

=========

This is pag2.jsp

<html>
<head>
</head>
<body>
    <h1>Hi </h1>
</body>
</html>

Upvotes: 3

Views: 9596

Answers (2)

Haolin Zhang
Haolin Zhang

Reputation: 67

I believe the problem happens in the tag.

In MVCPortlet, if you want to call a JSP page directly from another JSP page, you have to name the the portlet:param's name as "mvcPath", say:

<portlet:renderURL var="varA">
    <portlet:param name="mvcPath" value="/a.jsp"/>
</portlet:renderURL>

<portlet:renderURL var="varB">
    <portlet:param name="mvcPath" value="/b.jsp"/>
</portlet:renderURL>

<a href="<%=varA %>">Link to A</a>
<a href="<%=varB %>">Link to B</a>

This will work fine.

Hope this will help you.

Upvotes: 1

Prakash K
Prakash K

Reputation: 11698

Can you try the following code in your page1.jsp and see if it works:

<portlet:renderURL var="clickRenderURL">
    <portlet:param name="jspPage" value="/WEB-INF/view/page2.jsp" />
</portlet:renderURL>

<a href="<%=clickRenderURL %>">Click here</a>

If it does than may be this is the issue with quotes ("").

If it does not then can you provide more details like which portlet are you extending MVCPortlet, etc.

Upvotes: 4

Related Questions