掲示板

Redirect from one jsp to another

11年前 に Seeya S Kudtarker によって更新されました。

Redirect from one jsp to another

Regular Member 投稿: 187 参加年月日: 13/01/16 最新の投稿
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?
11年前 に Dhvanil Reshamwala によって更新されました。

RE: Redirect from one jsp to another

New Member 投稿: 13 参加年月日: 11/12/23 最新の投稿
Hi Seeya,
I think you will have to provide param name as 'redirect'. Then Liferay will automatically redirect to the JSP provided.
thumbnail
11年前 に Gnaniyar Zubair によって更新されました。

RE: Redirect from one jsp to another

Liferay Master 投稿: 722 参加年月日: 07/12/19 最新の投稿
Try this:

<portlet:param name="jspPage" value="/admin/viewEmployeeData.jsp" />
11年前 に Seeya S Kudtarker によって更新されました。

RE: Redirect from one jsp to another

Regular Member 投稿: 187 参加年月日: 13/01/16 最新の投稿
Gnaniyar Zubair:

Thanks!! It works now
10年前 に Himanshu Arora によって更新されました。

RE: Redirect from one jsp to another

New Member 投稿: 5 参加年月日: 12/05/16 最新の投稿
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
10年前 に Zsigmond Rab によって更新されました。

RE: Redirect from one jsp to another

Liferay Master 投稿: 728 参加年月日: 10/01/05 最新の投稿
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
10年前 に Himanshu Arora によって更新されました。

RE: Redirect from one jsp to another

New Member 投稿: 5 参加年月日: 12/05/16 最新の投稿
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
10年前 に Zsigmond Rab によって更新されました。

RE: Redirect from one jsp to another

Liferay Master 投稿: 728 参加年月日: 10/01/05 最新の投稿
Hi Himanshu,

is it working then?

Regards,
Zsigmond
10年前 に Himanshu Arora によって更新されました。

RE: Redirect from one jsp to another

New Member 投稿: 5 参加年月日: 12/05/16 最新の投稿
But still it is not working.
thumbnail
10年前 に Ahmed Hasan によって更新されました。

RE: Redirect from one jsp to another

Expert 投稿: 306 参加年月日: 07/04/13 最新の投稿
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
10年前 に Arun Kumar S によって更新されました。

RE: Redirect from one jsp to another

Regular Member 投稿: 182 参加年月日: 08/06/23 最新の投稿
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
8年前 に Manupoti Subrahmanyam によって更新されました。

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

Junior Member 投稿: 39 参加年月日: 13/04/12 最新の投稿
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>