jstl type conversion

2003-02-05 Thread Steve Morrison

It seems as if the jstl (1.0.2) coerces all numbers to a Double, where 
really what I want is to keep it as an integer.

c:set var=height250/c:set
c:out value=${height/2}/
returns 125.0.  I'd like it to return just 125 - any hints?

Thanks,
-Steve


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



booleans in x:out, x:if

2002-06-03 Thread Steve Morrison


I want to do something based on the number of tags in an XML doc.  I have this:
x:out select=count($dom_wp//wpPages)  1
where $dom_wp contains 1 or more wpPages tags.  This prints out true or false 
correctly.

But this does not do what I expect:
x:if select=count($dom_wp//wpPages)  1more than 1/x:if
It always prints more than 1 even if there is only 1 wpPages.  Shouldn't it 
be interpreting XPath boolean true/false to jstl true/false?

-Steve



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




question about XPath tests

2002-04-18 Thread Steve Morrison


I have a node in an XML doc I'd like to compare against.  
It's a number, say 1001.  

x:out select=$dom_ref/path/to/node = 1001/
displays true or false correctly depending on if 
the the node content is 1001 or not.

But this always is true:
x:if select=$dom_ref/path/to/node = 1001true/x:if
no matter what is in the node.

I can use x:set to set a variable and compare with 
c:if but that's a pain.  Am I missing something
in the syntax?  Is it comparing it with the string
true?

-Steve

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




c:url clunky

2002-04-08 Thread Steve Morrison


I noticed that c:param's in a c:url are added backwards.
So if I have:
c:url var=my_url value=http://example.com/script.jsp;
  c:param name=A1/c:param
  c:param name=B2/c:param
  c:param name=C3/c:param
/c:url
It produces:
http://example.com/script.jsp?C=3amp;B=2amp;A=1

This isn't so good because I have an app that expects things 
a certain way.


Also, I've found the whole c:url stuff to be a bit clunky.
It would be nice if it accepted body content, something like:
c:url var=my_url
  %@ include file=my_host.jsf %c:out value=${my_var}/
c:param ... etc.

Right now I need to create some variables, and do
c:url var=my_url value=${my_var}

But this is awkward if I have multiple urls, and the params are
the same, but the paths are different.  Especially so, since the 
only reason I'm using c:param is that it url encodes strings for me.


Maybe what I really want is for c:out to produce multiple encodings,
such as XML, URL, WAP, etc.

-Steve

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




Re: Suppress whitespace generation?

2002-02-27 Thread Steve Morrison


I suggest the choose tag in the jstl (and probably other tags as well) should 
trim their content.  Considering:
c:choose
  c:when test=$param:foo == 'bar1'.../c:when
  c:when test=$param:foo == 'bar2'.../c:when
  c:when test=$param:foo == 'bar3'.../c:when
  c:otherwise.../c:otherwise
/c:choose
produces 5 unnecessary newlines and spaces.  Since you never expect content to be
between a choose and a when or otherwise it's probably ok to remove it.

-Steve


Shawn Bayern wrote:
 
 Hi Chris,
 
 The question is somewhat general.  For instance, depending on your needs,
 you can write a tag that trims its BodyContent (using String.trim()) and
 simply contain other tags within it.  So that:
 
   foo:trim
 
  foo
 
   /foo:trim
 
 would produce equivalent output to
 
   foo:trimfoo/foo:trim
 
 If you're suggesting, by contrast, that a particular taglib in Jakarta
 Taglibs produces unwanted whitespce, let us know, and the tag libraries
 could be patched to avoid this, or (as in the case of the Input taglib) to
 take a flag that switches behavior between pretty printing and avoidance
 of unnecessary whitespace.
 
 To help you further, I think we'd need more information about exactly what
 problem you're experiencing.
 
 --
 Shawn Bayern
 Author, JSP Standard Tag Library  http://www.jstlbook.com
 (coming this spring from Manning Publications)
 
 On Wed, 27 Feb 2002, Lomvardias, Christopher wrote:
 
  Haven't heard any responses to my earlier question below. Thought I'd poke
  the list again.
 
  Chris
 
  -Original Message-
  From: Lomvardias, Christopher [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, February 19, 2002 1:27 PM
  To: '[EMAIL PROTECTED]'
  Subject: Suppress whitespace generation?
 
 
  Hi,
 
  How does one suppress whitespace that is generated by a tag library?
 
  Thanks,
 
  Chris
  --
  Chris Lomvardias
  [EMAIL PROTECTED]
  PublicBuy.Net
  400 E. Pratt Street, Suite 300
  Baltimore, MD 21202
  (410)539-3737 x1722 voice
  (410)539-7302 fax
  [EMAIL PROTECTED] (pager via email)
  --
 
 
  --
  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]




jstl, request parameters

2002-02-20 Thread Steve Morrison


I'm considering moving a large codebase of proprietary templates 
to jsp, and the jstl in particular.  A problem I've had so far 
is with using SPEL and if tag.  Such as:
  c:if test=$param:myParam == '1'do stuff/c:if
and myParam does not exist in the url query string, an exception 
is thrown.  We have many parameters that aren't required which
initialize to default values, but we want an easy way to test 
against their existence in jsp.  The request tag library has 
some nice ways of doing this, but I like the idea of using one 
set of tag libraries, not a mish-mash of many incompatible ones.  
I just don't think tags like this should throw exceptions on 
non-unrecoverable errors.  Instead, it should just return an 
empty string (or some reasonable equivalent).

a way around this would be to use Ecmascript to hold a reference
to some object, which we use get/set methods on, for example:
% request.setAttribute(req,request); %
but we're having a hard time passing values to this object
c:if test=$req.getParameterName(myParam).../c:if

but the syntax doesn't seem to work - is there a way around this?

-Steve

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