Could someone guide me in the right direction here?
Here is the code for a component that I have:
public class CompanyInfo extends BaseComponent {
private Users user = new Users();
private Company company = new Company();
private boolean dispayLogo = false;
/**
* @return Returns the company.
*/
public Company getCompany() {
Visit visit = (Visit) getPage().getVisit();
return (visit.getCurrentCompany());
}
/**
* @param company The company to set.
*/
public void setCompany(Company company) {
this.company = company;
}
/**
* @return Returns the user.
*/
public Users getUser() {
Visit visit = (Visit) getPage().getVisit();
Users u = visit.getUsers();
return u;
}
/**
* @param user The user to set.
*/
public void setUser(Users user) {
this.user = user;
}
...../
}
When I log in with two different browsers on different machines I get
the following exception:
Unable to resolve expression 'company.name' for
[EMAIL PROTECTED]/compInfo].
binding: ExpressionBinding[CompanyProfile/compInfo company.name]
location: context:/WEB-INF/CompanyInfo.html, line 12
ognl.OgnlException
source is null for getProperty(null, "name")
Users() and Company() are my persistant Hibernate Classes. What is the
best way to do this? Basically this component shows information about
the current company that the user belongs to. I have stored the Users()
in the Visit and want to pull up this information.
Thanks.
~chris
On Tue, 12 Jul 2005 11:00:31 -0500, "Joel Trunick"
<[EMAIL PROTECTED]> said:
>
> It's caused because the page is cached. It still has the old "Users"
> object with the values filled in the first time. Something like the
> following will fix (I personally user a getter with lazy initialization,
> and initialize users to null):
>
> public void initialize() {
> Users users = new Users();
> }
>
> Joel
>
> -----Original Message-----
> From: Java Leech [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 12, 2005 9:25 AM
> To: [email protected]
> Subject: Newbie with Thread Issues
>
> I have posted this on the forum but it seems there is not to much action
> there. So I'll try the mailing list.
>
> I'm not sure what I am doing wrong but I seem to be having some serious
> thread problems. I have been developing an app for about a week and
> today was the first time I brought up a browser on another machine to my
> webapp. I knew something was wrong immediatly when my login form was
> autofilled with the values that I used in the first browser.
>
> After trying to log in got a bunch of null value exceptions and can't
> ever log back in with out restarting jboss. I am using Hibernate3 and
> Tapestry 3.03 running on jboss.
>
> Here is a code snippet from my login component:
>
> public abstract class NavLogin extends BaseComponent implements IForm{
>
> private ICallback callback;
> private Users users = new Users();
>
> public void setCallback(ICallback callback) {
> this.callback = callback;
> }
>
> public void formSubmit(IRequestCycle cycle){
> //Form Validation
> ValidationDelegate delegate =
> (ValidationDelegate)getBeans().getBean("delegate");
>
> //If no errors add the user
> if(!delegate.getHasErrors()){
> System.err.println("Users: "+ getUsers().getEmail() +
> " Logging in with password: "+
> HashUtils.md5Sum(getUsers().getPassword()));
> Users authUser = authenticate();
> if(authUser != null){
> Visit visit = (Visit) getPage().getVisit();
> visit.setUsers(authUser);
>
> if(authUser.getRole().getType().equalsIgnoreCase("provider")){
> cycle.activate("CompanyProfile");
> }
> }
> }
> }
> /**
> * Authenticate the user attempting to log in
> * @return
> */
> public Users authenticate(){
> UserDAO dao = new UserDAO();
> Users aUser = dao.authUser(getUsers().getEmail(),
> HashUtils.md5Sum(getUsers().getPassword()));
> return(aUser);
> }
>
> --
> http://www.fastmail.fm - The professional email service
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
--
http://www.fastmail.fm - And now for something completely differentÂ…
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]