• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP and Java Bean

 
Hets Mehta
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a java bean and code looks like this
public class userbean
{
private userid;
public void setUserID( String id )
{
userid = id;
System.out.println("|"+userid.trim()+"|");
}

public String getUserID()
{
System.out.println("in get method: "+ userid);
return userid;
}
}
when I try to get value from bean userid is always returned null although in setmethod it shows that it has set the user ID. Does anyone know why this happens?
 
Ron Newman
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's nothing wrong with the bean. Show us the code that calls it.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And please be sure to use the UBB code tags so that the formatting of your code is preserved.
bear
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!