Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
john john
html form values are not able to get in backing bean(JSF)
25 dicembre 2012 1.14
Risposta

john john

Punteggio: New Member

Messaggi: 23

Data di Iscrizione: 17 dicembre 2012

Messaggi recenti

Hi ,

I have created JSF Login portlet in liferay6.1.1 ga2.

I am facing one strange problem.i am unable to get values in loginbackingbean.

i have binded the input component as below.

<h:inputText id="handle" value="#{loginModelBean.handle}" required="true" validatorMessage="#{i18n['you-have-entered-invalid-data']}">
<f:ajax render="handleMessage" />
<c:if test="#{loginBackingBean.handleLabel == 'email-address'}">
<f:validateRegex pattern=".+[@].+[.].+" />
</c:if>
</h:inputText>

I have injected loginmodelbean in loginbackingbean as below.

// Injections
@ManagedProperty(value = "#{loginModelBean}")
private LoginModelBean loginModelBean;


when i try to get the input value in loginbacking bean it is giving null.

loginModelBean.getHandle() returns null..

Please help how to get resolved this issue
David H Nebinger
RE: html form values are not able to get in backing bean(JSF)
25 dicembre 2012 7.32
Risposta

David H Nebinger

Punteggio: Liferay Legend

Messaggi: 6270

Data di Iscrizione: 1 settembre 2006

Messaggi recenti

Neil just posted a JSF version of a login portlet. I'd grab his copy and see how he's handling the login stuff. It might be a better foundation to build your own logic upon anyway, especially if you started from scratch...
Neil Griffin
RE: html form values are not able to get in backing bean(JSF)
26 dicembre 2012 9.28
Risposta

Neil Griffin

LIFERAY STAFF

Punteggio: Liferay Legend

Messaggi: 1995

Data di Iscrizione: 26 luglio 2005

Messaggi recenti

David's advice is very good -- starting with the jsf2-login-portlet might be best because you would be starting with a working example.
john john
RE: html form values are not able to get in backing bean(JSF)
27 dicembre 2012 12.07
Risposta

john john

Punteggio: New Member

Messaggi: 23

Data di Iscrizione: 17 dicembre 2012

Messaggi recenti

Hi neil,

thanks for your replay.i have taken your example and it is working fine for me..there is one more problem i am facing..once login i need to regirect to my own page ..i am new to life ray..could you please guide me how to do this..i tried to hard code redirect as /web/guest which is not working...

regards
john
Neil Griffin
RE: html form values are not able to get in backing bean(JSF)
28 dicembre 2012 8.05
Risposta

Neil Griffin

LIFERAY STAFF

Punteggio: Liferay Legend

Messaggi: 1995

Data di Iscrizione: 26 luglio 2005

Messaggi recenti

In the LoginBackingBean.authenticate() method, there are some calls to externalContext.redirect(String) which you should be able to customize according to your requirements.
john john
RE: html form values are not able to get in backing bean(JSF)
7 gennaio 2013 14.31
Risposta

john john

Punteggio: New Member

Messaggi: 23

Data di Iscrizione: 17 dicembre 2012

Messaggi recenti

Hi Neil,

Thanks for your information..It's really Usefull but unfortunately i am not able to get the session.

even though the following line returns true..

PortalClassInvoker.invoke(false, LOGIN_UTIL_FQCN, LOGIN_METHOD, LOGIN_PARAM_TYPES, httpServletRequest, httpServletResponse,
"test@liferay.com", "test", rememberMe, authType);
authenticated = true;
System.out.println("i am in authenticated:authenticated" + authenticated);

However when i tried to display the logged in user information in redirect page is returning false..

the following line in my Page is returning false..

<h:outputText value="#{liferay.themeDisplay.signedIn}"/>

is there any steps to follow for maintaining the session...

Thanks in advance..
Neil Griffin
RE: html form values are not able to get in backing bean(JSF)
8 gennaio 2013 6.54
Risposta

Neil Griffin

LIFERAY STAFF

Punteggio: Liferay Legend

Messaggi: 1995

Data di Iscrizione: 26 luglio 2005

