• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Another simple problem I am clueless about...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Another simple problem I am clueless about...


  • Subject: Another simple problem I am clueless about...
  • From: Kevin Windham <email@hidden>
  • Date: Fri, 16 Mar 2007 16:23:36 -0500

I have a User object with an email() method. This is the standard boilerplate generated by EOModeler from my User table.

public String email() {
        return (String)storedValueForKey("email");
}

I have a registration page with a field on the page bound to user.email and a method called fieldsValidate(). When I get to the line ckEmail = user.email(); I get a null pointer exception. user.email() is returning null. I am not sure why? The registerNewUser method works fine if I take out the fieldsValidate(). Can someone hit me with the clue-by-4.

Thanks,
Kevin

public class MyAccount_ActivateNewAccount extends WOComponent {
public User user;
public String confirmPassword;
public Boolean error;
protected String ckEmail,ckFirstName,ckLastName,ckaddress1,ckCity,ckState,ckZip;


public MyAccount_ActivateNewAccount(WOContext context) {
super(context);
user = new User();
}

public Boolean fieldsValidate()
{
String highlight = "background: yellow;";
ckEmail = user.email();
if (ckEmail.equals("")) {
ckEmail = highlight;
} else { ckEmail = ""; }

if ((ckEmail+ckFirstName+ckLastName+ckaddress1+ckCity+ckState +ckZip).equals("")) {
return true;
}
else {
return false;
}

}

public WOComponent registerNewUser()
{
if (fieldsValidate()) {
EOEditingContext ec = session().defaultEditingContext();
NSMutableArray arguments = new NSMutableArray();
arguments.addObject(user.email());
EOQualifier qualifier = EOQualifier.qualifierWithQualifierFormat ("email = %@", arguments);
EOFetchSpecification fetchSpec = new EOFetchSpecification ("User",qualifier,null);
NSArray results = new NSArray(ec.objectsWithFetchSpecification (fetchSpec));
if (results.count() == 0) {
ec.insertObject(user);
ec.saveChanges();
}
else {
return null;
}

MyAccount_RegistrationConfirmation nextPage = (MyAccount_RegistrationConfirmation)pageWithName ("MyAccount_RegistrationConfirmation");


			// Initialize your component here
			nextPage.userID = user.email();
			nextPage.password = user.password();

			return nextPage;
		}
		else {
			return null;
		}
    }
	

}

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Another simple problem I am clueless about...
      • From: Chuck Hill <email@hidden>
    • Re: Another simple problem I am clueless about...
      • From: Ray Kiddy <email@hidden>
  • Prev by Date: Re: update object in Object Store
  • Next by Date: [Solved, Semi] Display Group Component Editing Issue
  • Previous by thread: Re: update object in Object Store
  • Next by thread: Re: Another simple problem I am clueless about...
  • Index(es):
    • Date
    • Thread