OK, I reconstructed it:

in model: class Person:

"package be.mnemonica.model;

import java.util.Date;
import java.util.Set;

import org.apache.log4j.Logger;

/**
* Class representing a Person in the system.
* @author philippe
*
*/
public class Person {
        
        /**
         * The logger declaration for this Class:
         */
        private Logger logger = Logger.getLogger("be.mnemonica.model.Person");
        /**
         * First Name of a Person
         */
        String firstName;
        /**
         * Last Name of a Person
         */
        String lastName;
        /**
* The Login Name of this Person (The Person is known as such by the System)
         */
        String loginName;
        /**
         * The password of the user
         */
        String password;
        /**
         * Telephone Number of a Person
         */
        String Tel;
        /**
         * Email address of a Person
         */
        String email;
        /**
         * Birthday of a Person
         */
        Date birthday;
        /**
         * The set of rolls a Person has in the Company
         */
        Set<Roll> rolls;
        /**
* Apart from the set of rolls a Person assumes in the Company, a Person can occasionally (mostly temporarily) inherit rolls from
         * other people who are e.g. on sick leave or on a holiday.
         */
        Set<Roll> inheritedRolls;
        
        /**
         * The Departments a Person belongs to.
         */
        Set<String> deptNames;
        
        public Person() {
                new Person("","");
                
        }
        /**
         * The user constructed from his Loginname and Password.
         * @param login The login of the User, known by the system.
         * @param passw The password of the User, known by the system.
         */
        public Person(String login, String passw){
                this.loginName = login;
                this.password = passw;
        }
        
        /**
         * @return Returns the birthday.
         */
        public Date getBirthday() {
                return birthday;
        }

        /**
         * @param birthday The birthday to set.
         */
        public void setBirthday(Date birthday) {
                this.birthday = birthday;
        }

        /**
         * @return Returns the email.
         */
        public String getEmail() {
                return email;
        }

        /**
         * @param email The email to set.
         */
        public void setEmail(String email) {
                this.email = email;
        }

        /**
         * @return Returns the firstName.
         */
        public String getFirstName() {
                return firstName;
        }

        /**
         * @param firstName The firstName to set.
         */
        public void setFirstName(String firstName) {
                this.firstName = firstName;
        }

        /**
         * @return Returns the inheritedRolls.
         */
        public Set<Roll> getInheritedRolls() {
                return inheritedRolls;
        }

        /**
         * @param inheritedRolls The inheritedRolls to set.
         */
        public void setInheritedRolls(Set<Roll> inheritedRolls) {
                this.inheritedRolls = inheritedRolls;
        }

        /**
         * @return Returns the lastName.
         */
        public String getLastName() {
                return lastName;
        }

        /**
         * @param lastName The lastName to set.
         */
        public void setLastName(String lastName) {
                this.lastName = lastName;
        }

        /**
         * @return Returns the rolls.
         */
        public Set<Roll> getRolls() {
                return rolls;
        }

        /**
         * @param rolls The rolls to set.
         */
        public void setRolls(Set<Roll> rolls) {
                this.rolls = rolls;
        }

        /**
         * @return Returns the tel.
         */
        public String getTel() {
                return Tel;
        }

        /**
         * @param tel The tel to set.
         */
        public void setTel(String tel) {
                Tel = tel;
        }

        /**
         * @return Returns the deptNames this Person belongs to.
         */
        public Set<String> getDeptNames() {
                return deptNames;
        }

        /**
         * @param deptNames Sets the deptNames this Person belongs to.
         */
        public void setDeptNames(Set<String> deptNames) {
                this.deptNames = deptNames;
        }

        /**
         * @return Returns the loginName.of this Person.
         */
        public String getLoginName() {
                return loginName;
        }

        /**
         * @param loginName The loginName to set for this Person.
         */
        public void setLoginName(String loginName) {
logger.error("We passed through Person - setLogin met deze loginnaam: " + loginName);
                this.loginName = loginName;
        }

        /**
         * @return Returns the password.
         */
        public String getPassword() {
                return password;
        }

