tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Cantrell" <Mike.Cantr...@ind.alcatel.com>
Subject c:set can't set JavaBean property
Date Tue, 17 Dec 2002 18:38:48 GMT
I'm seeing some really strange problems while trying to use JSTL's 
<c:set> action to set a property of a JavaBean. It's throwing a 
NullPointerException (see below for stackTrace).

It doesn't like to set my property "day". If I create a setter method 
with a different name (day2 for instance), which simply calls the 
original setter method (day), everything works fine (code included below).

I'm a bit stumped. Maybe I'm missing something obvious here but I'm just 
not seeing what the problem is. Can anyone offer any advice?


JSP:
===============================

<jsp:useBean class="com.alcatel.date.AlaDate" id="start" scope="request"/>
<jsp:useBean class="com.alcatel.date.AlaDate" id="end" scope="request"/>

<c:choose>
  <c:when test="${param.mode eq 'month'}">
   <c:set target="${start}" property="deltaMonth" value="-1"/>
   <%-- <c:set target="${start}" property="day" value="1"/>  --%>
   <c:set target="${start}" property="day2" value="1"/>

   <c:set target="${end}" property="deltaMonth" value="-1"/>
   <%-- <c:set target="${end}" property="day" value="31"/> --%>
   <c:set target="${end}" property="day2" value="31"/>
  </c:when>
  <c:otherwise>
   <c:set target="${start}" property="deltaDay" value="-7"/>
  </c:otherwise>
</c:choose>





JavaBean:
===============================

   public void setDay(int day) {
     GregorianCalendar cal = new GregorianCalendar();
     cal.setTime(date);

     int max = cal.getMaximum(Calendar.DAY_OF_MONTH);
     day = (day > max) ? max : day;

     cal.set(Calendar.DAY_OF_MONTH, day);
     date = cal.getTime();
   }

   public void setDay2(int day) {
     this.setDay(day);
   }



Exception:
===============================
java.lang.NullPointerException
	at 
org.apache.taglibs.standard.tag.common.core.SetSupport.doEndTag(SetSupport.java:172)
	at 
jrun__push__caseSummary2ejsp15._jspService(jrun__push__caseSummary2ejsp15.java:188)
	at jrun.jsp.runtime.HttpJSPServlet.service(HttpJSPServlet.java:43)
	at jrun.jsp.JSPServlet.service(JSPServlet.java:106)
	at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
	at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
	at 
jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:241)
	at 
jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:527)
	at 
jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:198)
	at 
jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:348)
	at 
jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:451)
	at 
jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:294)
	at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)



--
To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-user-help@jakarta.apache.org>


Mime
View raw message