• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java Beans Issue

 
Ranch Hand
Posts: 240
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 240
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic