This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSP and the fly likes getting null values, when displaying values using usebean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "getting null values, when displaying values using usebean" Watch "getting null values, when displaying values using usebean" New topic
Author

getting null values, when displaying values using usebean

Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 998
    
    2
why i m getting null values.??
Here is my code:
index.jsp


BeanClass.java


setBean.jsp

getBean.jsp
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1018
You need to match up the names of the input fields/parameters to the names of the attributes in your bean.

e.g. your textfield for name is currently called "txt_name"
This will look for the method setTxt_name() in your bean which doesn't exist.

I would suggest:


I also note that contact is an int in your bean.
You are submitting contact from a textfield, which means there possibly needs to be validation/conversion on that field to turn it into an int. What happens if the user doesn't provide a valid number?

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getting null values, when displaying values using usebean