Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Sujay Kumar Paul
create a link for create account & froget password
December 28, 2011 3:00 AM
Answer

Sujay Kumar Paul

Rank: Regular Member

Posts: 165

Join Date: October 28, 2011

Recent Posts

hi,

I want to create a link for create account & froget password in a portlet.

Pleae help

Thanks in advance.
Jelmer Kuperus
RE: create a link for create account & froget password
December 28, 2011 3:13 AM
Answer

Jelmer Kuperus

Rank: Liferay Legend

Posts: 1192

Join Date: March 10, 2010

Recent Posts

Create account :

1PortletURL url = PortletURLFactoryUtil.create(
2        request, PortletKeys.LOGIN, layout.getPlid(), PortletRequest.ACTION_PHASE);
3
4url.setWindowState(WindowState.MAXIMIZED);
5url.setPortletMode(PortletMode.VIEW);
6
7url.setParameter("saveLastPath", "0");
8url.setParameter("struts_action", "/login/create_account");


Or if you are lazy :

1themeDisplay.getURLCreateAccount()


Forgot password :

1PortletURL url = PortletURLFactoryUtil.create(
2        request, PortletKeys.LOGIN, layout.getPlid(), PortletRequest.ACTION_PHASE);
3
4url.setWindowState(WindowState.MAXIMIZED);
5url.setPortletMode(PortletMode.VIEW);
6
7url.setParameter("saveLastPath", "0");
8url.setParameter("struts_action", "/login/forgot_password");
Sujay Kumar Paul
RE: create a link for create account & froget password
December 28, 2011 3:21 AM
Answer

Sujay Kumar Paul

Rank: Regular Member

Posts: 165

Join Date: October 28, 2011

Recent Posts

Sorry
I cant understand where should i add the code?
Jelmer Kuperus
RE: create a link for create account & froget password
December 28, 2011 3:25 AM
Answer

Jelmer Kuperus

Rank: Liferay Legend

Posts: 1192

Join Date: March 10, 2010

Recent Posts

Where ever you like

For instance from a jsp you could do :

 1<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
 2<%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %>
 3
 4<portlet:defineObjects />
 5
 6<liferay-theme:defineObjects />
 7
 8<%
 9PortletURL url = PortletURLFactoryUtil.create(
10        request, PortletKeys.LOGIN, layout.getPlid(), PortletRequest.ACTION_PHASE);
11
12url.setWindowState(WindowState.MAXIMIZED);
13url.setPortletMode(PortletMode.VIEW);
14
15url.setParameter("saveLastPath", "0");
16url.setParameter("struts_action", "/login/create_account");
17%>
18
19
20<a href="<%= url %>">create account</a>
Puneet Upadhyay
RE: create a link for create account & froget password
December 28, 2011 3:55 AM
Answer

Puneet Upadhyay

Rank: Regular Member

Posts: 234

Join Date: October 22, 2011

Recent Posts

Its working.
Thanks jelmer
Sujay Kumar Paul
RE: create a link for create account & froget password
December 28, 2011 4:45 AM
Answer

Sujay Kumar Paul

Rank: Regular Member

Posts: 165

Join Date: October 28, 2011

Recent Posts

Hi
thanks for help
I add the code to the jsp but its not working. please help

<%@ include file="/html/adddoctor/init.jsp" %>
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
<%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %>



<portlet:renderURL var="updateBookURL">
<portlet:param name="jspPage" value="/html/adddoctor/update.jsp"/>
</portlet:renderURL>
<br/><a href="<%= updateBookURL %>">Add new Docktor &raquo;</a>

<br/><a href="http://localhost:8080/web/guest/page-one?p_auth=4LW0HbUZ&p_p_id=58&p_p_lifecycle=1&p_p_state=maximized&p_p_mode=view&saveLastPath=0&_58_struts_action=%2Flogin%2Fcreate_account">register</a>

<portlet:defineObjects /><liferay-theme:defineObjects />
<%PortletURL url = PortletURLFactoryUtil.create(request, PortletKeys.LOGIN, layout.getPlid(), PortletRequest.ACTION_PHASE);
url.setWindowState(WindowState.MAXIMIZED);
url.setPortletMode(PortletMode.VIEW);
url.setParameter("saveLastPath", "0");
url.setParameter("struts_action", "/login/create_account");%>
<a href="<%= url %>">create account</a>
Puneet Upadhyay
RE: create a link for create account & froget password
December 28, 2011 8:55 PM
Answer

Puneet Upadhyay

Rank: Regular Member

Posts: 234

Join Date: October 22, 2011

Recent Posts

You just have to import all the required classes or packages. emoticon
Natalie D
RE: create a link for create account & froget password
March 7, 2012 4:23 AM
Answer

Natalie D

Rank: Junior Member

Posts: 55

Join Date: February 6, 2012

Recent Posts

Bu how on earth create such a link inside JSF page?

ps. scriplets are deprecated for almost ten years now... and they are so messy!
Jelmer Kuperus
RE: create a link for create account & froget password
March 7, 2012 9:28 AM
Answer

Jelmer Kuperus

Rank: Liferay Legend

Posts: 1192

Join Date: March 10, 2010

Recent Posts

I think you can do something like this in jsf

1PortletRequest portletRequest = (PortletRequest) FacesContext.getCurrentInstance().getExternalContext();
2HttpServletRequest request = PortalUtil.getHttpServletRequest(portletRequest);


From there it's the same deal. And yes i know scriptlets suck and you should never use them but many people here follow the liferay guidelines when it comes to portlet development which means scriptlets, services generated from xml files, no transactions and no foreign keys (yay!)