        /**
         * @param password The password to set.
         */
        public void setPassword(String password) {
                this.password = password;
        }

}"

Then in web.beans: LoginBean.java:
"package be.mnemonica.web.beans;

import org.apache.log4j.Logger;

import be.mnemonica.model.Person;
import be.mnemonica.controller.AppManager;

/**
* @author philippe
* Bean used for the Login page page of the Application.
* (check the login credentials)
*/
public class LoginBean Person{


        /**
         * The logger declaration for this Class:
         */
private Logger logger = Logger.getLogger ("be.mnemonica.web.beans.LoginBean");
        /**
         * The User currently logged in (or trying to log in)
         */
        private Person user;    
        /**
         * The central Application dispatcher
         */
        private AppManager appMgr;
        
        /**
         * Default constructor (Spring)
         */
        public LoginBean() {
                this.appMgr = new AppManager();
                Person user = new Person("","");
        }
        
        public String login(){
                String loginResult = "";      // security default
logger.info("User "+ getLoginName() +" tries to log in with this password: "+ getPassword());
                loginResult = getAppMgr().verifyLogin(getLoginName(), 
getPassword());
                logger.error("Loginresult was: "+loginResult);
                return loginResult;
        }

        /**
         * @return Returns the user.
         */
        public Person getUser() {
                return user;
        }

        /**
         * @param user The user to set.
         */
        public void setUser(Person user) {
                this.user = user;
        }

        /**
         * @return Returns the appMgr.
         */
        public AppManager getAppMgr() {
                return appMgr;
        }

        /**
         * @param appMgr The appMgr to set.
         */
        public void setAppMgr(AppManager appMgr) {
                this.appMgr = appMgr;
        }
        
        
}"

The method "login()" is never even entered.

The loginPage.jsp:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<jsp:root    xmlns:jsp="http://java.sun.com/JSP/Page"; version="2.0"
                        xmlns="http://www.w3.org/1999/xhtml";  
                        xmlns:f= "http://java.sun.com/jsf/core";
                        xmlns:h="http://java.sun.com/jsf/html"; >
                        <!-- Btw this declares html as the default namespace -->

<jsp:directive.page contentType="text/html;charset=utf-8"/>
<html>
        <head>
        </head>

<body topmargin="0" leftmargin="0" rightmargin="0" bgcolor="#ffffff" marginheight="0" marginwidth="0" class="body">

        <f:view>
<f:loadBundle basename="be.mnemonica.web.conf.mnemonica" var="labels" />

        <f:subview id="header">
                <jsp:include page="./header.jsp" />
        </f:subview>
        
        
        
        <h:form id="loginForm" >
        
<table align="center" border="0" cellpadding="0" cellspacing="0" width="646" style="vertical-align:middle;">
        <tbody>
        <tr>
                <td colspan="4" height="10"></td>
        </tr>

        <tr>
                <td width="112"></td>
<td align="left" valign="bottom"><img src="../pics/login/ globe_top.gif" alt="" border="0" height="31" width="213" /></td>
                <td width="220"></td>
                <td width="72"></td>
        </tr>
        
        <tr>
<td align="right" background="../pics/login/frameleft.gif" valign="top" width="112"><img src="../pics/login/frame_upleft.gif" alt="" border="0" height="10" width="112" /></td> <td align="left" background="../pics/login/frame_topbg.gif" valign="top"><img src="../pics/login/globe_mid.gif" alt="" border="0" height="10" width="213" /></td> <td valign="top" background="../pics/login/frame_topbg.gif"><img src="../pics/login/frame_top.gif" alt="" border="0" height="10" width="209" /></td> <td align="left" background="../pics/login/frameright.gif" valign="top" width="112"><img src="../pics/login/frame_upright.gif" alt="" border="0" height="10" width="72" /></td>
        </tr>

        <tr>
<td align="right" background="../pics/login/frameleft.gif" valign="top" width="112"><img src="../pics/login/frameleft.gif" alt="" border="0" height="175" width="112" /></td> <td align="left" valign="top"><img src="../pics/login/ globe_bot.gif" alt="Mnemonica" border="0" height="175" width="213" / ></td>
                <td align="center" valign="middle">
        
                        
