This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I've been programming jsp's for a few months now. So far I have programmed in the Model 0 pattern ;)
But after constantly being yelled at by article after article I decided to take small step away from Model 0 and try to make a bean. So I created my class...
I did an out.print(myPackage.getPO()); ect, for all my fields. That is how I found out their values. Why would the last string be a 0 and not a null, and why wouldn't they be taking to the bean? Any ideas?
PS. I'm new here. Please be nice ;) [ November 20, 2007: Message edited by: Bear Bibeault ]
You didn't mention what your bean has to do with your form.
While you're trying to take steps in the right direction, an important one to take -- and now is a really good time - is to stop submitting data to JSPs. Submit to a servlet that performs any data processing. [ November 19, 2007: Message edited by: Bear Bibeault ]
I just need it to redirect to the correct page based on the search combination that was used. I'd like to start using servlets but I'm just trying to get one thing working at a time. The problem isn't on my resulting JSP. The problem is with the form info being picked up by the bean. Why isn't that happening??
If you google for "Java Ben Specification" you can find all the particulars.
In a nutshell, bean properties start with a lower case letter and are camel syntax. Examples: firstName, lastName, socialSecurityNumber, etc..
The mutators and accessors should use the standard get/set syntax. Examples: getFirstName, getLastName, getSocialSecurityNumber
So, if your form param is "myParameter", the JSP engine will try to match it to a method in your bean named "setMyParameter".
Two letter variable names can get tricky (Like 'PO') so I tend to avoid them.
Joined: Nov 19, 2007
Ok. So I'm still having trouble with this. I've tried so many different ways of doing this but it just won't pick up my purchaseOrder in the bean. I have two different values that have some mixed cases. The first one is purchaseOrder, the other one is custName. custName works fine. I get no errors and the data displays just perfect. So I've modeled purchaseOrder after that but it still can't find it. I'll keep playing with it, but I'm out of fresh ideas as to why it won't see it...