Messaggi recenti

Does the unmodified jsf2-login-portlet work for you? If so then that's good -- it would help us figure out how to fix your code. Otherwise, if it doesn't work for you, then maybe there is something different about how your servlet-container/app-server handles sessions. Are you using Liferay Portal 6.1.1-ce-ga2 and Tomcat 7?
john john
RE: html form values are not able to get in backing bean(JSF)
8 gennaio 2013 8.15
Risposta

john john

Punteggio: New Member

Messaggi: 23

Data di Iscrizione: 17 dicembre 2012

Messaggi recenti

Hi Neil,

thanks for your replay...Yes i am using the same code (6.1.1 ga2) but i have deployed in weblogic 10.3.5


Thanks in advance
Neil Griffin
RE: html form values are not able to get in backing bean(JSF)
8 gennaio 2013 8.46
Risposta

Neil Griffin

LIFERAY STAFF

Punteggio: Liferay Legend

Messaggi: 1995

Data di Iscrizione: 26 luglio 2005

Messaggi recenti

When you wrote:

Yes i am using the same code


Do you mean that you have tried the unmodified jsf2-login-portlet with weblogic 10.3.5 and it doesn't work?
john john
RE: html form values are not able to get in backing bean(JSF)
8 gennaio 2013 10.26
Risposta

john john

Punteggio: New Member

Messaggi: 23

Data di Iscrizione: 17 dicembre 2012

Messaggi recenti

Hi Neil,

I am using the same JSF Login Portlet Code from Github .

After authentication i am forwarding to a new page where i am checking weathter the user is signed or not using themedisplay.isSignedIn which is returning false.
Neil Griffin
RE: html form values are not able to get in backing bean(JSF)
8 gennaio 2013 10.55
Risposta

Neil Griffin

LIFERAY STAFF

Punteggio: Liferay Legend

Messaggi: 1995

Data di Iscrizione: 26 luglio 2005

Messaggi recenti

Does it work in WebLogic if you do not add your redirect code?
john john
RE: html form values are not able to get in backing bean(JSF)
8 gennaio 2013 12.21
Risposta

john john

Punteggio: New Member

Messaggi: 23

Data di Iscrizione: 17 dicembre 2012

Messaggi recenti

Yes am able to login .tested on the following platform

Is:windows 7

Application server:oracle weblogic 10.3.5
Neil Griffin
RE: html form values are not able to get in backing bean(JSF)
8 gennaio 2013 12.28
Risposta

Neil Griffin

LIFERAY STAFF

Punteggio: Liferay Legend

Messaggi: 1995

Data di Iscrizione: 26 luglio 2005

Messaggi recenti

OK, when you get a chance, I would recommend add your redirect code, and then deploy the portlet to Tomcat. If it works in Tomcat, then it might be a WebLogic issue that you are encountering. If it does not work in Tomcat, then it might be a bug in your redirect code.
john john
RE: html form values are not able to get in backing bean(JSF)
8 gennaio 2013 14.24
Risposta

john john

Punteggio: New Member

Messaggi: 23

Data di Iscrizione: 17 dicembre 2012

Messaggi recenti

Hi Neil,

Thanks for your replay....Even in Tomcat i am getting the same problem..

I have changed the authenticate method .the code as follows




String toViewId="";

System.out.println("i am in authenticate");
final LiferayFacesContext liferayFacesContext = LiferayFacesContext.getInstance();
final ActionRequest actionRequest = (ActionRequest) liferayFacesContext.getPortletRequest();
final ActionResponse actionResponse = (ActionResponse) liferayFacesContext.getPortletResponse();
final ThemeDisplay themeDisplay = liferayFacesContext.getThemeDisplay();
HttpServletRequest httpServletRequest = PortalUtil.getHttpServletRequest(actionRequest);