<table border="0" cellpadding="0" cellspacing="0" height="25" width="200">
                                <tbody>
                                        <tr>
<td height="1"><img src="../pics/login/spacer.gif" alt="" border="0" height="1" width="1" /></td> <td height="1"><img src="../pics/login/spacer.gif" alt="" border="0" height="1" width="1" /></td>
                                        </tr>                     
                                </tbody>
                        </table>          
                
                        <table border="0" cellpadding="0" cellspacing="0">
                                <tbody>
                                        <tr>
<td height="15"><img src="../pics/login/spacer.gif" alt="" border="0" height="15" width="1" />
                                                </td>
                                        </tr>
                                        <tr>
                                                <td align="left">
                                                        <h:outputText 
value="#{labels.login_name}" />
                                                         <br/>    
<h:inputText required="true" size="20" value="# {loginbean.user.loginName}" id="username" />
                                                        <h:message 
for="username"/>
                                                </td>
                                        </tr>
                                        <tr>
<td height="8"><img src="../pics/login/spacer.gif" alt="" border="0" height="8" width="1" /></td>
                                        </tr>
                        
                                        <tr>
                                                <td align="left">
                                                        <h:outputText 
value="#{labels.login_password}" />
                                                        <br/>
<h:inputSecret required="true" size="20" value="# {loginbean.user.password}" id="password" />
                                                        <h:message 
for="password"/>
                                                </td>
                                        </tr>
                                        
                                        <tr>
<td height="8"><img src="../pics/login/spacer.gif" alt="" border="0" height="8" width="1" />
                                                </td>
                                        </tr>
                                        <tr>
                                                <td align="right" height="10">
                                                <h:commandLink action="#{loginbean.login}" 
id="commandoknop" >
<h:graphicImage url="../pics/login/btn_enter_1.gif" style="border:none" />
                                                </h:commandLink>
                                                <h:message for="commandoknop"/>
                                                </td>
                                        </tr>
                                        <tr><td> &#160;</td></tr>
                                        <tr>
<td class="body" align="right" style="text-decoration: underline; color: black;" > <h:outputLink value="mailto:[EMAIL PROTECTED]" id="outputLink" title="#{labels.login_mailAdmin }" > <f:param name="subject" value="I&#160;Forgot&#160;My&#160;Mnemonica&#160;password" /> <f:param name="body" value="Could&#160;you&#160;please&#160;take&#160;appropriate&#160;action " /> <h:outputText value="#{labels.login_forgotPassword}" id="outputTekst" style="font-family:verdana;font-style:italic;font-size: 8pt;text-decoration:none;color: black;">
                                                                </h:outputText>
                                                        </h:outputLink>
                                                </td>
                                        </tr>                     
                                </tbody>
                        </table>

                </td>
                
<td align="left" background="../pics/login/frameright.gif" valign="top" width="72"> <a onfocus="" ><img src="../pics/login/lock.gif" border="0" height="17" width="72" /></a> <br/><img src="../pics/login/frameright.gif" alt="" border="0" height="158" width="72" />
                        </td>
                </tr>

        <tr>
<td align="right" background="../pics/login/frameleft.gif" valign="bottom" width="112"> <img src="../pics/login/frame_botleft.gif" alt="" border="0" height="136" width="112" />
                </td>
        
                <td colspan="2" align="center" valign="middle">     

                        <table border="0" cellpadding="0" cellspacing="0">
                                <tbody>
                                        <tr>
                                                <td></td>
                                        </tr>             
                                        <tr>
                                                <td align="left">
<img src="../pics/login/frame_hr.gif" alt="" border="0" height="13" vspace="8" width="412" /><br/>
                                                </td>
                                        </tr>
                                        <tr align ="center">
<td style="background-image:url('../pics/metal.jpg');" id="titelHouder">
                                                <h:outputText 
value="#{labels.login_systemTitle}" />
                                                </td>
                                        </tr>
                                </tbody>
                        </table>
                                        
                </td>

