Re: Parsing problem

2003-09-06 Thread David M. Karr
 Ely == Ely Eshel [EMAIL PROTECTED] writes:

Ely Hi!
Ely I've just started using JSTL, and encountered a problem with the c.tld. I
Ely get the following error:
Ely org.apache.jasper.JasperException: XML parsing error on file
Ely /WEB-INF/tlds/c.tld: (line 3, col 8): Document is invalid: no grammar
Ely found.
Ely I use the c.tld from the standard 1.1 distribution on Tomcat 4.1.27 and JDK
Ely 1.4.2_01 on Windows XP.
Ely The opening lines of the c.tld are as follows:
Ely ?xml version=1.0 encoding=UTF-8 ?
Ely taglib xmlns=http://java.sun.com/xml/ns/j2ee;
Ely xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;

The 1.1 version of the JSTL doesn't work with Tomcat 4.x.  use the 1.x version
of the JSTL.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]   ; SCJP; SCWCD; SCBCD




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



Re: can't reference a class file (field) with el?

2003-08-14 Thread David M. Karr
 Solomon == Solomon Gorlick [EMAIL PROTECTED] writes:

Solomon Hi,
Solomon I was trying to use the value of a Java-class' static final field as part 
of
Solomon an EL-based value, but it didn't work.  Is this a wierd thing to want (I 
was
Solomon trying to standardize a certain fmt:formatNumber pattern for multiple 
uses)?
Solomon Is it supported and I just have the syntax wrong?  (I traced part of the
Solomon code into JSTLVariableResolver.resolveVariable() which appears not to 
handle
Solomon this case.)  It works fine if I hard code the format, or if I reference 
the
Solomon static field using the RT version of the tag.  Here is some sample code:

Solomon Any thoughts?

Yes.  You should read the JSTL specification.  It is not a dry unreadable
document.  It says exactly what you can do with it.  It makes it clear you
can't do this.  Search the archives of this list for numerous discussions about
this very point.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]   ; SCJP; SCWCD




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



Re: Going nuts with JSTL tag lib installation

2003-06-01 Thread David M. Karr
 Karsten == Karsten Wutzke [EMAIL PROTECTED] writes:

Karsten I get the following exception:

Karsten HTTP Status 500 -
Karsten type Exception report
Karsten message
Karsten description The server encountered an internal error () that prevented it 
from
Karsten fulfilling this request.

Karsten exception
Karsten org.apache.jasper.JasperException: This absolute uri
Karsten (http://java.sun.com/jstl/core) cannot be resolved in either web.xml or 
the jar
Karsten files deployed with this application

I would search in the archives for this, but it appears to be down right now.

Try opening up the jstl.jar file and inspecting the TLD file in the META-INF
directory.  That should specify the URI it expects.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]   ; SCJP; SCWCD




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



Re: Any logic:notPresent equivalent tag(s) in JSTL

2003-03-28 Thread David M. Karr
 Vernon == Vernon  [EMAIL PROTECTED] writes:

Vernon I am forced to use the Struts Tiles without Struts due to a tag pooling 
problem of template tag set ( from a JSP book). To   
Vernon avoid the definition objects are recreated each time the definition file 
is included, and drain performance. It is better to 
Vernon have something like the Struts logic:notPresent tag. Is something 
equivalent in JSTL?

The following has close to the same semantics:

  c:if test=${empty expr}

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]   ; SCJP; SCWCD




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



Re: JSTL okay with get method, but no set method?

2003-03-14 Thread David M. Karr
 Wendy == Wendy Smoak [EMAIL PROTECTED] writes:

Wendy I have a DTO that contains a List of objects.  Since you can add any Object
Wendy to a List, I would rather not have a 
Wendy   setAssistants( List asst ); 
Wendy method that would allow someone to add a list of inappropriate object types.

Wendy Instead, I want to only have:
Wendy   public List getAssistants();
Wendy   public void addAssistant( PersonView p);

Wendy I know that having two 'set' methods with the same name but different
Wendy parameters *really* confuses the introspection/reflection/whatever magic
Wendy happens with JavaBeans.  Learned that one the hard way. :(

Wendy But what about a 'missing' set method?  It _seems_ to be working:

Wendy c:forEach items=${trackDto.assistants} var=asst
Wendy   c:out value=${asst.assistant.preferredName}/ c:out
Wendy value=${asst.assistedDate}/
Wendy /c:forEach

Wendy I gather that JSTL uses the 'get' method to determine the type of the
Wendy object, because I'm not specifying that here and it's having no problems.

Wendy Please stop me now if I'm doing something that's going to cause problems
Wendy later!

From a non-authoritative point of view, I can't see how that could be a
problem.  You could sort of verify this yourself, by writing some code using
Introspector and BeanInfo.  If you get the PropertyDescriptors for the class
and you find that the assistants property has a read method but a null write
method, and it did all this without bombing, then the EL will probably be fine
with it.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]   ; SCJP; SCWCD




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



Tag libraries that use ExpressionEvaluator depend on Jakarta implementation

2003-03-05 Thread David M. Karr
This is probably obvious, but it is the case that any tag libraries that use
the ExpressionEvaluator class in the Jakarta JSTL implementation are actually
dependent on the Jakarta implementation, as opposed to the specification,
correct?  Since only the JSP api is described in the specification, and not the
Java api, then another JSTL implementation could use a completely different
class.  I'm not complaining, I just want to make sure I'm clear on that point.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]   ; SCJP; SCWCD




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



Re: c:out

2003-03-02 Thread David M. Karr
 Sloan == Sloan Seaman [EMAIL PROTECTED] writes:

Sloan I have a variable in the session named:
Sloan com.symbol.mobilecommerce.analysis.SESSION_USER

