Fórum

Redirect from one jsp to another

Seeya S Kudtarker, modificado 11 Anos atrás.

Redirect from one jsp to another

Regular Member Postagens: 187 Data de Entrada: 16/01/13 Postagens Recentes
I am using view.jsp for adding data and I want to redirect to another jsp page to see my data.
This is what i have done in view. jsp to redirect to another jsp

<portlet:renderURL var="viewEmployeeDataURL">
<portlet:param name="viewEmployeeData" value="/admin/viewEmployeeData.jsp" />

</portlet:renderURL>

<a href="<%= viewEmployeeDataURL %>">View Employee Details</a>


The above code I have written after </aui:form>

But when I run this code and click on "View Employee Details" I get the same view.jsp page instead of getting redirected to viewEmployeeData.jsp page

What changes should I make to the code to jump to viewEmployeeData jsp page?
Dhvanil Reshamwala, modificado 11 Anos atrás.

RE: Redirect from one jsp to another

New Member Postagens: 13 Data de Entrada: 23/12/11 Postagens Recentes
Hi Seeya,
I think you will have to provide param name as 'redirect'. Then Liferay will automatically redirect to the JSP provided.
thumbnail
Gnaniyar Zubair, modificado 11 Anos atrás.

RE: Redirect from one jsp to another

Liferay Master Postagens: 722 Data de Entrada: 19/12/07 Postagens Recentes
Try this:

<portlet:param name="jspPage" value="/admin/viewEmployeeData.jsp" />
Seeya S Kudtarker, modificado 11 Anos atrás.

RE: Redirect from one jsp to another

Regular Member Postagens: 187 Data de Entrada: 16/01/13 Postagens Recentes
Gnaniyar Zubair:

Thanks!! It works now
Himanshu Arora, modificado 10 Anos atrás.

RE: Redirect from one jsp to another

New Member Postagens: 5 Data de Entrada: 16/05/12 Postagens Recentes
i am not able to redirect to other jsp.
I have the following code in my view.jsp :-


<portlet:renderURL var="anotherURL">
<portlet:param name="jspPage" value="WEB-INF/jsp/register.jsp" />
</portlet:renderURL>
<%= anotherURL %>
<h3>Click <a href="<%=anotherURL %>>" >here</a> to register
</h3>


but in anotherUrl i am getting the following link :-

"http://localhost:8080/web/guest/home?p_p_id=SpringPortlet_WAR_SpringPortletportlet&p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=2&_SpringPortlet_WAR_SpringPortletportlet_jspPage=WEB-INF%2Fjsp%2Fregister.jsp"
thumbnail
Zsigmond Rab, modificado 10 Anos atrás.

RE: Redirect from one jsp to another

Liferay Master Postagens: 728 Data de Entrada: 05/01/10 Postagens Recentes
Hi Himanshu,

which version of Liferay are you using and which type of portlet do you have? In later versions the parameter name is mvcPath.

On the other hand, the value of this have to be a relative path to the file. Are you sure about that the value is fine. It's suspicious for me.

Regards,
Zsigmond
Himanshu Arora, modificado 10 Anos atrás.

RE: Redirect from one jsp to another

New Member Postagens: 5 Data de Entrada: 16/05/12 Postagens Recentes
Hi Zsigmond ,
I am using Liferay 6.1 CE and i have created spring mvc protlet without doview and processaction method. I want to redirect to another jsp register.jsp just like we can redirect in spring mvc application using <a>.
As suggested by you i have changed the code to :-

<portlet:renderURL var="anotherURL">
<portlet:param name="mvcPath" value="/register.jsp" />
</portlet:renderURL>
<%= anotherURL %>
<h3>Click <a href="<%=anotherURL %>>" >here</a> to register
</h3>

and i am getting the following value in anotherURL= "http://localhost:8080/web/guest/home?p_p_id=SpringPortlet_WAR_SpringPortletportlet&p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=2&_SpringPortlet_WAR_SpringPortletportlet_mvcPath=%2Fregister.jsp "

