RE: JSTL: Nightly build crashes

2002-03-14 Thread Shawn Bayern

On Thu, 14 Mar 2002 [EMAIL PROTECTED] wrote:

 - For I18N, the Parametric Replacement and Date example gives me
   javax.servlet.ServletException: Unparseable date: 

I'll let Jan answer this if he gets a chance, since he's more qualified to
answer I18N-related questions than I am.

 - Also, for the Import, the Encode examples make no difference, I get
   ABC abc 
   123 123 
 
   JSTL is fun JSTL is fun
   
   Doesn't look really different IMHO
 
 I'm sorry if these are dummy questions :-)

No, this is a great question.  The answer is that on Tomcat, the c:url
tag won't rewrite the URL (to add a session) unless it needs to.  Needs
to is defined through a number of criteria, but the notable one is that
if your browser supports cookies, it won't do the rewriting.  (It simply
doesn't need to.)

I've also seen reports that a recent version of Tomcat had some trouble
with the HttpServletResponse.encodeURL() method, which would also cause
problems for c:url.  But I don't know offhand the version where it's
problematic.

--
Shawn Bayern
Author, JSP Standard Tag Library  http://www.jstlbook.com
(coming this summer from Manning Publications)


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: JSTL: Nightly build crashes

2002-03-14 Thread Hans Bergsten

Shawn Bayern wrote:

 [...]
 I've also seen reports that a recent version of Tomcat had some trouble
 with the HttpServletResponse.encodeURL() method, which would also cause
 problems for c:url.  But I don't know offhand the version where it's
 problematic.


It's Tomcat 4.0.4 Beta 1, but it's supposed to be fixed in the
nightly builds after 3/13 (I have not confirmed this yet, though).

Hans
-- 
Hans Bergsten   [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
JavaServer Pageshttp://TheJSPBook.com


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: JSTL: Nightly build crashes

2002-03-14 Thread Jan Luehe

Hi Eric:

 Ok, I now reinstalled Tomcat (4.0.3, full version) and the nightly JSTL
 build (everything as binaries). Now it works, but not everything...
 
 - For I18N, the Parametric Replacement and Date example gives me
   javax.servlet.ServletException: Unparseable date: 

I managed to reproduce your problem with Tomcat 4.0.3, but not with
Tomcat 4.1 nightly build.

The behaviour of fmt:formatDate, which causes the problem in the
examples you mentioned, is as follows: If the 'value'
attribute is missing and the action does not have any body, the current
date is formatted. This is implemented in the doEndTag() method of
fmt:formatDate's tag handler, as follows:

if (!valueSpecified  (getBodyContent() == null)) {
// 'value' missing, use current date
value = new Date();
} 

(If the 'value' attribute is present, valueSpecified will have been
set to TRUE in the corresponding attribute setter method.)

I set a breakpoint at the above condition and printed the values of
valueSpecified and getBodyContent().

In the examples where you saw the error, fmt:formatDate neither
has a 'value' attribute nor a body. As expected, valueSpecified is
FALSE with both Tomcat 4.0.3 and 4.1. However, getBodyContent()
returns an empty string on Tomcat 4.0.3, which I think is a bug
(it is supposed to return null for an empty body). Therefore, 
fmt:formatDate assumes that it is supposed to format the
empty string as a date. As with any string, it first attempts to
parse the string as a date, which of course fails if the string is
empty and produces the exception you saw.

On Tomcat 4.1, getBodyContent() does return null, and therefore the
above condition evaluates to TRUE, causing the current date to be stored
in value and formatted.

Hope this helps.


Jan



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]