// If the request object is a wrapper that handles special namespacing considerations for portlet session
// attributes, then get the inner-most wrapped request. This will ensure that the following call to
// LoginUtil.login(...) will be able to work with a session that has an attribute map shared by the portal.
if (httpServletRequest.getClass().getName().equals(NAMESPACE_SERVLET_REQUEST_FQCN)) {

while (httpServletRequest instanceof HttpServletRequestWrapper) {
final HttpServletRequestWrapper httpServletRequestWrapper = (HttpServletRequestWrapper) httpServletRequest;
httpServletRequest = (HttpServletRequest) httpServletRequestWrapper.getRequest();
}
}

final HttpServletResponse httpServletResponse = PortalUtil.getHttpServletResponse(actionResponse);
System.out.println("hanlde"+loginModelBean.getHandle());
System.out.println("password"+loginModelBean.getPassword());

final boolean rememberMe = loginModelBean.isRememberMe();

boolean authenticated = false;
String feedbackMessageId = null;

try {
PortalClassInvoker.invoke(false, LOGIN_UTIL_FQCN, LOGIN_METHOD, LOGIN_PARAM_TYPES, httpServletRequest, httpServletResponse,
"sivasumathi1030@gmail.com", "test1", rememberMe, authType);
authenticated = true;

System.out.println("i am in authenticated:authenticated" + authenticated);
} catch (final AuthException e) {
feedbackMessageId = "authentication-failed";
} catch (final CompanyMaxUsersException e) {
feedbackMessageId = "unable-to-login-because-the-maximum-number-of-users-has-been-reached";
} catch (final CookieNotSupportedException e) {
feedbackMessageId = "authentication-failed-please-enable-browser-cookies";
} catch (final NoSuchUserException e) {
feedbackMessageId = "authentication-failed";
} catch (final PasswordExpiredException e) {
feedbackMessageId = "your-password-has-expired";
} catch (final UserEmailAddressException e) {
feedbackMessageId = "authentication-failed";
} catch (final UserLockoutException e) {
feedbackMessageId = "this-account-has-been-locked";
} catch (final UserPasswordException e) {
feedbackMessageId = "authentication-failed";
} catch (final UserScreenNameException e) {
feedbackMessageId = "authentication-failed";
} catch (final Exception e) {
logger.error(e);
}

if (authenticated) {

toViewId="Success";
} else {

if (feedbackMessageId != null) {
liferayFacesContext.addGlobalErrorMessage(feedbackMessageId);
toViewId=null;
}
}
return toViewId;
}

In FacesConfig i am redirecting toViewid to separate page where i am testing liferay.themedisplay.isSignedin which is returning false..

Thanks in Advance..
Neil Griffin
RE: html form values are not able to get in backing bean(JSF)
9 gennaio 2013 9.37
Risposta

Neil Griffin

LIFERAY STAFF

Punteggio: Liferay Legend

Messaggi: 1995

Data di Iscrizione: 26 luglio 2005

Messaggi recenti

In FacesConfig i am redirecting toViewid to separate page where i am testing liferay.themedisplay.isSignedin which is returning false..


OK, I see that you have changed the authenticate() method so that it returns a String, and I am assuming you are using a navigation-rule with a <redirect/> inside of the WEB-INF/faces-config.xml descriptor? That would be a very nice consistent JSF way of doing things, and I commend you for that approach. But it might be the case, then the redirect requirements of JSR 329 (the JCP Standard implemented by Liferay Faces Bridge) *might* be incompatible with the login use-case of Liferay Portal. Just a guess, I don't know for sure.

If you call externalContext.redirect(url) from the authenticate() method (which is what the jsf2-login-portlet demo does), then do things start working?
jon miran
RE: html form values are not able to get in backing bean(JSF)
10 aprile 2013 1.37
Risposta

jon miran

Punteggio: New Member

Messaggi: 3

Data di Iscrizione: 2 ottobre 2012

Messaggi recenti

Hi, i have the same problem .
I'am working with: Liferay-portal-6.1.1-ce-ga2 ,glassfish 3.1.2, jsf 2.13-b02 and liferay-faces-bridge-3.1.0-rc2.

I download the jsf2 login portlet and deployed it. when i press the submit button , the authenticate() method works fine but the redirect show me an exception ( bridge exception: IleagalStateException) and the page shows me that an error occurred when accessing the resource. if i do refresh for this page the same error still showing.
When i examine the resulting url, it has 1 as value of the parameter p_p_lifecycle , so i modified it to 0 in this url and do refresh, and it works.
is there a way to set this parameter to 0 when redirecting?

