Try using the same property name as your javabean does, that is:
<jsp:setProperty id="time" property="Hours" value="17" />,

because both java and JSP are case sensitive.
By the way, don't forget to use '/' to end setPropertity tag.

Alvin

----- Original Message -----
From: "Robuschi (Delfi)" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, September 22, 2000 11:09 AM
Subject: The JavaBean doesn't run...


> Hello everybody!!!!!! First of all, have a nice Weekend to everybody!!!!!!
>
> I have a problem in my friday afternoon: I'm tryin to set a property of a
> Javabean via JSP using the jsp:setproperty directive but it doesn't run.
>
> I think it should work but it isn't. Also trying a jsp:getProperty
directive
> returns a null pointer exception (error 500).
>
> Can anybody help me????? Thanks very much to everybody!!!!!!!!!!!!
>
> Here's the listing:
>
> file CurrentTimeBean.java
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> public class CurrentTimeBean {
>   private int Hours;
>
>   public CurrentTimeBean()
>   {    this.Hours = 0;  }
>
>   public void setHours(int value)
>   {    this.Hours = value;  }
>
>   public int getHours()
>   {    return Hours;  }
> }
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>
> file prova4.jsp
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> <jsp:usebean id="time" class="CurrentTimeBean" />
> <jsp:setProperty id="time" property="hours" value="17">
> <html>
> <body>
> It is now
> <%= time.getHours() %>
> o'clock
> </body>
> </html>
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>
> ERROR IN BROWSER:
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> Error: 500
> Location: /examples/time.jsp
> Internal Servlet Error:
>
> org.apache.jasper.JasperException: setProperty: Mandatory attribute name
> missing
>  at org.apache.jasper.compiler.JspUtil.checkAttributes(JspUtil.java:202)
>  at org.apache.jasper.compiler.Parser$SetProperty.accept(Parser.java:720)
>  at org.apache.jasper.compiler.Parser.parse(Parser.java:1073)
>  at org.apache.jasper.compiler.Parser.parse(Parser.java:1038)
>  at org.apache.jasper.compiler.Parser.parse(Parser.java:1034)
>  at org.apache.jasper.compiler.Compiler.compile(Compiler.java:182)
>  at org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413)
>  at
>
org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspSe
> rvlet.java:149)
>  at
>
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja
> va:161)
>  at
org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
>  at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>  at
>
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
>  at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
>  at
>
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
> (Ajp12ConnectionHandler.java:156)
>  at
>
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338
> )
>  at java.lang.Thread.run(Unknown Source)
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>
> Robuschi Roberto -------------------- Delfi srl
> P.za Ravenet 1/b - 43100 PARMA
> Tel. 0521/932411 Fax 0521/989045
> [EMAIL PROTECTED] --- http://www.delfi.it
>
>
===========================================================================
> 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