Here are my two beans:
Profile:
package proto;
import java.util.*;
import java.sql.*;
public class Profile {
private String account;
public Profile() {
super();
}
public Profile ( String account ) {
super();
}
public void setAccount(String account){
this.account = account;
}
public String getAccount() {
return this.account;
}
public Address loadAddresses(String account) {
Address addr = new Address();
addr.setAccount(account);
return addr;
}
}
Address:
package proto;
import java.util.*;
import java.sql.*;
public class Address {
private String city;
private String account;
public Address() {
super();
this.city = null;
this.account = null;
}
public Address(
String account,
String city ) {
this.account = account;
this.city = city;
}
public Address(String account) {
this.setAccount(account);
}
public java.lang.String getAccount() {
return account;
}
public void setAccount(java.lang.String newAccount) {
account = newAccount;
}
public java.lang.String getCity() {
return city;
}
public void setCity(java.lang.String newCity) {
city = newCity;
}
}
Thanks for any help
Toby Piper wrote:
> get/set work fine for me.
>
> If I take your code/notes literally then you are outputting the JSP tags instead
> of actually executing them. However if this is your actual code then it looks
> Ok.
>
> You might try putting the useBean tag before any HTML tags - however I don't
> think that's supposed to matter, but it's where mine are and they work there.
>
> I suspect the problem is with your JAVA code itself. We need to look at your
> java code to see if you are calling it properly from the JSP. So please post an
> example of your code.
>
> > -----Original Message-----
> > From: Dan Lovell [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, November 06, 2000 7:52 AM
> > To: [EMAIL PROTECTED]
> > Subject: JSP getProperty issue - does not return data
> >
> >
> > Is anyone having trouble using the JSP tags for set and get property.
> > They do not seem to work. I am using Tomcat 3.1 on Win NT.
> >
> > <td><%= addrsProfile.getCity() %> </td> ******** works **********
> > <td><jsp:getProperty name="addrsProfile" property="city"/> </td> ****
> > does not work *****
> >
> > Here is my JSP page:
> >
> > <%@ page contentType="text/html;charset=WINDOWS-1252"%>
> > <HTML>
> > <HEAD>
> > <META HTTP-EQUIV="Content-Type" CONTENT="text/html;
> > charset=WINDOWS-1252">
> > <META NAME="GENERATOR" CONTENT="Oracle JDeveloper">
> > <TITLE>
> > JSP Issue - Get Property
> > </TITLE>
> > </HEAD>
> > <BODY>
> > <H2>The following output is from JSP code:</H2>
> >
> > <jsp:useBean id="profile" class="proto.Profile">
> > <jsp:setProperty name="profile" property="account" value = "18190" />
> >
> > </jsp:useBean>
> >
> > <jsp:useBean id="addrsProfile" class="proto.Address">
> > </jsp:useBean>
> >
> > <%
> > proto.Address addrs = profile.loadAddresses("18190");
> > addrsProfile = addrs;
> > %>
> >
> > <table>
> > <tr><th colspan="2"> Address Information for Client </th></tr>
> > <tr><td>City 1</td><td>City 2</td>
> > <tr>
> > <td><%= addrsProfile.getCity() %> </td>
> > <td><jsp:getProperty name="addrsProfile" property="city"/> </td>
> > </tr>
> > </table>
> >
> > </HTML>
> >
> > Any help would be great.
> > Thanks
> >
> >