Sloan I want to get the object via c:out and use it in a JSP page.
Sloan When I have the variable just named SESSION_USER it works fine.
Sloan Example (note core:out = c:out)
Sloan Greetings
Sloan core:out value=${sessionScope.SESSION_USER.firstName}/
Sloan core:out value=${sessionScope.SESSION_USER.lastName}/.

Sloan But if I try:
Sloan Greetings
Sloan core:out
Sloan value=${sessionScope.com.symbol.mobilecommerce.analysis.SESSION_USER.firstN
Sloan ame}/
Sloan core:out
Sloan value=${sessionScope.com.symbol.mobilecommerce.analysis.SESSION_USER.lastNa
Sloan me}/.

Sloan It doesn't work.

Sloan I know this is because c:out is trying to call the object com and then the
Sloan getter symbol and so on.

Sloan How do I get around this so that it works?

Try:

value='${sessionScope[com.symbol.mobilecommerce.analysis.SESSION_USER].firstName}'


-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]   ; SCJP; SCWCD




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



Re: EL case sensitivity

2003-02-28 Thread David M. Karr
 John == John Thorhauer [EMAIL PROTECTED] writes:

John When using JSTL and the Expression Language with a bean, how does the
John api handle upper/lower case.  For example, I have an class with a
John getPONumber() method.  Now if i want call that in the Expression
John Language how is it properly done:

John ${myobj.ponumber}
John ${myobj.pONumber}
John ${myobj.PONumber}

John I am trying to figure out how this works so I can standardize my calls.

I always avoid having the second letter capitalized.  It just gets confusing
otherwise.

I think the correct property name would be poNumber, but you could either
examine the JavaBeans specification, or perhaps write some testing code using
the Introspector class, to get the answer from the horse's mouth.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]   ; SCJP; SCWCD




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



Re: forEach Problem

2003-01-20 Thread David M. Karr
 Alejandra == Alejandra De Leon [EMAIL PROTECTED] writes:

Alejandra I'm having a problem with foreach tag using begin and end attributes.
Alejandra The code I have is:
Alejandra c:forEach begin=${erliestYear} end=${latestYear} 
varStatus=status
Alejandra  option value=c:out value='${status.index}'/c:if
Alejandra test=${status.index == statisticsForm.toYear}c:out value=
Alejandra selected//c:ifc:out value='${status.index}'//option
Alejandra /c:forEach

Alejandra and when earliestYear it's equals to lastYear It doesn't display the 
option
Alejandra tag.
Alejandra I suppose that it should be like in Java that runs the loop once.

Alejandra This is a bug or it's not possible to use a foreach only to run once.

Just make end equal to ${latestYear + 1}.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]   ; SCJP; SCWCD




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




Re: about EL-based JSTL

2003-01-19 Thread David M. Karr
 Kishi == Kishi Mikio [EMAIL PROTECTED] writes:

Kishi Hi,
Kishi I have one question about JSTL (especially, expression language).
Kishi Now, I have restructed a system with Java2EE,
Kishi and considered the use of JSTL
Kishi and other tag libraries(jakarta-talibs) at that time.

Kishi But, because expression language is available in only JSTL,
Kishi it is inconvenience. Also, expression language has some problems.
Kishi For example, it is impossible to use a method invocation
Kishi except getter and setter (such as List#size()),
Kishi a method invocation with arguments, and so on.

Kishi So, I have considered the use of not EL-based JSTL but RT-based JSTL
Kishi in all JSP parts .
Kishi Has it made a mistake in this strategy ?
Kishi Is it better to use EL-based JSTL ?

As Henri mentioned, JSP 2.0 will use the EL in all tag attributes, and in body
content.  There are also a small number of other libraries that use the EL
engine for attribute values, including the Struts tag library, using the
Struts-EL contribution.

In JSP 2.0, issues with method invocation in the EL will be somewhat addressed.
I would hesitate to go much further than JSP 2.0 is going, as that would make
it easier to pollute view logic with business logic.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]   ; SCJP; SCWCD




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




Re: How to insert a string into a tag parameter

2003-01-08 Thread David M. Karr
 Thomas == Thomas J Zvolensky Zvolensky writes:

Thomas I have a JSP that receives three strings from an upstream form.  I would 
like to insert one of the passed strings as a value within a c:import tag.  See the 
last line of code snippet below.
Thomas %--

Thomas Get Project, Owner and XML file path from the form

Thomas --%
Thomas jsp:useBean id=parameters class=com.plv2.FormBean  scope=page /
Thomas %
Thomas String project = request.getParameter(project);
Thomas String owner = request.getParameter(owner);
Thomas String xmlfile = request.getParameter(xmlfile);
Thomas %
Thomas %-- 

Thomas open the ShareWeb export file 

Thomas --%
Thomas c:import var=shareweb url=%=xmlfile% /

Thomas It seems my syntax is incorrect as url=%=xmlfile% results in a 
compilation error.

Thomas Does anybody know the correct way to do this?

If those values are coming from request parameters, than you can use the EL
syntax to reference request parameters directly:

 c:import var=shareweb url=${param.xmlfile} /

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]   ; SCJP; SCWCD




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




Re: invoking a JSP or servlet

2002-12-10 Thread David M. Karr
 Anuj == Anuj Agrawal [EMAIL PROTECTED] writes:

Anuj Also, did you really mean that the welcome jsp would forward to the first
Anuj action, and not redirect to the first action?  I.e. is it jsp:forward
Anuj page=../ or c:redirect url=.. / .. The forward appears to be a better
Anuj option since the URL in the browser doesn't change.