<td align="left" background="../pics/login/frameright.gif" valign="bottom" width="112"> <img src="../pics/login/frame_botright.gif" alt="" border="0" height="136" width="72" />
                </td>
                </tr>
        </tbody>
</table>
        <h:messages />
        </h:form>         
                
        <f:subview id="footer" >
                <jsp:include page="./footer.jsp" />
        </f:subview>
                
        </f:view>
        </body>
</html>
        
</jsp:root>"

 & To finish, the relevant faces-config extraits:

<navigation-rule>
                
<from-view-id>/WEB-INF/resources/pages/loginPage.jsp</from-view-id>
                <navigation-case>
                        <from-outcome>gekend</from-outcome>
                        
<to-view-id>/WEB-INF/resources/pages/portal.jsp</to-view-id>
                </navigation-case>
</navigation-rule>
...
 &
...
<managed-bean>
                <managed-bean-name>loginbean</managed-bean-name>
<managed-bean-class>be.mnemonica.web.beans.LoginBean</managed-bean- class>
                <managed-bean-scope>session</managed-bean-scope>
</managed-bean>
...

Sorry for the long post, at least now you have it all.
Philippe
_______________


On 06 Feb 2006, at 13:54, Volker Weber wrote:


Again: please post the full stacktrace and your relevant code, we can
just guess without having more info.

Philippe Lamote wrote:
Thought of this possibility too.
That's why I added to the bean constructor the newt line:
Person loginPerson = new Person("",""); // Dummy init for loginName
& password
This ensured that not only Person was != null, but also the 2 fields
used of Person, on the page. (made a construtor just for this purpose)

This had no effect however.
Philippe

On 06 Feb 2006, at 13:24, Jana Parvanova wrote:

I had a similar problem - error in conversion for expressions like:

"bean.property1....propertyN.value"

when any property in the chain property1....propertyN was null;

Can you check that your getLoginPerson method returns always != null?

----- Original Message ----- From: "Philippe Lamote" <[EMAIL PROTECTED]>
To: "MyFaces Discussion" <[email protected]>
Sent: Monday, February 06, 2006 1:01 PM
Subject: Re: Variable Resolver


Yes I did...
I'll reconstruct the code, for the moment I have bypassed the prob
by  having LoginBean extend Person. :-(
Originally loginPerson(the field itself) itself was private, made  it
public just in case, but that didn't change anything.
I have also googled for this (perhaps with the wrong terms, like
"JSF  and recursive variable resolving") but that didn't came up
with  much. :-)
What I don't know is whether the Variabe Resolver was specified to
also resolve in that fashion in the first place.
What I also tried was to make the model.Person class a (managed)
bean  to see whether that would make a diff, but it didn't.
Philippe
On 06 Feb 2006, at 11:49, Volker Weber wrote:
Hi Philippe,
did you have public getter and setter for Person in loginBean?
the expression #{loginbean.loginPerson.lastName} is resoved to
"loginbean.getLoginPerson().getLastName()"
where loginBean is the object from session scope.
otherwise please post the stacktrace and more of your relevant code.
Regards,
  Volker
Philippe Lamote wrote:

Hi,

I have a Variable Resolver question.
To set the scene first:

Trying to follow good practice, I build up my model classes in
"XXX.model.modelClass". e.g. "XXX.model.Person"
For the front end, there's a package "XXX.web.beans" e.g.
"XXX.web.beans.LoginBean"

& In that LoginBean I had a field declared:
"Person loginPerson;"

--> In the JSF page I obviously tried:
Login: #{loginbean.loginPerson.lastName}  (I declared "loginbean"
properly in the faces-config, session scope)

Yet this continues to give me errors. (of type conversion/validation
"while updating model")

Which made me wonder whether the Variable Resolver was made for this
sort of schemas after all?
If not that would be a pitty I think.

I made it work by having LoginBean extend Person but qua design  I
think
this is much less elegant.
(but still way better than copy all fields again in front-end
classes  -
why make a model then?!)

Philippe


--
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.



--
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.

Reply via email to