Try using the jsp:setProperty and the jsp:getProperty tags instead of the jsp:setBean & jsp:getBean tags. Have a nice day. With regards, Sachin S. Khanna. www.emailanorder.com ----- Original Message ----- From: liuhao <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, April 12, 2000 9:38 AM Subject: jsp and javaBean > hi everyone: > i meet the problem about the javabean which is called by a jsp. > the code of jsp file is : > <%@ page import= "HiBean" %> > <jsp:useBean id="hello" class="HiBean" scope="page" /> > <jsp:setBean name="hello" property="name" value="world" /> > <html> <body> > <h1> Hello <jsp:getBean name="hello" property="name" />!</h1> > </body> </html> > > the code of javabean is : > public class HiBean { > private String name=null; > public void setname(String name){ > this.name=name; > } > public String getName(){ > return name; > } > } > i hope to get "Hello world!"on my browser.but i failed. where is wrong of my > code? please point it out. > more, the "NullPointerException" exception is not thrown as the reference of > jsp1.1even if i use <jsp:getProperty>to retrieve a property value that is > null. in this sample,i modify the jsp as following with the same javabean: > <%@ page import= "HiBean" %> > <jsp:useBean id="hello" class="HiBean" scope="page" /> > <html> <body> > <h1> Hello <jsp:getBean name="hello" property="name" />!</h1> > </body> </html> > it works! and the result is "Hello!". i usejdk1.1.7 and websphere3.05. > please give me some advice > > =========================================================================== > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". > Some relevant FAQs on JSP/Servlets can be found at: > > http://java.sun.com/products/jsp/faq.html > http://www.esperanto.org.nz/jsp/jspfaq.html > http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP > http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets > =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to