The answer, of course, is that it depends.  Once you understand the difference
between forward and redirect, you have to decide based on what you want your
application to do.  In some cases, you DO want the browser URL to change.  I
don't think it's likely in this situation, however.

 -Original Message-
 From: Karr, David [mailto:[EMAIL PROTECTED]]
 
 A common pattern is to have your welcome file be a jsp that does
 nothing but forward to your first action.
 
  -Original Message-
  From: Anuj Agrawal [mailto:[EMAIL PROTECTED]]
 
  Is it accurate to say that we should never invoke a JSP file
  directly?  It
  should always be forwarded to from some servlet?
 
  What if my first page (say, index.jsp) of my web app has some db query
  results being displayed, is the right way to make it so
  that my first page
  is a servlet and after doing all the db stuff, it forwards to
  the index.jsp?
 
  If that's true, then is there a way to configure the web app
  (guessing via
  web.xml) so that the welcome file is a particular servlet?

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]   ; SCJP



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




Re: rtexprvalue and EL

2002-11-26 Thread David M. Karr
 Affan == Affan Qureshi [EMAIL PROTECTED] writes:

Affan I want to do a test like this:
Affan c:if test=${parameter.type == %= ParameterBean.TEXT%}
Affan nested:text property=value /
Affan /c:if

Affan I am comparing a value against a constant in a class but I can't execute a
Affan RT expression in a c:if  when using the EL tags. How do I accomplish this
Affan in EL?

Affan Of course I can initialize pageContext variables with all the constants and
Affan do EL comparisons using them. But is there another way to do this?

The EL only references javabean properties.  That's what you have to work with.

Write a function which takes a class and a hashmap, and uses reflection to
populate all the constant symbols into the hashmap.  You can then reference
that hashmap in the EL.  Either that, or use both the c and c-rt tags, and
use c-rt:set to set a scoped attribute and then c:if (I think that would
work).

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]   ; SCJP



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




Re: [standard] nested forEach tags?

2002-11-23 Thread David M. Karr
 Wendy == Wendy Smoak [EMAIL PROTECTED] writes:

Wendy Can you nest c:forEach tags?  I can't find an example of it, and it's not
Wendy working for me.

Wendy c:forEach items=${itemList} var=item
Wendy   hr
Wendy   c:out value=${item.id}/. c:out value=${item.text}/br
  
Wendy   c:forEach items=${item.options} var=option /
Wendy  c:out value=${option.text}/
Wendy   /c:forEach
  
Wendy   c:out value=${item.answer}/br
Wendy /c:forEach

Wendy The first /c:forEach tag ends the loop.

Wendy Should this be working?  Does anyone see anything wrong with this?

The typo you refer to is in the first c:forEach.  The line ends with /.
That's why the second /c:forEach ended up in the output.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]   ; SCJP



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




Re: Getting values from a Map in JSTL-EL

2002-11-22 Thread David M. Karr
 Affan == Affan Qureshi [EMAIL PROTECTED] writes:

Affan I have two questions. How to get values if my bean has a method that returns
Affan a Map? I have a bean with getValues() method that returns a Map.
Affan I have tried
Affan c:out value=${specs.values.paramId} /

Affan c:out value=${specs.values[paramId]} /

Affan c:out value=${specs.values.map.paramId} /

Affan But I get the following error:
Affan Unable to find a value for map in object of class
Affan java.util.HashMap$Values using operator .'  (correspondingly)

Did you try all three of these at the same time?  The last one is obviously
broken, which is why you got the error.

The second one and the first one are actually slightly different.  The first
one looks for a key of paramId in the map, and the second one looks in the
map with a key that is STORED IN the scoped attribute named paramId.  If you
wanted to change the second one to do the same thing as the first, change it
to:

  c:out value='${specs.values[paramId]}' /

Affan Also my bean also has a method that takes a String and returns the value
Affan Object from the map. Its signature is:
Affan public Object getValue(String key)

Affan How do I use this method using EL?

You can't.  This kind of expression (called mapped properties) is supported
by the Jakarta Commons BeanUtils package, but not with the JSTL.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]   ; SCJP



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




Re: [jstl] jsp:forward ideas

2002-11-07 Thread David M. Karr
 Henri == Henri Yandell [EMAIL PROTECTED] writes:

Henri I'd like to do the following:

Henri jsp:forward page=somePage.jsp
Henri   jsp:param name=id value=${param.id}/
Henri /jsp:forward

Henri Now, obviously this is not going to work until JSP 2.0.

Henri So then there's the next step of:

Henri jsp:forward page=somePage.jsp
Henri   jsp:param name=id value=c:out value=${param.id}//
Henri /jsp:forward

Henri Which due to the order of parsing also fails to work. [This has come up
Henri enough on this list].

Henri Now, my question is, is there anyway around this?
Henri Apart from the obvious: % request.getParameter(id) %.

Just use different quotes at the other level:

 jsp:forward page=somePage.jsp
   jsp:param name=id value='c:out value=${param.id}/'/
 /jsp:forward

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]   ; SCJP



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




Re: [jstl] jsp:forward ideas

2002-11-07 Thread David M. Karr
 Henri == Henri Yandell [EMAIL PROTECTED] writes:

Henri On 7 Nov 2002, David M. Karr wrote:

 Just use different quotes at the other level:
 
 jsp:forward page=somePage.jsp
 jsp:param name=id value='c:out value=${param.id}/'/
 /jsp:forward

Henri Nope, not happy. I had:

Henri jsp:forward page='c:out value=${param.goto}/'
Henri   jsp:param name=id value='c:out value=${param.id}/'/
Henri /jsp:forward

Henri [which was working as:
Henri c:redirect url=${param.goto}
Henri   c:param name=id value=${param.id}/
Henri /c:redirect
Henri ]

Henri and I get an error of:

Henri message /c:out value=${param.goto}/
Henri description The requested resource (/c:out value=${param.goto}/) is not 
available.

Henri So it's not parsing the inside of page attribute for jstl I guess. [I
Henri flipped the ' and  just in case. Figured it wouldn't hurt :) ]