Thanks for your help. :-)
thumbnail
Zsigmond Rab, modificado 10 Anos atrás.

RE: Redirect from one jsp to another

Liferay Master Postagens: 728 Data de Entrada: 05/01/10 Postagens Recentes
Hi Himanshu,

is it working then?

Regards,
Zsigmond
Himanshu Arora, modificado 10 Anos atrás.

RE: Redirect from one jsp to another

New Member Postagens: 5 Data de Entrada: 16/05/12 Postagens Recentes
But still it is not working.
thumbnail
Ahmed Hasan, modificado 10 Anos atrás.

RE: Redirect from one jsp to another

Expert Postagens: 306 Data de Entrada: 13/04/07 Postagens Recentes
Hi Himanshu,

I ve covered this in simple steps in chapter number 4 of my free eBook on Liferay development. You can download a free copy and refer there. Also give your feedback and comments.

Yours truly,
Ahamed Hasan
Author, Liferay Portlet Cookbook
Arun Kumar S, modificado 10 Anos atrás.

RE: Redirect from one jsp to another

Regular Member Postagens: 182 Data de Entrada: 23/06/08 Postagens Recentes
Hi,

<portlet:param name="mvcPath" value="/register.jsp" />
will not work in Spring MVC Portlet.

Add following code into jsp file.

<portlet:renderurl var="renderjspURL">
 <portlet:param name="action" value="renderjsp"></portlet:param>
</portlet:renderurl>

<a href="${renderjspURL}">Click here</a>

Add following code in Controller class

@RenderMapping(params = "action=renderjsp")
public String renderjsp(RenderRequest request, RenderResponse response, Model model){
  return "test";
 }


Result :-
test.jsp will display


Hope this helps.
Thanks,
Arun!
thumbnail
Manupoti Subrahmanyam, modificado 8 Anos atrás.

Re: [Liferay Forums][General] RE: Redirect from one jsp to another

Junior Member Postagens: 39 Data de Entrada: 12/04/13 Postagens Recentes
Hi,

Create Render URL :
It has parameter name "jspPage" and value as "/jsp/register.jsp".

<portlet:renderURL var="anotherURL">
<portlet:param name="jspPage" value="/jsp/register.
jsp" />
</portlet:renderURL>
<%= anotherURL..toString() %>

On click of Button :

<aui:button
type="cancel"
value="Cancel"
onClick="<%= anotherURL.toString() %>"
/>

On click of Link :

<a href="<%= anotherURL.toString() %>" >to register </a>

If you are using MVCPortlet then you need to do
response.setRenderParameter("jspPage","/jsp/register.jsp")

but if you are using GenericPortlet (means extending that in your custom
portlet) override doView() and can write following code:
include(your-jsp, renderRequest, renderResponse);


Regards
Subrahmanyam


On Wed, Aug 28, 2013 at 11:24 AM, Himanshu Arora from liferay.com <
forums@liferay.com> wrote:

> i am not able to redirect to other jsp.
> I have the following code in my view.jsp :-
>
>
> <portlet:renderURL var="anotherURL">
> <portlet:param name="jspPage" value="WEB-INF/jsp/register.jsp" />
> </portlet:renderURL>
> <%= anotherURL %>
> <h3>Click <a href="<%=anotherURL %>>" >here</a> to register
> </h3>
>
>
> but in anotherUrl i am getting the following link :-
>
> "
> http://localhost:8080/web/guest/home?p_p_id=SpringPortlet_WAR_SpringPortletportlet&p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=2&_SpringPortlet_WAR_SpringPortletportlet_jspPage=WEB-INF%2Fjsp%2Fregister.jsp"
>
>
>
> To view the thread, follow the link below:
>
> http://www.liferay.com/community/forums/-/message_boards/view_message/27747151
> --
> Liferay.com <http://www.liferay.com>