File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Java Beans Issue Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Java Beans Issue" Watch "Java Beans Issue" New topic
Author

Java Beans Issue

Luke Shannon
Ranch Hand

Joined: Sep 30, 2004
Posts: 239
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
SCJP
Luke Shannon
Ranch Hand

Joined: Sep 30, 2004
Posts: 239
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...
 
I agree. Here's the link: jrebel
 
subject: Java Beans Issue
 
Similar Threads
jsp/bean/tomcat
What is good practice for FORM VALIDATION ?
error occuring while use jsp
uable to execute jsps
Java bean error message