Please help how to get resolved this issue.
Vernon Singleton
RE: html form values are not able to get in backing bean(JSF)
10 aprile 2013 5.18
Risposta

Vernon Singleton

LIFERAY STAFF

Punteggio: Regular Member

Messaggi: 162

Data di Iscrizione: 14 gennaio 2013

Messaggi recenti

Hi Jon,

Could you post

0) the xhtml pages showing the call to redirect
1) the backing code for your redirect
2) the relavent part of your faces config.
3) the full error message you receive when your redirect fires

I will take a look at it.

- Vernon
jon miran
RE: html form values are not able to get in backing bean(JSF)
11 aprile 2013 3.07
Risposta

jon miran

Punteggio: New Member

Messaggi: 3

Data di Iscrizione: 2 ottobre 2012

Messaggi recenti

Hi Vernon,
Thanks for your reply...
I solved the problem and i think that it was an issue in the liferay-faces-*-3.1.0-rc2.
So, i download the 5 files (liferay-faces-bridge-impl-3.1.1-ga2, liferay-faces-bridge-api-3.1.1-ga2, liferay-faces-alloy-3.1.1-ga2, liferay-faces-portal-3.1.1-ga2, liferay-faces-util-3.1.1-ga2) and replace them with the old files and it works .emoticon

But there is another thing, this login portlet code need the 2 classes liferay.portal.util.PropValues and liferay.portal.util.WebKeys, which exist in the portal-impl.jar.
when i put this jar in the portlet, a new error has been shown "log4j ClassCastException: org.apache.log4j.ConsoleAppender cannot be cast to org.apache.log4j.Appender" , so i remove the portal-impl.jar, download the source code of these classes (PropValues and WebKeys) and add them to the portlet. Is there another method to fix this up?

regards
Jon
Vernon Singleton
Re: [Liferay Forums][Liferay Faces - English] RE: html form values are not
11 aprile 2013 3.55
Risposta

Vernon Singleton

LIFERAY STAFF

Punteggio: Regular Member

Messaggi: 162

Data di Iscrizione: 14 gennaio 2013

Messaggi recenti

Glad to hear that your problem got solved.

sent from a blackberry

-----Original Message-----
From: "jon miran from liferay.com" <forums@liferay.com>
Date: Thu, 11 Apr 2013 07:47:22
To: forums@liferay.com<forums@liferay.com>
Reply-To: "forums@liferay.com" <forums@liferay.com>
Subject: [Liferay Forums][Liferay Faces - English] RE: html form values are
not able to get in backing bean(JSF)



Hi Vernon,
Thanks for your replay...
I solved the problem and i think that it's an issue in the liferay-faces-*-3.1.0-rc2.
I download the 5 files (liferay-faces-bridge-impl-3.1.1-ga2, liferay-faces-bridge-api-3.1.1-ga2, liferay-faces-alloy-3.1.1-ga2, liferay-faces-portal-3.1.1-ga2, liferay-faces-util-3.1.1-ga2) and replace them with the old one and it works . emoticon <http://cdn.www.liferay.com/osb-community-theme/images/emoticons/laugh.gif>

regards

To view the thread, follow the link below:
https://www.liferay.com/community/forums/-/message_boards/view_message/23536004
--
Thanks, Liferay.com Forums <http://http://www.liferay.com>
Neil Griffin
RE: Re: [Liferay Forums][Liferay Faces - English] RE: html form values are
12 aprile 2013 9.36
Risposta

Neil Griffin

LIFERAY STAFF

Punteggio: Liferay Legend

Messaggi: 1995

Data di Iscrizione: 26 luglio 2005

Messaggi recenti

If you look at LoginBackingBean.java you will see the following imports:

1import com.liferay.portal.util.PropsValues;
2import com.liferay.portal.util.WebKeys;


You're right -- the constants needed in those classes are found in portal-impl.jar so to get around that problem the constants were copied directly into the portlet: