RE: JSTL install, confusing instructions

2003-06-06 Thread Gregory Guthrie
Ah!

Thanks.

At 11:55 AM 06/05/2003 -0400, you wrote:

I'm kind of sick right now so I'm only going to answer the first one real
fast.
(1.2) = requires a 1.2 container.

Gregory Guthrie
[EMAIL PROTECTED] (641)472-1125Fax: -1103
 

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


standard-examples web.xml wrong?

2003-06-06 Thread Mike Hulse
The first few lines of the web.xml unpacked from the war file says:

?xml version=1.0 encoding=ISO-8859-1?
web-app xmlns=http://java.sun.com/xml/ns/j2ee;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd
version=2.4

display-nameJSTL Examples/display-name
description
Examples for the 'standard' taglib (JSTL)
/description

I get:
PARSE error at line 5 column 19
org.xml.sax.SAXParseException: Element type web-app must be declared.

Looking at other web.xml files  I thought I noticed my problem so I changed
it to be
?xml version=1.0 encoding=ISO-8859-1?
!DOCTYPE web-app
PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
http://java.sun.com/dtd/web-app_2_3.dtd;

web-app xmlns=http://java.sun.com/xml/ns/j2ee;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd
version=2.4

display-nameJSTL Examples/display-name
description
Examples for the 'standard' taglib (JSTL)
/description

Now I get
PARSE error at line 9 column 19
org.xml.sax.SAXParseException: Attribute xmlns:xsi must be declared for
element type web-app.

Can somebody help?

Thanks in advance,
Mike



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



Re: standard-examples web.xml wrong?

2003-06-06 Thread Michael Duffy
Where's the DOCTYPE?  

Start with the attached web.xml and add tags according
to the DTD. - MOD


--- Mike Hulse [EMAIL PROTECTED] wrote:
 The first few lines of the web.xml unpacked from the
 war file says:
 
 ?xml version=1.0 encoding=ISO-8859-1?
 web-app xmlns=http://java.sun.com/xml/ns/j2ee;


xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;

 xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
 web-app_2_4.xsd
 version=2.4
 
 display-nameJSTL Examples/display-name
 description
 Examples for the 'standard' taglib (JSTL)
 /description
 
 I get:
 PARSE error at line 5 column 19
 org.xml.sax.SAXParseException: Element type
 web-app must be declared.
 
 Looking at other web.xml files  I thought I noticed
 my problem so I changed
 it to be
 ?xml version=1.0 encoding=ISO-8859-1?
 !DOCTYPE web-app
 PUBLIC -//Sun Microsystems, Inc.//DTD Web
 Application 2.3//EN
 http://java.sun.com/dtd/web-app_2_3.dtd;
 
 web-app xmlns=http://java.sun.com/xml/ns/j2ee;


xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;

 xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
 web-app_2_4.xsd
 version=2.4
 
 display-nameJSTL Examples/display-name
 description
 Examples for the 'standard' taglib (JSTL)
 /description
 
 Now I get
 PARSE error at line 9 column 19
 org.xml.sax.SAXParseException: Attribute xmlns:xsi
 must be declared for
 element type web-app.
 
 Can somebody help?
 
 Thanks in advance,
 Mike
 
 
 

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


__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com?xml version=1.0 encoding=ISO-8859-1?

!DOCTYPE web-app
PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
http://java.sun.com/dtd/web-app_2_3.dtd;

web-app

display-nameMinimal JSTL Deployment/display-name
descriptionMinimal JSTL Deployment/description

/web-app


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

RE: Accessing scope attributes with dotted names using JSTL

2003-06-06 Thread Steve Raeburn
Thanks, but that's not what I'm trying to accomplish.

It's very common to place beans into session or application scopes with
names such as org.apache.struts.action.ACTION_MESSAGE. This is similar to
the Java package naming convention and accomplishes the same purpose of
avoiding name collisions.

In order to access the bean, you need to be able to specify a dotted name,
but you might not always know in which scope it will be found. Hence the
need to be able to specify a dotted bean name in EL.

The problem is that either EL interprets the string as a path to a nested
property or, if you escape the string, as a literal string.

Ultimately, I need to be able to access the
PageContext.findAttribute(java.lang.String name) method using EL, but as
this method does not meet bean property naming conventions I can't even do
something like ${pageContext[dotted.name]}.

I had a look through the JSTL 1.0 and JSP 2.0 specs last night and this case
just does not seem to be addressed. As this is a very common requirement,
I'm surprised that it's not covered.

Steve


 -Original Message-
 From: Daniel Montero [mailto:[EMAIL PROTECTED]
 Sent: June 5, 2003 10:24 AM
 To: Tag Libraries Users List; [EMAIL PROTECTED]
 Subject: Re: Accessing scope attributes with dotted names using JSTL


 You could access a variable as ${mydomain.mybean} if you created a bean
 mydomain (Hashtable, for example), and set any attributes you
 want there.

 %
 Hashtable mydomainVar = new Hashtable();
 String mybeanVariable=this is a test;
 mydomainVar.put(mybean, mybeanVariable);
 request.setAttribute(mydomain, mydomainVar);
 %
 c:out value=${mydomain.mybean}/


 HTH,
 danim



 - Original Message -
 From: Steve Raeburn [EMAIL PROTECTED]
 To: Tag Libraries Users List [EMAIL PROTECTED]
 Sent: Wednesday, June 04, 2003 11:12 AM
 Subject: RE: Accessing scope attributes with dotted names using JSTL


  Thanks, that works. You're a star!
 
  Now, a follow up ... :-)
 
  Is there any way to do it without specifying the scope?
  As in c:out value=${\mydomain.mybean\} (which doesn't work).
 
  Steve
 
   -Original Message-
   From: Bruce Perry [mailto:[EMAIL PROTECTED]
   Sent: June 4, 2003 2:42 AM
   To: Tag Libraries Users List
   Subject: Re: Accessing scope attributes with dotted names using JSTL
  
  
   Try this:
  
 c:out value=${requestScope[\mydomain.mybean\]} /
  
   requestScope is an EL implicit object.
  
   Bruce
  
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 


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




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



RE: Accessing scope attributes with dotted names using JSTL

2003-06-06 Thread Karr, David
I guess one thing that might help a tiny bit is if there was a map in
some scope that is formed by merging (in order) the applicationScope,
sessionScope, requestScope, and pageScope maps.  That would give you a
single map to search, instead of having to know which scope to look in.

 -Original Message-
 From: Steve Raeburn [mailto:[EMAIL PROTECTED]
 
 Thanks, but that's not what I'm trying to accomplish.
 
 It's very common to place beans into session or application scopes
with
 names such as org.apache.struts.action.ACTION_MESSAGE. This is
similar
 to
 the Java package naming convention and accomplishes the same purpose
of
 avoiding name collisions.
 
 In order to access the bean, you need to be able to specify a dotted
name,
 but you might not always know in which scope it will be found. Hence
the
 need to be able to specify a dotted bean name in EL.
 
 The problem is that either EL interprets the string as a path to a
nested
 property or, if you escape the string, as a literal string.
 
 Ultimately, I need to be able to access the
 PageContext.findAttribute(java.lang.String name) method using EL, but
as
 this method does not meet bean property naming conventions I can't
even do
 something like ${pageContext[dotted.name]}.
 
 I had a look through the JSTL 1.0 and JSP 2.0 specs last night and
this
 case
 just does not seem to be addressed. As this is a very common
requirement,
 I'm surprised that it's not covered.
 
 Steve
 
 
  -Original Message-
  From: Daniel Montero [mailto:[EMAIL PROTECTED]
  Sent: June 5, 2003 10:24 AM
  To: Tag Libraries Users List; [EMAIL PROTECTED]
  Subject: Re: Accessing scope attributes with dotted names using JSTL
 
 
  You could access a variable as ${mydomain.mybean} if you created a
bean
  mydomain (Hashtable, for example), and set any attributes you
  want there.
 
  %
  Hashtable mydomainVar = new Hashtable();
  String mybeanVariable=this is a test;
  mydomainVar.put(mybean, mybeanVariable);
  request.setAttribute(mydomain, mydomainVar);
  %
  c:out value=${mydomain.mybean}/
 
 
  HTH,
  danim
 
 
 
  - Original Message -
  From: Steve Raeburn [EMAIL PROTECTED]
  To: Tag Libraries Users List [EMAIL PROTECTED]
  Sent: Wednesday, June 04, 2003 11:12 AM
  Subject: RE: Accessing scope attributes with dotted names using JSTL
 
 
   Thanks, that works. You're a star!
  
   Now, a follow up ... :-)
  
   Is there any way to do it without specifying the scope?
   As in c:out value=${\mydomain.mybean\} (which doesn't work).
  
   Steve
  
-Original Message-
From: Bruce Perry [mailto:[EMAIL PROTECTED]
Sent: June 4, 2003 2:42 AM
To: Tag Libraries Users List
Subject: Re: Accessing scope attributes with dotted names using
JSTL
   
   
Try this:
   
  c:out value=${requestScope[\mydomain.mybean\]} /
   
requestScope is an EL implicit object.
   
Bruce
   
  
  
  
-
   To unsubscribe, e-mail:
[EMAIL PROTECTED]
   For additional commands, e-mail:
[EMAIL PROTECTED]
  
 
 
 
-
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail:
[EMAIL PROTECTED]
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


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



Re: Accessing scope attributes with dotted names using JSTL

2003-06-06 Thread Serge Knystautas
Steve Raeburn wrote:
Thanks, but that's not what I'm trying to accomplish.

It's very common to place beans into session or application scopes with
names such as org.apache.struts.action.ACTION_MESSAGE. This is similar to
the Java package naming convention and accomplishes the same purpose of
avoiding name collisions.
In order to access the bean, you need to be able to specify a dotted name,
but you might not always know in which scope it will be found. Hence the
need to be able to specify a dotted bean name in EL.
The problem is that either EL interprets the string as a path to a nested
property or, if you escape the string, as a literal string.
Ultimately, I need to be able to access the
PageContext.findAttribute(java.lang.String name) method using EL, but as
this method does not meet bean property naming conventions I can't even do
something like ${pageContext[dotted.name]}.
It's true you can't do find attribute with a dotted-name.  If you want 
to jury rig something, do this...


%!
static class AttributeFascade extends HashMap {
PageContext context;
public AttributeFascade(PageContext context) {
this.context = context;
}
public Object get(Object key) {
return context.findAttribute(key);
}
}
%
%
pageContext.setAttribute(finder, new AttributeFascade(pageContext));
%
c:out value=${finder['dotted.name']} /



You can flesh out AttributeFascade if you want to implement more methods 
on Map, maybe make it a regular class, maybe have a taglib that sets 
this for you, e.g.,

foo:attributeFascade var=finder /

Anyway, just a thought on how to do this if you must.  As you can see, 
you start bending the brain in on itself, so that's part of why it was 
left off of the spec. ;)

--
Serge Knystautas
President
Lokitech  software . strategy . design  http://www.lokitech.com
p. 301.656.5501
e. [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Can EL do contains type string operation

2003-06-06 Thread Jim Kennedy
I need to determine if a String contains a certain character, then make a decision 
about what to display next.  Can EL do something like:

${bean.attr.lastIndexOf('x')  0}.  I think I already know the answer but I though 
maybe there was something I hadn't seen yet.  Is there anyway using JSTL tag libs as 
well?

Jim Kennedy
IT Consultant
Mobile Phone: 813-503-1484
-




RE: Can EL do contains type string operation

2003-06-06 Thread Howard Lin
you can use string tag lib.

 -Original Message-
 From: Jim Kennedy [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 05, 2003 4:01 PM
 To: Tag Libraries Users List
 Subject: Can EL do contains type string operation
 
 
 I need to determine if a String contains a certain character, 
 then make a decision about what to display next.  Can EL do 
 something like:
 
 ${bean.attr.lastIndexOf('x')  0}.  I think I already know 
 the answer but I though maybe there was something I hadn't 
 seen yet.  Is there anyway using JSTL tag libs as well?
 
 Jim Kennedy
 IT Consultant
 Mobile Phone: 813-503-1484
 -
 
 
 

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



Re: standard-examples web.xml wrong?

2003-06-06 Thread Mike Hulse
Thanks that helped.  There were a few that had to be changed.  I wasn't
expecting to change any in the examples.

- Original Message -
From: Michael Duffy [EMAIL PROTECTED]
To: Tag Libraries Users List [EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 1:34 PM
Subject: Re: standard-examples web.xml wrong?


 Where's the DOCTYPE?

 Start with the attached web.xml and add tags according
 to the DTD. - MOD


 --- Mike Hulse [EMAIL PROTECTED] wrote:
  The first few lines of the web.xml unpacked from the
  war file says:
 
  ?xml version=1.0 encoding=ISO-8859-1?
  web-app xmlns=http://java.sun.com/xml/ns/j2ee;
 
 
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 
  xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
  web-app_2_4.xsd
  version=2.4
 
  display-nameJSTL Examples/display-name
  description
  Examples for the 'standard' taglib (JSTL)
  /description
 
  I get:
  PARSE error at line 5 column 19
  org.xml.sax.SAXParseException: Element type
  web-app must be declared.
 
  Looking at other web.xml files  I thought I noticed
  my problem so I changed
  it to be
  ?xml version=1.0 encoding=ISO-8859-1?
  !DOCTYPE web-app
  PUBLIC -//Sun Microsystems, Inc.//DTD Web
  Application 2.3//EN
  http://java.sun.com/dtd/web-app_2_3.dtd;
 
  web-app xmlns=http://java.sun.com/xml/ns/j2ee;
 
 
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 
  xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
  web-app_2_4.xsd
  version=2.4
 
  display-nameJSTL Examples/display-name
  description
  Examples for the 'standard' taglib (JSTL)
  /description
 
  Now I get
  PARSE error at line 9 column 19
  org.xml.sax.SAXParseException: Attribute xmlns:xsi
  must be declared for
  element type web-app.
 
  Can somebody help?
 
  Thanks in advance,
  Mike
 
 
 
 
 -
  To unsubscribe, e-mail:
  [EMAIL PROTECTED]
  For additional commands, e-mail:
  [EMAIL PROTECTED]
 


 __
 Do you Yahoo!?
 Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
 http://calendar.yahoo.com






 ?xml version=1.0 encoding=ISO-8859-1?

 !DOCTYPE web-app
 PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
 http://java.sun.com/dtd/web-app_2_3.dtd;

 web-app

 display-nameMinimal JSTL Deployment/display-name
 descriptionMinimal JSTL Deployment/description

 /web-app









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



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



JSTL and WebSphere 4.0

2003-06-06 Thread Augusto Rodriguez
Hi all !!


quick question, does JSTL work in WebSphere 4.0??


TIA!
Augusto.

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



Forwarding request

2003-06-06 Thread Karsten Wutzke
How do I best forward requests to a servlet from a JSP page? Can I use 
the c:redirect or should I stick to the standard jsp:forward tag?

Thanks!

Karsten

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


Re: Forwarding request

2003-06-06 Thread Michael Duffy

If you're using a front controller, I'd suggest having
all your JSPs submit their forms to the servlet.  Let
the servlet perform the necessary calculations in the
back and use RequestDispatcher.forward() to send the
response to the appropriate page.

--- Karsten Wutzke [EMAIL PROTECTED] wrote:
 How do I best forward requests to a servlet from a
 JSP page? Can I use 
 the c:redirect or should I stick to the standard
 jsp:forward tag?
 
 Thanks!
 
 Karsten
 
 

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


__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

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



Example use of java.servlet.jsp.jstl.sql.dataSource?

2003-06-06 Thread Michael Duffy

In Chapter 14 of Shawn Bayern's JSTL In Action, he
talks about setting up a default data source for JSTL.
 He shows how to add context-param tags to the
web.xml deployment descriptor on page 352, and below
that says the parameter name for the default data
source is javax.servlet.jsp.jstl.sql.dataSource.

But he doesn't show an example of how to use it in the
JSP.

Forgive me for being dense, but does anyone have an
example of what this should look like?  I've got this
for a web.xml:

?xml version=1.0 encoding=ISO-8859-1?
!DOCTYPE web-app PUBLIC
-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN
http://java.sun.com/dtd/web-app_2_3.dtd;
web-app

display-nameData Source Tester/display-name
descriptionData Source Tester/description

context-param
param-name
javax.servlet.jsp.jstl.sql.dataSource
/param-name
param-value
java:comp/env/jdbc/Conference
/param-value
/context-param

resource-ref
descriptionConference Data/description
res-ref-namejdbc/Conference/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
/resource-ref

/web-app

What is the name of the default data source in this
case?  Is it

sql.setDataSource
dataSource=javax.servlet.jsp.jstl.sql.dataSource/ ?



Thanks - MOD


__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

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



Re: Example use of java.servlet.jsp.jstl.sql.dataSource?

2003-06-06 Thread Shawn Bayern
On Fri, 6 Jun 2003, Michael Duffy wrote:

 In Chapter 14 of Shawn Bayern's JSTL In Action, he talks about
 setting up a default data source for JSTL.
  He shows how to add context-param tags to the web.xml deployment
 descriptor on page 352, and below that says the parameter name for the
 default data source is javax.servlet.jsp.jstl.sql.dataSource.
 
 But he doesn't show an example of how to use it in the JSP.

In the JSP pages, JSTL tags will automatically sense the default
DataSource that you have established and will acquire connections from it
as necessary.  When you set a default, you don't need to use the
sql:setDataSource tag at all; this tag is useful only in cases where you
haven't established (or want to override) the default.

-- 
Shawn Bayern
JSTL in Action   http://www.manning.com/bayern


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



Re: JSTL and WebSphere 4.0

2003-06-06 Thread Kan Ogawa
Hi, Augusto.

Augusto Rodriguez wrote:
Hi all !!

quick question, does JSTL work in WebSphere 4.0??


No, WebSphere 4.0 doesn't support Servlet 2.3 and
JSP 1.2.
--
Kan Ogawa
[EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Example use of java.servlet.jsp.jstl.sql.dataSource?

2003-06-06 Thread Michael Duffy

Oh!  That never occurred to me.

Are the context-param tags that I added to my
web.xml correct? 

Thanks again for your expert advice, Shawn. - MOD


--- Shawn Bayern [EMAIL PROTECTED] wrote:
 On Fri, 6 Jun 2003, Michael Duffy wrote:
 
  In Chapter 14 of Shawn Bayern's JSTL In Action,
 he talks about
  setting up a default data source for JSTL.
   He shows how to add context-param tags to the
 web.xml deployment
  descriptor on page 352, and below that says the
 parameter name for the
  default data source is
 javax.servlet.jsp.jstl.sql.dataSource.
  
  But he doesn't show an example of how to use it in
 the JSP.
 
 In the JSP pages, JSTL tags will automatically sense
 the default
 DataSource that you have established and will
 acquire connections from it
 as necessary.  When you set a default, you don't
 need to use the
 sql:setDataSource tag at all; this tag is useful
 only in cases where you
 haven't established (or want to override) the
 default.
 
 -- 
 Shawn Bayern
 JSTL in Action   http://www.manning.com/bayern
 
 

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


__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

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



Re: forTokens problem

2003-06-06 Thread Pierre Delisle
Howard Lin wrote:
I'm trying to use c:forTokens to parse a string, using \n as the delimiter and it 
seems it doesn't work. The jsp code is like this:
c:forTokens items=my_string delims=\n var=foo
tdc:out value=${foo}//td
/c:forTokens
${foo} shows the whole entire string instead of the token. but if I use 
StringTokenizer to parse the string in a script, I got the individual token. So I suspect 
c:forTokens might be the problem. Thanks,
Howard Lin wrote:
I'm trying to use c:forTokens to parse a string, using \n as the delimiter and it 
seems it doesn't work. The jsp code is like this:
c:forTokens items=my_string delims=\n var=foo
tdc:out value=${foo}//td
/c:forTokens
${foo} shows the whole entire string instead of the token. but if I use 
StringTokenizer to parse the string in a script, I got the individual token. So I suspect 
c:forTokens might be the problem. Thanks,
Howard,

It is not a problem with c:forTokens, but rather the fact that 
there is no way to pass special Java characters as String literals
in an attribute value.

The \n is being interpreted as the two characters '\' and
'n'.
One way to get the behavior you want is to make sure the
\n is really passed as a Java String.
For example:

  JSTL 1.1 (assuming myString is a scoped variable)

  c:forTokens items=${myString} delims='%=\n%' var=token
c:out value=${token}/br
  /c:forTokens
  JSTL 1.0 (assuming myString is a scripting variable)

  c_rt:forTokens items=%=myString% delims='%=\n%' var=token
c:out value=${token}/br
  /c_rt:forTokens
  or
  % 
 String lf = \n; 
 pageContext.setAttribute(lf, lf);
  %
  c:forTokens items=${myString} delims=${lf} var=token
c:out value=${token}/br
  /c:forTokens

   -- Pierre 

[and yes, maybe the EL should recognize these special character
sequences... passed the issue to the JSP spec leads]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: forTokens problem

2003-06-06 Thread Pierre Delisle
Howard Lin wrote:
I'm trying to use c:forTokens to parse a string, using \n as the delimiter and it 
seems it doesn't work. The jsp code is like this:
c:forTokens items=my_string delims=\n var=foo
tdc:out value=${foo}//td
/c:forTokens
${foo} shows the whole entire string instead of the token. but if I use 
StringTokenizer to parse the string in a script, I got the individual token. So I suspect 
c:forTokens might be the problem. Thanks,
Howard Lin wrote:
I'm trying to use c:forTokens to parse a string, using \n as the delimiter and it 
seems it doesn't work. The jsp code is like this:
c:forTokens items=my_string delims=\n var=foo
tdc:out value=${foo}//td
/c:forTokens
${foo} shows the whole entire string instead of the token. but if I use 
StringTokenizer to parse the string in a script, I got the individual token. So I suspect 
c:forTokens might be the problem. Thanks,
Howard,

It is not a problem with c:forTokens, but rather the fact that 
there is no way to pass special Java characters as String literals
in an attribute value.

The \n is being interpreted as the two characters '\' and
'n'.
One way to get the behavior you want is to make sure the
\n is really passed as a Java String.
For example:

  JSTL 1.1 (assuming myString is a scoped variable)

  c:forTokens items=${myString} delims='%=\n%' var=token
c:out value=${token}/br
  /c:forTokens
  JSTL 1.0 (assuming myString is a scripting variable)

  c_rt:forTokens items=%=myString% delims='%=\n%' var=token
c:out value=${token}/br
  /c_rt:forTokens
  or
  % 
 String lf = \n; 
 pageContext.setAttribute(lf, lf);
  %
  c:forTokens items=${myString} delims=${lf} var=token
c:out value=${token}/br
  /c:forTokens

   -- Pierre 

[and yes, maybe the EL should recognize these special character
sequences... passed the issue to the JSP spec leads]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Accessing scope attributes with dotted names using JSTL

2003-06-06 Thread Pierre Delisle
Serge Knystautas wrote:
Steve Raeburn wrote:

Thanks, but that's not what I'm trying to accomplish.

It's very common to place beans into session or application scopes with
names such as org.apache.struts.action.ACTION_MESSAGE. This is 
similar to
the Java package naming convention and accomplishes the same purpose of
avoiding name collisions.

In order to access the bean, you need to be able to specify a dotted 
name,
but you might not always know in which scope it will be found. Hence the
need to be able to specify a dotted bean name in EL.

The problem is that either EL interprets the string as a path to a nested
property or, if you escape the string, as a literal string.
Ultimately, I need to be able to access the
PageContext.findAttribute(java.lang.String name) method using EL, but as
this method does not meet bean property naming conventions I can't 
even do
something like ${pageContext[dotted.name]}.


It's true you can't do find attribute with a dotted-name.  If you want 
to jury rig something, do this...


%!
static class AttributeFascade extends HashMap {
PageContext context;
public AttributeFascade(PageContext context) {
this.context = context;
}
public Object get(Object key) {
return context.findAttribute(key);
}
}
%
%
pageContext.setAttribute(finder, new AttributeFascade(pageContext));
%
c:out value=${finder['dotted.name']} /



You can flesh out AttributeFascade if you want to implement more methods 
on Map, maybe make it a regular class, maybe have a taglib that sets 
this for you, e.g.,

foo:attributeFascade var=finder /

Anyway, just a thought on how to do this if you must.  As you can see, 
you start bending the brain in on itself, so that's part of why it was 
left off of the spec. ;)
As shown by all emails on the topic, accessing scoped variables with a
dotted name is not as easy as it should be right out of the box.
I'll submit the issue to the JSP spec leads to see if maybe they'd be
willing to amend the EL syntax to make this easier.
[Either adding an extra implicit object such as 'allScopes'
to allow ${allScopes['my.dottted.scoped.var']},
or even maybe allowing something like ${['my.dotted.scoped.var']}).
   -- Pierre

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