Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Beans Issue  RSS feed

 
Luke Shannon
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a java bean I am using the complete a form. Here is an example of one of one of the form elements being completed:

<input type="text" size="25" name="email" value="<jsp:getProperty name="contactData" property="email"/>">

In the bean I have the following member variable:

private String email = "";

And the following methods:

public void setEmail (String email) {
this.email = email;
}
public String getEmail() {
return email;
}

A servlet sets all the variables for the bean and than passed it through the Servlet Context to the JSP page. Using the useBean tag I get a reference to it.
This works great. The weird thing is there are two properties that return a blank even though they should have some value.

Example:
Here is what I have got on the page (one of the two problematic values):

<textarea rows="3" style="width: 500;" name="tagLine"><jsp:getProperty name="contactData" property="tagLine"/>

Here is the variable from the Bean Class:
private String tagLine = "";

Here are the methods:
public void setTagLine (String tagLine) {
this.tagLine = tagLine;
}
public String getTagLine() {
return tagLine;
}

It is being set like the other properties. Why does it not produce the correct value when I call the getProperty?

Thanks,

Luke
 
Luke Shannon
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never mind I figured this out. There was a bad SQL call in the line right before these two properties were set. Not sure why it never threw an SQLException...
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!