Oh.  Duh.

In that case, I guess you either use the scriptlet, do it at the servlet level,
or use Struts-EL (logic-el:forward).  I don't see a clean way to do it
otherwise.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]   ; SCJP



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




Re: JSTL that uses java.net.URLEncoder.encode

2002-10-19 Thread David M. Karr
 nickm == nickm  Stefan writes:

nickm Hi,
nickm Is there a JSTL tag that reproduces / applies java.net.URLEncoder.encode so 
as to properly encode query strings?

You should read the specification, which you can get to at
http://java.sun.com/products/jsp/jstl/.  Read the section entitled URL
Related Actions, which talks about building urls and encoding parameters.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Re: utility taglib, basic looping

2002-10-16 Thread David M. Karr

 Thomas == Thomas Delnoij [EMAIL PROTECTED] writes:

Thomas Hi Shawn,
Thomas Sorry, I misunderstood both you and the website. If this is a widely held
Thomas misunderstanding, then I would suggest that the website is not clear enough
Thomas on this topic...

Thomas I am actually working on an alternative:

Thomas ?xml version = '1.0' encoding = 'windows-1252'?
Thomas jsp:root xmlns:jsp=http://java.sun.com/JSP/Page; version=1.2 
Thomas  jsp:directive.page contentType=text/html;charset=windows-1252/
Thomas  html
Thomas head
Thomasmeta HTTP-EQUIV=Content-Type CONTENT=text/html;
Thomas charset=windows-1252/
Thomastitletest/title
Thomas /head
Thomas body
Thomas jsp:scriptlet
Thomas for (int i = 0; i  8; i++)
Thomas  {
Thomas /jsp:scriptlet
Thomas   jsp:expression i /jsp:expression
Thomas jsp:scriptlet
Thomas   }
Thomas /jsp:scriptlet
Thomas   /body
Thomas   /html
Thomas /jsp:root

Thomas On compilation:

Thomas Error(11,24): Expected name instead of  .
Thomas Error(11,25): Expected name instead of 8.
Thomas Error(11,26): '=' missing in attribute.
Thomas Error(11,27): Attribute value should start with quote.

First of all, why are you trying to use the XML format?  It may be convenient
for computers, but it's not convenient for humans.  Your compile errors
probably have a little to do with the fact that you're not CDATAing your
scriptlet content.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Re: ExpressionUtil.evalNotNull doesn't return NAE on null value

2002-10-13 Thread David M. Karr

 Shawn == Shawn Bayern [EMAIL PROTECTED] writes:

Shawn On 13 Oct 2002, David M. Karr wrote:
 In particular, I see that the NullAttributeException is thrown if the
 expression string was not null, but the resulting value was null.  
 However, if the expression string was null, it just returns null.  
 Shawn, could you explain the motivation for this?  I'm wondering why
 it doesn't throw the NAE if the expression string was null.

Shawn In some cases, there's a difference between an attribute not being
Shawn specified (which might be allowed) and evaluating to null (which might
Shawn need to be reported as an error).  Including this check in this particular
Shawn utility method is arbitrary, but it allowed us to factor out logic
Shawn conveniently.

Shawn For instance, 'escapeXml' in c:out is one such attribute.  For this
Shawn attribute, we can simply write

Shawn   boolean escapeXml = true;
Shawn   Boolean escape = ((Boolean) ExpressionUtil.evalNotNull(
Shawn out, escapeXml, escapeXml_, Boolean.class, this, pageContext));
Shawn   if (escape != null)
Shawn escapeXml = escape.booleanValue();

Shawn and let the NullAttributeException propagate.

Shawn Of course, we could have simply checked for this outside the method, too.  
Shawn Some of this code grew organically, changing slightly rather than being
Shawn completely rewritten as the spec was updated.  While I don't have a
Shawn problem with the current evalNotNull() method, there are certainly other
Shawn ways we could have organized it.  For instance, we could have used
Shawn type-specific methods, with 'allowNull' as a boolean attribute.  But
Shawn evaluate but do not produce null was a common enough case that the
Shawn method seems useful.

Shawn Did that answer your question?

Well enough, thanks.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Re: incorporating EL support

2002-09-12 Thread David M. Karr

 Craig == Craig Longman [EMAIL PROTECTED] writes:

Craig i see in the src dist for the reference jstl that there are a couple of
Craig classes that look promising to use.  one is an interface
Craig (ExpressionEvaluator) and then an implementing class
Craig (ExpressionEvaluatorManager).  using it appears to be as simple as this
Craig (from tag/el/core/ForEachTag.java):

Craig   if( begin_ != null )
Craig   {
Craig Object r = ExpressionEvaluatorManager.evaluate(
Craig   begin, begin_, Integer.class, this, pageContext );
Craig if (r == null)
Craig {
Craig   throw new NullAttributeException(forEach, begin);
Craig }
Craig begin = ((Integer) r).intValue();
Craig validateBegin();
Craig   }

Craig it is acceptable to utilize this class in this manner for custom tags? 
Craig or is there a better/standard way.  i have been unable to find any docs
Craig that talk about using the standard EL in your own tags, but if anyone
Craig has any pointers, i would greatly appreciate it.

Another basically equivalent alternative is something like the following.  I
think I'm gravitating towards using ExpressionEvaluatorManager, instead of
ExpressionUtil, as shown here, because I'm just planning on ignoring null
values, which seems more efficient (at least from the POV of the interface) to
do with ExpressionEvaluatorManager and ExpressionUtil.  You treat null values
as an error, which is just a different approach.

try {
setArg0((String)ExpressionUtil.
evalNotNull(message, arg0, getArg0(),
String.class, this, pageContext));
} catch (NullAttributeException ex) {
setArg0(null);
}

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Diff. between logic:equals and EL eq between null and

2002-09-01 Thread David M. Karr

I noticed that with the Struts logic:equal tag, if you're comparing a
null-valued property with , it returns true.  This is not unexpected, as the
documentation specifically states that a null property value is coerced to a
zero-length string before a comparison occurs.

However, in the JSTL, with an EL expression, comparing a null-valued scoped
variable with 'eq ', it appears to return false.  This is curious, as I
noticed the statement in the JSTL spec in section A.7.1, titled Coerce A to
String, which says 'Otherwise, if A is null: return .'  If this is true,
this would imply that comparing a null-valued SV against  would return true.

Is there something wrong here, either with the implementation or the spec?

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Is it meaningful that there are no default values?

2002-08-31 Thread David M. Karr

In building the Struts-EL tag library, I haven't ported Struts tags that
provide functionality that are directly supported in the JSTL.  However, in
some of those tags I haven't ported, I have noticed one small feature that
isn't strictly provided in their JSTL analogs.

The issue is default values.  For instance, in the Struts bean:cookie tag,
it will assign the value of a cookie to a variable, but if the cookie isn't
defined, you can specify a default value that will be assigned to the variable.
There are a couple tags in the bean library that have this feature.

In the JSTL, there's no quick way to get this.  I believe, for each variable
that you want to have a default value, you'd do something like this, after
every c:set (perhaps) that reads a value you hope is defined:

 c:if test=${empty variable}
  c:set var=variable value=default value/
 /c:if

(I guess this avoids the question of the difference between a null string and
an empty string.)

If I were to suggest an enhancement, it would be a default attribute on
c:set that can take an EL expression.  Is there any perception that this
might have enough value for a formal enhancement report?

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Re: Is it meaningful that there are no default values?

2002-08-31 Thread David M. Karr

 Shawn == Shawn Bayern [EMAIL PROTECTED] writes:

Shawn The c:out tag has just the sort of 'default' attribute you suggest; you
Shawn can use it in conjunction with c:set and many other JSTL tags.

Sigh.  I probably looked at that page a hundred times.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Any way to import file as a resource?

2002-08-31 Thread David M. Karr

Is there a practical way to import a file as a resource?  The c:import tag
doesn't quite work.  For example, I'd like to read in the /WEB-INF/web.xml
file and parse/display it.  I can do this with Struts (bean:resource), but I'd
like to know for sure whether I can or can't do it with pure JSTL.

I need this to work for other files besides XML files, so an identity transform
with x:transform wouldn't be sufficient.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Re: Any way to import file as a resource?

2002-08-31 Thread David M. Karr

 Martin == Martin Cooper [EMAIL PROTECTED] writes:

Martin I'm not sure why you say c:import won't work. You can do this, which I
Martin think is what you want:

Martin   c:import var=xml url=/WEB-INF/web.xml/

Hmm.  That wasn't working.  The resulting variable was empty.  I guess I'll
have to track it in the debugger.  I don't see what could be wrong.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




No indexed access ala Struts?

2002-08-31 Thread David M. Karr

I don't think this is available in the EL, but I'll ask just to make sure.

Struts property references allow you to specify array indices, like
arrayIndexed[3], when you have a method in your bean like this:

 public int getArrayIndexed(int index) {
   return (arrayName[index]);
 }

This is in addition to the more conventional references like array[3], with a
corresponding bean method of this:

public int[] getArray() {
return (this.arrayName);
}

JSTL can deal with the latter, allowing a reference like array[3].  I don't
believe it will handle the former in any way.  Is that correct?  I've tried
some experiments and gone through the EL syntax, and I don't see anything like
this.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Re: Any way to import file as a resource?

2002-08-31 Thread David M. Karr

 David == David M Karr [EMAIL PROTECTED] writes:

 Martin == Martin Cooper [EMAIL PROTECTED] writes:
Martin I'm not sure why you say c:import won't work. You can do this, which I
Martin think is what you want:

Martin c:import var=xml url=/WEB-INF/web.xml/

David Hmm.  That wasn't working.  The resulting variable was empty.  I guess I'll
David have to track it in the debugger.  I don't see what could be wrong.

After tracking the c:import of /WEB-INF/web.xml, I don't see why I didn't
get anything.  However, I did try adding imports of several other files, to see
whether they worked or not:

/thing.xml: Worked
/dir/thing2.xml:Worked
/WEB-INF/anotherThing.xml:  Failed
/WEB-INF/struts-config.xml: Failed

Is this related to the restriction against directly serving files in the
WEB-INF directory?  I had no problem getting /WEB-INF/web.xml with the
bean:resource Struts tag.  All of these tests are running in TC 4.0.4.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Best way to evaluate several expressions at once?

2002-08-25 Thread David M. Karr

In my derived Struts-EL tags, I evaluate all of the attributes of a tag in the
same way, all at the same time.  Following this are some examples:

---
try {
setAltKey((String)ExpressionUtil.
  evalNotNull(checkbox, altKey, getAltKey(), 
  String.class, this, pageContext));
} catch (NullAttributeException ex) {
setAltKey(null);
}

try {
setDisabled(((Boolean)ExpressionUtil.
 evalNotNull(checkbox, disabled, getDisabled() + , 
 Boolean.class, this, pageContext)).
booleanValue());
} catch (NullAttributeException ex) {
setDisabled(false);
}

try {
setCollection(ExpressionUtil.
  evalNotNull(size, collection,
  getCollectionExpr(), 
  Object.class, this, pageContext));
} catch (NullAttributeException ex) {
setCollection(null);
}
---

The first two are from the same class, and the third one is from a different
class.  The first attribute is just a string type.  The second one is a
boolean, and the third is a Collection type (Collection or Array).

Every attribute is handled exactly this way (with a little more thought, the
derived classes could be generated from the XML files used to contain the TLD
information and the documentation).

My question to you is, is there a better and/or more efficient way to process a
bunch of EL expressions in a block?  What I have is straightforward, but I'm
wondering if there is a better way to do this.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Re: How to use JSTL engine to evaluate exprs in a context?

2002-08-19 Thread David M. Karr

 David == David M Karr [EMAIL PROTECTED] writes:

David Alternatively, I'd also like to consider the possibility of the form bean 
being
David REALLY implicit, not referencing it explicitly in the expression at all, 
but I
David don't understand how I could manage that.

I think I now understand how to do part of this, which is to define a
resolveVariable() method in a VariableResolver subclass which just uses
BeanUtils.getProperty(beanName, pName) (where pName is the variable to be
resolved).  I wonder, however, if I would be looking up the beanName explicitly
here, or whether I would have that being sent in as the pContext?

Outside of this, I still don't see how I can fit a derived VariableResolver
into a framework that would allow me to evaluate EL expressions with it.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Status on Struts-EL

2002-08-18 Thread David M. Karr
 the user would wrap with ${ and }, and would be
used as the element value, in the context of the explicit or implicit bean.
The property attribute would still be used as the HTML name attribute.  If
the elproperty attribute was not present, the behavior would be as it was
before.

Along with these ideas, I did realize another completely different strategy for
building this library.  Instead of trying to change how it works under the
covers, I could simply implement a tag library that exactly matches the Struts
tag libraries, but all of whose attributes are evaluated with the EL engine.
The internal behavior of the name, property pairs would be unchanged, but
attribute values could be specified as EL expressions in addition to, or
instead of, rtexprvalues.  This would clean up the nasty code I've seen people
write to assemble an on... attribute value from pieces.  I believe this only
becomes a slight implementation difficulty for attributes whose type is not
String or boolean, like the collection attribute of some tags.  Since from
the point of view of JSP, an EL expression is just a string, that wouldn't map
directly to a javabeans set method that takes a Collection.  In these cases, I
believe I'd have to implement a BeanInfo class that specifies a method in my
subclass, like setCollectionExpr() or something like that, which I can map
into the base class setCollection() method.

I'd appreciate any useful comments or suggestions.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Building JSTL with JDK 1.4 (minus jaxp-api.jar)?

2002-08-03 Thread David M. Karr

I was experimenting with building the JSTL from source, but I noticed it
doesn't deal properly with building with JDK 1.4, as it requires the presence
of jaxp-api.jar, which I believe is part of JDK 1.4.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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





Re: Off-topic: Deploy compiled JSPs

2002-07-31 Thread David M. Karr

 Eric == Eric Lewis [EMAIL PROTECTED] writes:

Eric Hi all
Eric Since compiling a JSP page means a big overhead for the server, has anyone
Eric ever tried to compile them on a development server and then deploy them to a
Eric production server? Ideally, Tomcat should compare the timestamp of the JSP
Eric and the .class and take the latter...

As Hans replied, most servlet containers provide a tool for precompiling JSP
pages into servlets.

Each one of them does about the same thing, with minor differences.  The basic
idea is that you generate a servlet class from the JSP page and compile the
generated servlet.  You also have to build a fragment of the web.xml file
representing the mappings from *.jsp to your new servlet classes, and either
use XML external entities to include that fragment in your base web.xml
file, or use XSLT to merge the two files.  I prefer the latter approach (partly
because I could never get the XML external entity solution to work in Tomcat).

I've looked at a few different servlet containers, and Tomcat is the only one
that I know of that generates the fragment to include in the web.xml file.
However, it's not difficult to generate that fragment with a shell or perl
script.

And don't forget to exclude your JSP pages from the final WAR file, as you
don't need them anymore (and as proof your process is working).

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Warning about slight non-equivalence between . and []

2002-07-22 Thread David M. Karr

The specification states that the . and [] operators are equivalent.  This
is essentially true.  However, it would be useful to point out there are some
situations where you could get dramatically different results from two
expressions using these two operators.

The basic prototypical example would be:

  ${header[user-agent]}
  ${header.user-agent}

The first probably gives you what you would expect.  The second gives you 0,
as it's subtracting two probably unset values.

You should especially be wary of this if you're somehow constructing the EL
expression from dynamic values (like if you're using the JSTL expression engine
itself, as opposed to using the JSTL tag library).

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Re: Warning about slight non-equivalence between . and []

2002-07-22 Thread David M. Karr

 Shawn == Shawn Bayern [EMAIL PROTECTED] writes:

Shawn On 22 Jul 2002, David M. Karr wrote:
 The specification states that the . and [] operators are
 equivalent.  This is essentially true.  However, it would be useful to
 point out there are some situations where you could get dramatically
 different results from two expressions using these two operators.
 
 The basic prototypical example would be:
 
 ${header[user-agent]}
 ${header.user-agent}
 
 The first probably gives you what you would expect.  The second gives
 you 0, as it's subtracting two probably unset values.

Shawn Thanks for the feedback, but the spec doesn't claim unqualified
Shawn equivalence between the . and [] operators.  Instead, it says:

Shawn  expr-a.identifier-b is equivalent to a[identifier-b]

Shawn In your example, user-agent is not an identifier; valid identifiers are
Shawn defined in seciton A.8 to be Java language identifier[s], which cannot
Shawn contain -.

You're right, of course.  This just seems like a place where people could get
tripped up.

I didn't write this note as feedback for the spec, just a warning for users who
might think of these two operators as completely equivalent.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Re: foreach strangeness...

2002-07-17 Thread David M. Karr

 Julia == Julia A Case [EMAIL PROTECTED] writes:

Julia I'm trying to use foreach in the following way
Julia c:forEach var=genre items=%= utilBean.getGenres() %
Julia   jsp:useBean id=genre type=String/
Julia   %= genre %
Julia /c:forEach

