>>>>> "Jean-Paul" == Jean-Paul Le Fevre <[EMAIL PROTECTED]> writes:

    Jean-Paul> I've been testing the new version of the standard tags library
    Jean-Paul> and I'm having some difficulties.

    Jean-Paul> I used to work successfully with version standard-20020130 but
    Jean-Paul> with versions standard-beta1 or standard-20020326 I'm facing problems :

    Jean-Paul> - I couldn't find the documentation of the new tags : out, forEach etc.
    Jean-Paul>   Since the syntax has changed it would be very useful to have the
    Jean-Paul>   description of the new syntax somewhere. I've upgraded my pages by 
looking at
    Jean-Paul>   the examples but it is not very convenient.

The specification is a pretty good approximation of the documentation (perhaps
exact :) ).

    Jean-Paul> - I've a class which is extended from an AbtractList. I added some
    Jean-Paul>   methods which are needed by my application (A couple of 
getSomething())
    Jean-Paul>   but in my JS page, using <c:out value="${my_instance.something}">,
    Jean-Paul>   an exception is raised complaining that a conversion to integer (?)
    Jean-Paul>   is not possible for a List. It seems that the server does not 
    Jean-Paul>   understand that my_instance is not a pure List but something
    Jean-Paul>   inheriting from a List.

In the specification, in section A.3.4, 'Operators "[]" and "."', you can see
the unfortunate circumstances that leads to this problem.  It checks to see if
the class is a List before it checks to see if it's a Bean.  If I were you, I
would consider making a new class (bean) which encapsulates the List and also
provides the data members.

    Jean-Paul> - In a class I've a method preparing the list of options available
    Jean-Paul>   for some choice : getOptionList(). It returns a string which is
    Jean-Paul>   a concatenation of <option>choice A</option> ...
    Jean-Paul>   But in the JSP <c:out value = "${sample.optionList}" /> is not 
displayed
    Jean-Paul>   if it is nested in a <select></select> where it should be. 
    Jean-Paul>   To find out what was wrong I moved the <c:out> outside the <select>
    Jean-Paul>   block and my string was displayed.

I think, in general, you should avoid writing Java code which generates
XML/HTML tags, and do that explicitly in your JSP, using the tag library.  In
this case, instead of returning "<option>choice A</option><option>choice
B</option> ...", you should have it return "choice A, choice B, ..." and let
"<c:forEach>" iterate over the string, building your "<option>" elements.

-- 
===================================================================
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]>

Reply via email to