c:set can't set JavaBean property
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:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: CLOBS and the EL
Thanks so much! This is just a one-time project thing; no real necessity for portability. I ended up doing this code inside ResultImpl.java, and it worked perfectly. Thank you again, James - Original Message - From: Mike Cantrell [EMAIL PROTECTED] To: Tag Libraries Users List [EMAIL PROTECTED] Sent: Tuesday, December 17, 2002 11:52 AM Subject: Re: CLOBS and the EL The JSTL sql tag simply saves the ResultSet's .getObject() method and when you iterate through the rows, c:out calls the object's .toString() method. Oracle's implementation of the Clob object does not override the Object's .toString() method to produce the field's value. You must do something like: /** * Returns the Clob object as a String Object */ public static String clobToString(Object clob) throws SQLException { if (clob != null clob instanceof Clob) { long length = ((Clob)clob).length(); return ((Clob)clob).getSubString(1, (int)length); } else { return null; } } I don't think it would be very portable to do this inside the JSTL code. Just my ++cents James Smith wrote: Hello. I'm using the Jakarta JSTL tags (1.0.2) within Tomcat 4.1.12, with JDK 1.4.0 on a Windows platform. I'm using the SQL tags to get large text fields from an Oracle database and Oracle sends back those fields as CLOBs, not as strings. When putting the data into the pageContext, the EL decides that the CLOBs are not strings and therefore acts as if the CLOBs were beans. Is there an easy way to get the EL to turn the CLOBs into strings automatically, or, if there isn't, can anyone point me to the proper .java file in the JSTL source code so I can jimmy with it there? Thanks, James -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Taglibs and Commons Logging
I'm trying to find the best way to integrate commons-logging into my taglibs. Do any of the jakarta taglibraries use the Commons API for logging? If so, how do you configure the environment so that the appropriate logging facility is picked up and used? I'm struggling to get the default be the Simple logger, then other Logging implementations be used if availble. But I can't see how to do it simply within the taglibary/Jatr for my project. Any tips would be helpfull, -Mark -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Taglibs and Commons Logging
I've been attempting this strategy, but it seems that in the web application, somehow the properties files in the classes directory don't seem to get recognized by commons logging and used. When I compile my tags, they get deployed into jars in the WEB-INF /lib directory. I'm concerned that the libs endup on the classpath before the properties files, I'm wondering if theres a chance that its not searching the whole classpath when seaching for the properties files. Am I missing something? Here's my layout: /WEB-INF/classes/commons-logging.properties org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog /WEB-INF/classes/simplelog.properties org.apache.commons.logging.simplelog.defaultlog=trace org.apache.commons.logging.simplelog.showdatetime=true /WEB-INF/lib/commons-logging.jar /WEB-INF/lib/commons-logging-api.jar /WEB-INF/lib/mytags.jar And I don't see any log events in catalina.out for the log.debug(...) calls I'm making in my classes. -Mark Karr, David wrote: Struts uses commons-logging. If you put a commons-logging.properties file in your WEB-INF/classes directory, with the following contents: org.apache.commons.logging.Log = org.apache.commons.logging.impl.SimpleLog Then, you can have a file named simplelog.properties in the same place, with contents like: org.apache.commons.logging.simplelog.defaultlog = warn Other systems using commons-logging will probably work the same way. -Original Message- From: Mark R. Diggory [mailto:[EMAIL PROTECTED]] I'm trying to find the best way to integrate commons-logging into my taglibs. Do any of the jakarta taglibraries use the Commons API for logging? If so, how do you configure the environment so that the appropriate logging facility is picked up and used? I'm struggling to get the default be the Simple logger, then other Logging implementations be used if availble. But I can't see how to do it simply within the taglibary/Jatr for my project. Any tips would be helpfull, -Mark -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Taglibs and Commons Logging
Hold on, I made a stupid mistake, my files were named commons-logging.properties.properties for some weird reason. It works now. thanks, Mark Mark R. Diggory wrote: I've been attempting this strategy, but it seems that in the web application, somehow the properties files in the classes directory don't seem to get recognized by commons logging and used. When I compile my tags, they get deployed into jars in the WEB-INF /lib directory. I'm concerned that the libs endup on the classpath before the properties files, I'm wondering if theres a chance that its not searching the whole classpath when seaching for the properties files. Am I missing something? Here's my layout: /WEB-INF/classes/commons-logging.properties org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog /WEB-INF/classes/simplelog.properties org.apache.commons.logging.simplelog.defaultlog=trace org.apache.commons.logging.simplelog.showdatetime=true /WEB-INF/lib/commons-logging.jar /WEB-INF/lib/commons-logging-api.jar /WEB-INF/lib/mytags.jar And I don't see any log events in catalina.out for the log.debug(...) calls I'm making in my classes. -Mark Karr, David wrote: Struts uses commons-logging. If you put a commons-logging.properties file in your WEB-INF/classes directory, with the following contents: org.apache.commons.logging.Log= org.apache.commons.logging.impl.SimpleLog Then, you can have a file named simplelog.properties in the same place, with contents like: org.apache.commons.logging.simplelog.defaultlog= warn Other systems using commons-logging will probably work the same way. -Original Message- From: Mark R. Diggory [mailto:[EMAIL PROTECTED]] I'm trying to find the best way to integrate commons-logging into my taglibs. Do any of the jakarta taglibraries use the Commons API for logging? If so, how do you configure the environment so that the appropriate logging facility is picked up and used? I'm struggling to get the default be the Simple logger, then other Logging implementations be used if availble. But I can't see how to do it simply within the taglibary/Jatr for my project. Any tips would be helpfull, -Mark -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Taglibs and Commons Logging
-Original Message- From: Mark R. Diggory [mailto:[EMAIL PROTECTED]] I've been attempting this strategy, but it seems that in the web application, somehow the properties files in the classes directory don't seem to get recognized by commons logging and used. When I compile my tags, they get deployed into jars in the WEB-INF /lib directory. I'm concerned that the libs endup on the classpath before the properties files, I'm wondering if theres a chance that its not searching the whole classpath when seaching for the properties files. Am I missing something? Here's my layout: /WEB-INF/classes/commons-logging.properties org.apache.commons.logging.Log=org.apache.commons.logging.impl .SimpleLog /WEB-INF/classes/simplelog.properties org.apache.commons.logging.simplelog.defaultlog=trace org.apache.commons.logging.simplelog.showdatetime=true /WEB-INF/lib/commons-logging.jar /WEB-INF/lib/commons-logging-api.jar /WEB-INF/lib/mytags.jar And I don't see any log events in catalina.out for the log.debug(...) calls I'm making in my classes. Well, I would guess there's a good reason for that. The SimpleLog class just emits to stderr. Are you not able to see your server console? -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Taglibs and Commons Logging
Karr, David wrote Well, I would guess there's a good reason for that. The SimpleLog class just emits to stderr. Are you not able to see your server console? I just tail catalina.out usually to track stuff I'm working on. Or I build my own log for a particular webapp if there's too much other activity going on there. Right now I think that catalina.out is set to be where stderr goes by default in a standard tomcat install on Linux, I could be wrong. Thanks for the help, I hope this info is of some help to others too, Mark -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Creates new instead of finding populated ActionForm
Since this question is about Struts and not Taglibs, you're much more likely to get a helpful answer if you post it to the struts-user mailing list instead of the taglibs-user mailing list. -- Martin Cooper On Tue, 17 Dec 2002, Loren Hall wrote: Hello all, I'm trying to access a populated ActionForm, stored in session scope, using this ActionMapping actionpath=/customize type=Insites.theSystem.CustomizeAction name=ModelForm scope=session validate=true input=/customizer.jsp forward name=success path=/customizer.jsp/ /action * A ModelForm is created using the link nested:link page=/customize.do?type=new paramProperty=ID paramId=templateID * log verifies that the initial form is created and populated * When forwarded to customizer.jsp the tag nested:form action=/customize.do?type=modifyaction=addAttribute Should(?) retrieve the initial form, but instead it's creating a new one. Anybody know why? thanks, Loren -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]