Julia getGenres() returns an array of Strings

Julia The same logic works both above and below with other functions.  But
Julia this one keeps telling me bean genre not found in scope.  Looking at the
Julia java code that is created from the jsp it looks like it tests for a null
Julia and generates that message, but if I simply replace the jsp:useBean and
Julia the next line with some sort of string to print it prints the correct
Julia number of times, so I know it's getting the array.

I would assume you're using the -rt library, if your loop iterated the
correct number of times.

I believe that, even in the -rt library, that the JSTL does not create
scripting variables, just scoped variables in the application, session,
request, or page.

If you want to print out the value of the string, then just do this:

 c:forEach var=genre items=%= utilBean.getGenres() %
  c:out value=${genre}/
 /c:forEach

Even better, if you use the non-rt library:

 c:forEach var=genre items=${utilBean.genres}
  c:out value=${genre}/
 /c:forEach

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Re: Is any way to generate a Key dynamicaly?

2002-06-27 Thread David M. Karr

 Vernon == Vernon Wu [EMAIL PROTECTED] writes:

Vernon I use the i18n tag from the JSTL in a Web application. Some of message 
keys are constructed in the format as

Vernon field_name.item_name

Vernon I would like to store the item_name only in DB and reconstruct a key 
dynamicaly. 

Vernon Doesn't it can be done? If so, how to do it?

Well, the key attribute for fmt:message can take a dynamic value, so you
can construct the key string from a variable or expression and provide it as
the value of the key attribute.  The form of the dynamic value depends on
whether you're using EL taglib (expression language) or the RT taglib
(runtime(?)).  If you're unsure of how to do all of this, make sure you read
the entire specification (if you skip the SQL and XML tags, you'll save a lot
of time towards getting a good understanding of JSTL usage).

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Re: FIFO ordering of input:select tag options

2002-04-10 Thread David M. Karr

 Rajiv == Rajiv Kewalramani [EMAIL PROTECTED] writes:

Rajiv I have a need to impose First In First Out ordering of select options.  I
Rajiv ended up modifying the select tag, replacing the Map representing the
Rajiv options with a pair of Collections.  

Rajiv Is there an easier/better way to do this using the existing input:select
Rajiv tag?

Well, I don't see a way to use the existing tag, without modifying it.  If you
want a slightly better solution than a pair of Collections, you could use the
SequencedHashMap in the new release of the Commons Collections library.  I
haven't used this, I just noticed it in the release notes.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Re: JSTL Struts

2002-04-06 Thread David M. Karr

 Jeff == Jeff Ling [EMAIL PROTECTED] writes:

Jeff Hi,
Jeff I am using struts with JSTL. In one place I write something like this:

Jeff c:import value=mytestprogram.do/

Jeff It throws an JSP exception at runtime.

Jeff Is this because struts will forward to the actual page when it sees *.do? Is
Jeff there any workaround?

I'm not sure anymore whether this can work, but I have one question.  In the
action that processes the /mytestprogram action, when it finally selects an
ActionForward to forward to, is the redirect flag on that ActionForward set
to true (this is set in the forward element in your struts-config.xml
file)?  I would think this would only have a chance to work if redirect was
false on that element.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Re: Taglibs and included pages

2002-04-03 Thread David M. Karr

 Bryan == Bryan P Glennon [EMAIL PROTECTED] writes:

Bryan I'm seeing some strange (or maybe intended) behavior with taglibs and
Bryan included files. Here's what I do:

Bryan %@ taglib prefix=bean uri=/WEB-INF/struts-bean.tld %
Bryan %@ taglib prefix=html uri=/WEB-INF/struts-html.tld %

Bryan Normal JSP/HTML stuff...

Bryan html:form  action=/action.do style=margin-botton:0m 

Bryan TABLE
Bryan  jsp:include page=/Common/foo1.jsp/
Bryan  !-- Page specific rows go here --
Bryan /TABLE
Bryan HR
Bryan TABLE
Bryan  jsp:include page=/Common/foo2.jsp/
Bryan  !-- More page specific rows here --
Bryan /TABLE

Bryan /html:form

Bryan The problem is with the two include files. If I don't repeat the %
taglib declarations 
Bryan in the included files, they don't work. It seems to me that once the
Bryan libs are declared, 
Bryan that declaration should hold for the remainder of the page. I'm sure I'm
Bryan missing something
Bryan here, and I'm looking for enlightenment. 

