Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Kiran Jai
Couldn't able to show default landing page from Portlet Action class
April 12, 2012 7:11 AM
Answer

Kiran Jai

Rank: Junior Member

Posts: 38

Join Date: April 9, 2012

Recent Posts

Hi ,

I am using Liferay 6 Portal for develoment .
I have created a page (Be it any page Public or private page ) , and added some of my developed Custom Portlets to it and i defined this page as a default landing page .

Now inside my GenericPortlet class , once the users validates his username and password with our database , i want to redirect him to my landing page .

I have tried a lot used Portlets RequestDispatcher's forward , include also , with the combinations of absolute and relative path to my default landing page .
And also tried my luck with using ActionResponse from processAction Method .

But neither thing has worked , could anybody please tell me how to resolve this issue ??

If anyone knows please help me how to resolve this issue .

Thanks you very much for reading .
ruchi sharma
RE: Couldn't able to show default landing page from Portlet Action class
April 12, 2012 7:47 AM
Answer

ruchi sharma

Rank: Junior Member

Posts: 95

Join Date: March 24, 2011

Recent Posts

Hi,
Could you please show your login code.
After looking at the code, may be i can help you.

Thanks
Ruchi
Kiran Jai
RE: Couldn't able to show default landing page from Portlet Action class
April 12, 2012 8:06 AM
Answer

Kiran Jai

Rank: Junior Member

Posts: 38

Join Date: April 9, 2012

Recent Posts

ruchi sharma:
Hi,
Could you please show your login code.
After looking at the code, may be i can help you.

Thanks
Ruchi



There is nothing much in the code , anyway for the reference

Earlier i tried using Actionresponse from processAction method using ActionResponse.sendRedirect("http://localhost:8086/user/test/home ")

commented that and using this way , also tried with this way
http://localhost:8086/user/test/home and /user/test/home

public void doView(RenderRequest request, RenderResponse response)
throws PortletException, IOException {

response.setContentType("text/html");


PortletRequestDispatcher dispatcher = null;
if (this.name.isEmpty()) {
dispatcher = getPortletContext().getRequestDispatcher(
"/WEB-INF/jsp/AllInOne_view.jsp");
} else {

dispatcher = getPortletContext().getRequestDispatcher(
"http://localhost:8086/user/test/home");
}

dispatcher.include(request, response);
}

And with this there is this exception

17:53:47,765 ERROR [render_portlet_jsp:154] java.lang.NullPointerException
at org.ravi.learning.AllInOne.doView(AllInOne.java:57)
at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:328)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:93)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)

The AllinOne.java is my Custom GenericPortlet class AllInOne.java:57 is

dispatcher.include(request, response);

Please let me know if anything needs to be changed . thanks in advance .
Dhrutika Vyas
RE: Couldn't able to show default landing page from Portlet Action class
April 13, 2012 12:14 AM
Answer

Dhrutika Vyas

Rank: Expert

Posts: 438

Join Date: February 9, 2009

Recent Posts

Hi,

Overwrite DefaultLandingPageAction class using hook to achieve your requirement,

You can refer to this links for more info: http://www.liferay.com/community/wiki/-/wiki/Main/Customizing+the+default+page+after+login

Regards,
Dhrutika
ruchi sharma
RE: Couldn't able to show default landing page from Portlet Action class
April 13, 2012 1:54 AM
Answer

ruchi sharma

Rank: Junior Member

Posts: 95

Join Date: March 24, 2011

Recent Posts

Hello ,
As Dhrutika said, hooks can be used for login events that is one of the best option.
Are you able to go to AllInOne_view.jsp when login fails ??
Regards
Ruchi