It helps to understand how the JSP include action works, as opposed to the
include directive.  Your main JSP and your included JSP pages are all
compiled into individual servlets.  They have to be able to work independently
(even if they're generating only a fragment of the output).

The include action happens at execution time, whereas the include directive
happens at compile time.  You could get away with leaving out the taglib
declarations in the included pages if they were included with the directive,
but not if they were included with the action.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Re: Error using JSTL

2002-03-29 Thread David M. Karr

 Thomas == Thomas J Zvolensky Zvolensky writes:

Thomas Hi,
Thomas I'm attempting to use the SQL tags provided with the JSTL 1.0 beta tag
Thomas library.

Thomas When I add the following line to my jsp page to import them into the page:
Thomas %@ taglib prefix=sql uri=http://java.sun.com/jstl/ea/sql; %

Thomas I get the following error screen for my page:

Thomas 

Thomas ++

Thomas root cause 

Thomas Unable to parse the expression:
Thomas org.apache.taglibs.standard.lang.jstl.parser.ParseException: Encountered 
:
Thomas at line 1, column 6.

Could you show us the entire JSP, or at least the beginning of it, including
this line?

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Re: Error using JSTL

2002-03-29 Thread David M. Karr

 Thomas == Thomas J Zvolensky Zvolensky writes:

Thomas Here is the top part of the JSP:
Thomas 

Thomas ++

Thomas sql:driver
Thomas   var=example
Thomas   driver=${org.gjt.mm.mysql.Driver}
Thomas   url=${dbc:mysql://carlsonr:3306/DocumentumUsage}
Thomas /

I believe your sql:driver element is the problem.  Your url attribute is
incorrect.  I would guess it should be:

   url=jdbc:mysql://carlsonr:3306/DocumentumUsage

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Re: Error using JSTL

2002-03-29 Thread David M. Karr

 Thomas == Thomas J Zvolensky Zvolensky writes:

Thomas Yep.
Thomas I removed the EL parser from the other lines.  Why is is shown that way in
Thomas the examples?

Thomas The page works now.

The only examples I've seen (in the samples and in the spec) of SQL tags that
use the EL for those attributes are ones that really need them, the ones that
have the values stored in scoped variables.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Re: Can you test for a cookie's value using c:if tag?

2002-03-29 Thread David M. Karr

 Shawn == Shawn Bayern [EMAIL PROTECTED] writes:

Shawn On Thu, 21 Mar 2002, Matt Raible wrote:
 Is it possible to do the following with JSTL?
 
 c:if test=${cookie.username == 'learner'}
 learner
 /c:if

Shawn Ah, I was hoping someone would ask.  The answer is no, not exactly like
Shawn that, but you can still use JSTL to access cookies.

Shawn While web developers often have the urge to access a cookie by name, it's
Shawn an urge that's best to resist; cookies aren't identified by name alone,
Shawn but by name, domain, path, and security status.  Thus, the best way to
Shawn access a cookie is to loop over the list of available cookies, matching
Shawn the one that you're interested in.

Shawn Now, if you're just interested in name, that's fine; but JSTL doesn't go
Shawn out of its way to support that special case.  Instead, you can just write

Shawn   c:forEach items=${pageContext.request.cookies} var=cookie
Shawn c:if test=${cookie.name == 'learner'}
Shawn   c:set var=cookieValue value=${cookie.value} /
Shawn /c:if
Shawn   /c:forEach

Curious.  Not that I would necessarily want to do this, but from the JSTL
specification, it almost seems like you could do something like this:

  x:set var=username select=$cookie:username/
  c:if test=${username == 'learner'}

So it appears that simple access to cookies is in the XML tags, but not the
core tags?  Please correct me if I'm confused (likely).

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Re: How do you download the XSL taglib for windows?

2002-03-28 Thread David M. Karr

 Liz == Liz Gallagher Gallagher writes:

Liz The XSL taglib is not included in the entire binary distibution of the
Liz taglib nightly builds (I've downloaded and checked them ALL).  There are no
Liz XSL taglib release builds and all of the XSL taglib nightly builds are in
Liz tar format.  I can usually use Winzip to extract tarred files, but I am
Liz getting the error: invalid archive directory.  I've even gone as far as
Liz FTPing one of the tar files to a unix box and I have not been successful
Liz untarring it there either.  

Liz Thank you for any help you can give me,
Liz Liz Gallagher

Are you averse to using the JSTL itself?  The JSTL has XML/XSLT functionality,
which is well described in the JSTL specification.  In particular, the
x:transform tag does what the InsertWithXSL tag did, and more.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Re: loading a singleton class in jsp

2002-02-21 Thread David M. Karr

 Michael == Michael Buenaventura [EMAIL PROTECTED] writes:

Michael Hi, I'm using struts framework and I was trying to load a singleton class
Michael that will hold my dropdown list of state in my jsp.
Michael jsp:useBean id=StateLookup scope=session
Michael class=com.blah.StateLookup.getInstance();/
Michael StateLookup is a singleton class.

Michael I'm using the jsp:useBean so that I can use these struts tag lib
Michael html:select property=state tabindex =key  html:option
Michael value=/html:option
Michael bean:define id=stateID name=StateLookup property=stateList 
/
Michael html:options collection=stateID property=key labelProperty=value/
Michael   /html:select

Michael Am I doing it the wrong way? Your input will be greatly appreciated.

First of all, it appears that you hit Reply when you wrote this note.  If you
have a new note to write, don't use Reply.  Many mail clients can thread
notes with the original note.  If you write a new note as a Reply to another
note, it will often get lost.

On your issue, you're misunderstanding how jsp:useBean and the class
attribute work.  The value of the class attribute is the fully-qualified name
of a class.  You can't specify a class and a method, or any variation.  The
given class will be used to call the constructor to create an instance of the
class.  You can't use singletons like this.

However, if you let jsp:useBean create the instance of the class and place it
into session scope, you get essentially the same behavior.  You might even
consider using application scope.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


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




Re: [standard] examples won't work

2002-01-01 Thread David M. Karr

 Shawn == Shawn Bayern [EMAIL PROTECTED] writes:

Shawn Achim,
Shawn It looks like the problem may just be caused by two conflicting versions
Shawn of JAXP:

 java.lang.ClassCastException:
 org.apache.crimson.jaxp.DocumentBuilderFactoryImpl

Shawn Since your stack trace doesn't run through any code in the JSTL RI, my
Shawn guess is that this is just a minor configuration issue with your
Shawn container.

I saw the same thing.  I tried to run it on Tomcat 4.0.2b1, essentially OOTB.
This is apparently an issue with the continuing battle between crimson.jar
and xerces.jar.  I think, in 4.0, Jasper was using crimson, and now it's
using xerces.  The examples are using crimson, so these examples won't work
OOTB with Tomcat 4.0.2b1.  I don't know what the correct solution is, but I
guess one of them has to be removed and changed to the other.

-- 
===
David M. Karr  ; Best Consulting
[EMAIL PROTECTED]   ; Java/Unix/XML/C++/X ; BrainBench CJ12P (#12004)


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