Re: Problems with custom taglibs

2005-10-27 Thread Wendy Smoak

From: "Eric Plante" <[EMAIL PROTECTED]>


I have the one that comes with Exadel studio 3.0 (or eclipse3.1). it is
named jstl.jar but I don'T know which version I have.


Unzip/unjar it (jar -xvf fileame.jar) or open it with WinZip and look in the 
META-INF directory for the manifest.mf file.  It should tell you what 
version you're using.  For Servlet 2.3 you need an implementation of JSTL 
1.0.


Can you post a snippet of the JSP, including the <%@ taglib ...> and the JSP 
code, along with the HTML it renders?


--
Wendy 



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



Re: Problems with custom taglibs

2005-10-27 Thread Eric Plante
I have the one that comes with Exadel studio 3.0 (or eclipse3.1). it is
named jstl.jar but I don'T know which version I have.

All standard taglibs(bean, html and logic) works fine and core tags are
recognized but the variables are seens as common strings and my personnal
taglibs don't compile but not sure if that is tied to the jstl as
well(anyone knows?)

How can I know which jstl.jar version I'm using? it's property doesn't say.

I'm using servlet 2.3(I started my project with an olded version by mistake)

Thanks

> From: "Eric Plante" <[EMAIL PROTECTED]>
>
> > Well, I do have a jstl.jar in the lib of my project already.
>
> Do you also have standard.jar?   (Both are in contrib/struts-el/lib of the
> Struts 1.2.7 distribution.)
>
> -- 
> Wendy
>
>
>
>
>
>
> -
> 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: Problems with custom taglibs

2005-10-27 Thread Wendy Smoak

From: "Eric Plante" <[EMAIL PROTECTED]>


Well, I do have a jstl.jar in the lib of my project already.


Do you also have standard.jar?   (Both are in contrib/struts-el/lib of the 
Struts 1.2.7 distribution.)


--
Wendy






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



Re: Problems with custom taglibs

2005-10-27 Thread Eric Plante
Well, I do have a jstl.jar in the lib of my project already.


> From: "Laurie Harper" <[EMAIL PROTECTED]>
>
> > Yes, you need to add the implementation jars to your application
> > classpath. Which version you need to install will depend on your servlet
> > container.
>
> This might help you sort out which one you need:
>http://wiki.wsmoak.net/cgi-bin/wiki.pl?StrutsAndJSTL
>
> If it's Servlet 2.3, just copy the .jar files under the 'contrib'
directory
> of Struts 1.2.x into your webapp.
>
> -- 
> Wendy
>
>
> -
> 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: Problems with custom taglibs

2005-10-26 Thread Wendy Smoak

From: "Laurie Harper" <[EMAIL PROTECTED]>

Yes, you need to add the implementation jars to your application 
classpath. Which version you need to install will depend on your servlet 
container.


This might help you sort out which one you need:
  http://wiki.wsmoak.net/cgi-bin/wiki.pl?StrutsAndJSTL

If it's Servlet 2.3, just copy the .jar files under the 'contrib' directory 
of Struts 1.2.x into your webapp.


--
Wendy 



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



Re: Problems with custom taglibs

2005-10-26 Thread Rahul Akolkar

>
> Eric Plante wrote:
> > Is there more to add than <%@ taglib uri="http://java.sun.com/jsp/jstl/core";
> > prefix="c" %>
> >  in my jsp page?
> >
> > Eric
> >


Eric -

Since the URI you're using belongs to JSTL 1.1, cross-check that you are:
1) using a Servlet 2.4 container
2) using a Servlet 2.4 web application descriptor
3) using the JSTL 1.1 libraries in the application classpath

-Rahul


> >
> >
> >>Sounds like you didn't add JSTL to your application (that's why the JSTL
> >>expression isn't being evaluated).
> >>
> >>L.
> >>
> >>Eric Plante wrote:
> >>
> >>>Hi,
> >>>
> >>>Wendy, I tried:
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>That's a test to output every key in the Map which contain 10 items.
> >>>
> >>>the tags are recognized but what's output is ${mot.key} once litteraly,
> >
> > the
> >
> >>>strings aren't recognized as data. I tried without the c:out but the
> >
> > reszult
> >
> >>>is the same.
> >>>
> >>>
> >>>
> >>>
> >>>
> So your form has two Maps that are keyed alike?  I don't think you need
> >
> > a
> >
> custom tag (or Struts tags) at all. This iterates over a treeMap and
> >
> > uses
> >
> the key of each 'obj' as the key into a hashMap:
> 
> 
>  ${hashMap[obj.key]}
> 
> 
> That's with the Maps in request scope... if they're coming from the form
> bean, it would be items="${formBeanName.treeMap}" (assuming there is a
> getTreeMap method on your form bean.)
> 
> The above also assumes JSTL 1.1.  If you're using JSTL 1.0 you'd need a
>  in the
> middle rather than just the expression.
> 
> Here's the JSP I was using to play with this:
> <%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>
> 
> <%
>  java.util.TreeMap treeMap = new java.util.TreeMap();
>  treeMap.put( "key1", "value1" );
>  treeMap.put( "key2", "value2" );
>  request.setAttribute( "treeMap", treeMap );
> 
>  java.util.HashMap hashMap = new java.util.HashMap();
>  hashMap.put( "value1", "description1" );
>  hashMap.put( "value2", "description2" );
>  hashMap.put( "key1",   "descByKey1" );
>  hashMap.put( "key2",   "descByKey2" );
>  request.setAttribute( "hashMap", hashMap );
> %>
> 
> 
> 
>  ${hashMap[obj.value]}
> 
> 
> 
> 
> 
>  ${hashMap[obj.key]}
> 
> 
> If you need help adding JSTL to your webapp, just ask.  (We need to know
> what version of the Servlet specification you're working with-- Servlet
> >>>
> >>>2.4
> >>>
> >>>
> (Tomcat 5.x) or something else?)
> 
> HTH,
> --
> Wendy Smoak
> 
> 
> 
> 
> 
> 
> -
> 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: Problems with custom taglibs

2005-10-26 Thread Eric Plante
Can it explain why custom taglibs I made don'T work too?

Thanks
> Yes, you need to add the implementation jars to your application
> classpath. Which version you need to install will depend on your servlet
> container.
>
> L.
>
> Eric Plante wrote:
> > Is there more to add than <%@ taglib
uri="http://java.sun.com/jsp/jstl/core";
> > prefix="c" %>
> >  in my jsp page?
> >
> > Eric
> >
> >
> >
> >>Sounds like you didn't add JSTL to your application (that's why the JSTL
> >>expression isn't being evaluated).
> >>
> >>L.
> >>
> >>Eric Plante wrote:
> >>
> >>>Hi,
> >>>
> >>>Wendy, I tried:
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>That's a test to output every key in the Map which contain 10 items.
> >>>
> >>>the tags are recognized but what's output is ${mot.key} once litteraly,
> >
> > the
> >
> >>>strings aren't recognized as data. I tried without the c:out but the
> >
> > reszult
> >
> >>>is the same.
> >>>
> >>>
> >>>
> >>>
> >>>
> So your form has two Maps that are keyed alike?  I don't think you
need
> >
> > a
> >
> custom tag (or Struts tags) at all. This iterates over a treeMap and
> >
> > uses
> >
> the key of each 'obj' as the key into a hashMap:
> 
> 
>  ${hashMap[obj.key]}
> 
> 
> That's with the Maps in request scope... if they're coming from the
form
> bean, it would be items="${formBeanName.treeMap}" (assuming there is a
> getTreeMap method on your form bean.)
> 
> The above also assumes JSTL 1.1.  If you're using JSTL 1.0 you'd need
a
>  in the
> middle rather than just the expression.
> 
> Here's the JSP I was using to play with this:
> <%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>
> 
> <%
>  java.util.TreeMap treeMap = new java.util.TreeMap();
>  treeMap.put( "key1", "value1" );
>  treeMap.put( "key2", "value2" );
>  request.setAttribute( "treeMap", treeMap );
> 
>  java.util.HashMap hashMap = new java.util.HashMap();
>  hashMap.put( "value1", "description1" );
>  hashMap.put( "value2", "description2" );
>  hashMap.put( "key1",   "descByKey1" );
>  hashMap.put( "key2",   "descByKey2" );
>  request.setAttribute( "hashMap", hashMap );
> %>
> 
> 
> 
>  ${hashMap[obj.value]}
> 
> 
> 
> 
> 
>  ${hashMap[obj.key]}
> 
> 
> If you need help adding JSTL to your webapp, just ask.  (We need to
know
> what version of the Servlet specification you're working with-- 
Servlet
> >>>
> >>>2.4
> >>>
> >>>
> (Tomcat 5.x) or something else?)
> 
> HTH,
> -- 
> Wendy Smoak
> 
> 
> 
> 
> 
> 
> -
> 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: Problems with custom taglibs

2005-10-26 Thread Laurie Harper
Yes, you need to add the implementation jars to your application 
classpath. Which version you need to install will depend on your servlet 
container.


L.

Eric Plante wrote:

Is there more to add than <%@ taglib uri="http://java.sun.com/jsp/jstl/core";
prefix="c" %>
 in my jsp page?

Eric




Sounds like you didn't add JSTL to your application (that's why the JSTL
expression isn't being evaluated).

L.

Eric Plante wrote:


Hi,

Wendy, I tried:


   


That's a test to output every key in the Map which contain 10 items.

the tags are recognized but what's output is ${mot.key} once litteraly,


the


strings aren't recognized as data. I tried without the c:out but the


reszult


is the same.






So your form has two Maps that are keyed alike?  I don't think you need


a


custom tag (or Struts tags) at all. This iterates over a treeMap and


uses


the key of each 'obj' as the key into a hashMap:


${hashMap[obj.key]}


That's with the Maps in request scope... if they're coming from the form
bean, it would be items="${formBeanName.treeMap}" (assuming there is a
getTreeMap method on your form bean.)

The above also assumes JSTL 1.1.  If you're using JSTL 1.0 you'd need a
 in the
middle rather than just the expression.

Here's the JSP I was using to play with this:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>

<%
java.util.TreeMap treeMap = new java.util.TreeMap();
treeMap.put( "key1", "value1" );
treeMap.put( "key2", "value2" );
request.setAttribute( "treeMap", treeMap );

java.util.HashMap hashMap = new java.util.HashMap();
hashMap.put( "value1", "description1" );
hashMap.put( "value2", "description2" );
hashMap.put( "key1",   "descByKey1" );
hashMap.put( "key2",   "descByKey2" );
request.setAttribute( "hashMap", hashMap );
%>



${hashMap[obj.value]}





${hashMap[obj.key]}


If you need help adding JSTL to your webapp, just ask.  (We need to know
what version of the Servlet specification you're working with-- Servlet


2.4



(Tomcat 5.x) or something else?)

HTH,
--
Wendy Smoak






-
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: Problems with custom taglibs

2005-10-25 Thread Eric Plante
Is there more to add than <%@ taglib uri="http://java.sun.com/jsp/jstl/core";
prefix="c" %>
 in my jsp page?

Eric


> Sounds like you didn't add JSTL to your application (that's why the JSTL
> expression isn't being evaluated).
>
> L.
>
> Eric Plante wrote:
> > Hi,
> >
> > Wendy, I tried:
> >
> > 
> > 
> > 
> >
> > That's a test to output every key in the Map which contain 10 items.
> >
> > the tags are recognized but what's output is ${mot.key} once litteraly,
the
> > strings aren't recognized as data. I tried without the c:out but the
reszult
> > is the same.
> >
> >
> >
> >
> >>So your form has two Maps that are keyed alike?  I don't think you need
a
> >>custom tag (or Struts tags) at all. This iterates over a treeMap and
uses
> >>the key of each 'obj' as the key into a hashMap:
> >>
> >>
> >>  ${hashMap[obj.key]}
> >>
> >>
> >>That's with the Maps in request scope... if they're coming from the form
> >>bean, it would be items="${formBeanName.treeMap}" (assuming there is a
> >>getTreeMap method on your form bean.)
> >>
> >>The above also assumes JSTL 1.1.  If you're using JSTL 1.0 you'd need a
> >> in the
> >>middle rather than just the expression.
> >>
> >>Here's the JSP I was using to play with this:
> >><%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>
> >>
> >><%
> >>  java.util.TreeMap treeMap = new java.util.TreeMap();
> >>  treeMap.put( "key1", "value1" );
> >>  treeMap.put( "key2", "value2" );
> >>  request.setAttribute( "treeMap", treeMap );
> >>
> >>  java.util.HashMap hashMap = new java.util.HashMap();
> >>  hashMap.put( "value1", "description1" );
> >>  hashMap.put( "value2", "description2" );
> >>  hashMap.put( "key1",   "descByKey1" );
> >>  hashMap.put( "key2",   "descByKey2" );
> >>  request.setAttribute( "hashMap", hashMap );
> >>%>
> >>
> >>
> >>
> >>  ${hashMap[obj.value]}
> >>
> >>
> >>
> >>
> >>
> >>  ${hashMap[obj.key]}
> >>
> >>
> >>If you need help adding JSTL to your webapp, just ask.  (We need to know
> >>what version of the Servlet specification you're working with-- Servlet
> >
> > 2.4
> >
> >>(Tomcat 5.x) or something else?)
> >>
> >>HTH,
> >>-- 
> >>Wendy Smoak
> >>
> >>
> >>
> >>
> >>
> >>
> >>-
> >>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: Problems with custom taglibs

2005-10-25 Thread Laurie Harper
Sounds like you didn't add JSTL to your application (that's why the JSTL 
expression isn't being evaluated).


L.

Eric Plante wrote:

Hi,

Wendy, I tried:





That's a test to output every key in the Map which contain 10 items.

the tags are recognized but what's output is ${mot.key} once litteraly, the
strings aren't recognized as data. I tried without the c:out but the reszult
is the same.





So your form has two Maps that are keyed alike?  I don't think you need a
custom tag (or Struts tags) at all. This iterates over a treeMap and uses
the key of each 'obj' as the key into a hashMap:


 ${hashMap[obj.key]}


That's with the Maps in request scope... if they're coming from the form
bean, it would be items="${formBeanName.treeMap}" (assuming there is a
getTreeMap method on your form bean.)

The above also assumes JSTL 1.1.  If you're using JSTL 1.0 you'd need a
 in the
middle rather than just the expression.

Here's the JSP I was using to play with this:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>

<%
 java.util.TreeMap treeMap = new java.util.TreeMap();
 treeMap.put( "key1", "value1" );
 treeMap.put( "key2", "value2" );
 request.setAttribute( "treeMap", treeMap );

 java.util.HashMap hashMap = new java.util.HashMap();
 hashMap.put( "value1", "description1" );
 hashMap.put( "value2", "description2" );
 hashMap.put( "key1",   "descByKey1" );
 hashMap.put( "key2",   "descByKey2" );
 request.setAttribute( "hashMap", hashMap );
%>



 ${hashMap[obj.value]}





 ${hashMap[obj.key]}


If you need help adding JSTL to your webapp, just ask.  (We need to know
what version of the Servlet specification you're working with-- Servlet


2.4


(Tomcat 5.x) or something else?)

HTH,
--
Wendy Smoak






-
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: Problems with custom taglibs

2005-10-25 Thread Eric Plante
Hi,

Wendy, I tried:





That's a test to output every key in the Map which contain 10 items.

the tags are recognized but what's output is ${mot.key} once litteraly, the
strings aren't recognized as data. I tried without the c:out but the reszult
is the same.



> So your form has two Maps that are keyed alike?  I don't think you need a
> custom tag (or Struts tags) at all. This iterates over a treeMap and uses
> the key of each 'obj' as the key into a hashMap:
>
> 
>   ${hashMap[obj.key]}
> 
>
> That's with the Maps in request scope... if they're coming from the form
> bean, it would be items="${formBeanName.treeMap}" (assuming there is a
> getTreeMap method on your form bean.)
>
> The above also assumes JSTL 1.1.  If you're using JSTL 1.0 you'd need a
>  in the
> middle rather than just the expression.
>
> Here's the JSP I was using to play with this:
> <%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>
>
> <%
>   java.util.TreeMap treeMap = new java.util.TreeMap();
>   treeMap.put( "key1", "value1" );
>   treeMap.put( "key2", "value2" );
>   request.setAttribute( "treeMap", treeMap );
>
>   java.util.HashMap hashMap = new java.util.HashMap();
>   hashMap.put( "value1", "description1" );
>   hashMap.put( "value2", "description2" );
>   hashMap.put( "key1",   "descByKey1" );
>   hashMap.put( "key2",   "descByKey2" );
>   request.setAttribute( "hashMap", hashMap );
> %>
>
>
> 
>   ${hashMap[obj.value]}
> 
>
> 
>
> 
>   ${hashMap[obj.key]}
> 
>
> If you need help adding JSTL to your webapp, just ask.  (We need to know
> what version of the Servlet specification you're working with-- Servlet
2.4
> (Tomcat 5.x) or something else?)
>
> HTH,
> -- 
> Wendy Smoak
>
>
>
>
>
>
> -
> 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: Problems with custom taglibs

2005-10-23 Thread Martin Gainty

Eric-|
Can you post the web.xml, struts-config.xml and the Tag source code so we 
can run it on our own boxes

We would need to see all of these to understand whats going on..
Martin-
- Original Message - 
From: "Eric Plante" <[EMAIL PROTECTED]>

To: "Struts Users Mailing List" 
Sent: Sunday, October 23, 2005 3:26 PM
Subject: Re: Problems with custom taglibs



I find those core tags to look too much like a disguised version of  <% %>
tag which I prefer to avoid if I could.

I'd rather want to know what's wrong with the custom tag I designed. I 
want

to learn how to make them and this one should work but doesn't.

I'm using version 2.3 and I'm using tomcat 5.5.9

- Original Message - 
From: "Wendy Smoak" <[EMAIL PROTECTED]>

To: "Struts Users Mailing List" 
Sent: Sunday, October 23, 2005 3:05 PM
Subject: Re: Problems with custom taglibs



From: "Eric Plante" <[EMAIL PROTECTED]>

>I tried with the c:out tag within the iterate:iterate tag and it simply
> print out the string, same thing if I just write the variable itself.
>
> is the c:foreach the only way to do it? I'd rather not make a drstic
> change
> to my site and I want to practice doing my own tag too.

JSTL is a standard and is the recommended way to iterate over 
collections.

I would save the custom tags for things that aren't already available in
Struts or JSTL.  You'll probably find something specific to your

application

that you can practice on.

Post the code that isn't working and someone will take a look.  My guess

is

that you missed the ${} around the text, without that it will not be
evaluated as an expression.

I'm about to throw out a bunch of acronyms and version numbers, but in

order

to help I need to know what you're using.

First, what Servlet container and version are you using?  (The real

question
is: "What version of the Servlet spec are you using?")  Look at the top 
of

your web.xml file, it should say .  That's the

number

I need.

I noticed that your tld specified JSP 1.1, so if you have to support

Servlet

2.2/JSP 1.1, I don't think JSTL is an option.  JSTL 1.0 requires at least
Servlet 2.3/JSP 1.2 (Tomcat 4.x).
  http://jakarta.apache.org/taglibs/doc/standard-1.0-doc/intro.html

--
Wendy Smoak



-
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: Problems with custom taglibs

2005-10-23 Thread Eric Plante
I find those core tags to look too much like a disguised version of  <% %>
tag which I prefer to avoid if I could.

I'd rather want to know what's wrong with the custom tag I designed. I want
to learn how to make them and this one should work but doesn't.

I'm using version 2.3 and I'm using tomcat 5.5.9

- Original Message - 
From: "Wendy Smoak" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" 
Sent: Sunday, October 23, 2005 3:05 PM
Subject: Re: Problems with custom taglibs


> From: "Eric Plante" <[EMAIL PROTECTED]>
>
> >I tried with the c:out tag within the iterate:iterate tag and it simply
> > print out the string, same thing if I just write the variable itself.
> >
> > is the c:foreach the only way to do it? I'd rather not make a drstic
> > change
> > to my site and I want to practice doing my own tag too.
>
> JSTL is a standard and is the recommended way to iterate over collections.
> I would save the custom tags for things that aren't already available in
> Struts or JSTL.  You'll probably find something specific to your
application
> that you can practice on.
>
> Post the code that isn't working and someone will take a look.  My guess
is
> that you missed the ${} around the text, without that it will not be
> evaluated as an expression.
>
> I'm about to throw out a bunch of acronyms and version numbers, but in
order
> to help I need to know what you're using.
>
> First, what Servlet container and version are you using?  (The real
question
> is: "What version of the Servlet spec are you using?")  Look at the top of
> your web.xml file, it should say .  That's the
number
> I need.
>
> I noticed that your tld specified JSP 1.1, so if you have to support
Servlet
> 2.2/JSP 1.1, I don't think JSTL is an option.  JSTL 1.0 requires at least
> Servlet 2.3/JSP 1.2 (Tomcat 4.x).
>   http://jakarta.apache.org/taglibs/doc/standard-1.0-doc/intro.html
>
> -- 
> Wendy Smoak
>
>
>
> -
> 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: Problems with custom taglibs

2005-10-23 Thread Wendy Smoak

From: "Eric Plante" <[EMAIL PROTECTED]>


I tried with the c:out tag within the iterate:iterate tag and it simply
print out the string, same thing if I just write the variable itself.

is the c:foreach the only way to do it? I'd rather not make a drstic 
change

to my site and I want to practice doing my own tag too.


JSTL is a standard and is the recommended way to iterate over collections. 
I would save the custom tags for things that aren't already available in 
Struts or JSTL.  You'll probably find something specific to your application 
that you can practice on.


Post the code that isn't working and someone will take a look.  My guess is 
that you missed the ${} around the text, without that it will not be 
evaluated as an expression.


I'm about to throw out a bunch of acronyms and version numbers, but in order 
to help I need to know what you're using.


First, what Servlet container and version are you using?  (The real question 
is: "What version of the Servlet spec are you using?")  Look at the top of 
your web.xml file, it should say .  That's the number 
I need.


I noticed that your tld specified JSP 1.1, so if you have to support Servlet 
2.2/JSP 1.1, I don't think JSTL is an option.  JSTL 1.0 requires at least 
Servlet 2.3/JSP 1.2 (Tomcat 4.x).

 http://jakarta.apache.org/taglibs/doc/standard-1.0-doc/intro.html

--
Wendy Smoak 




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



Re: Problems with custom taglibs

2005-10-23 Thread Eric Plante
I tried with the c:out tag within the iterate:iterate tag and it simply
print out the string, same thing if I just write the variable itself.

is the c:foreach the only way to do it? I'd rather not make a drstic change
to my site and I want to practice doing my own tag too.

> From: "Eric Plante" <[EMAIL PROTECTED]>
>
> > I have a logic:iterate on a Map. let say that the object name obj is
taken
> > out of the Map. I use obj inside the logic:iterate to get the key and
> > value of each obj without a problem.
> >
> > Now, what I need to do is to use the obj's key on another Map in the
form
> > object
> >
> > The tag is supposed to print out the String value for obj's key in
> > hashMap, obj come from treeMap.
>
> So your form has two Maps that are keyed alike?  I don't think you need a
> custom tag (or Struts tags) at all. This iterates over a treeMap and uses
> the key of each 'obj' as the key into a hashMap:
>
> 
>   ${hashMap[obj.key]}
> 
>
> That's with the Maps in request scope... if they're coming from the form
> bean, it would be items="${formBeanName.treeMap}" (assuming there is a
> getTreeMap method on your form bean.)
>
> The above also assumes JSTL 1.1.  If you're using JSTL 1.0 you'd need a
>  in the
> middle rather than just the expression.
>
> Here's the JSP I was using to play with this:
> <%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>
>
> <%
>   java.util.TreeMap treeMap = new java.util.TreeMap();
>   treeMap.put( "key1", "value1" );
>   treeMap.put( "key2", "value2" );
>   request.setAttribute( "treeMap", treeMap );
>
>   java.util.HashMap hashMap = new java.util.HashMap();
>   hashMap.put( "value1", "description1" );
>   hashMap.put( "value2", "description2" );
>   hashMap.put( "key1",   "descByKey1" );
>   hashMap.put( "key2",   "descByKey2" );
>   request.setAttribute( "hashMap", hashMap );
> %>
>
>
> 
>   ${hashMap[obj.value]}
> 
>
> 
>
> 
>   ${hashMap[obj.key]}
> 
>
> If you need help adding JSTL to your webapp, just ask.  (We need to know
> what version of the Servlet specification you're working with-- Servlet
2.4
> (Tomcat 5.x) or something else?)
>
> HTH,
> -- 
> Wendy Smoak
>
>
>
>
>
>
> -
> 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: Problems with custom taglibs

2005-10-23 Thread Eric Plante
> I don't know what this 

Re: Problems with custom taglibs

2005-10-23 Thread Eric Plante
I don't know what this html, logic and this custom tag of mine. It's not just a matter of making it 
work, it's also a matter of learning how to make a taglib and also because 
the whole page is made of those taglibs.


I simplified it to keep the bare minimum for what I really need now.

fetch.tld is


1.1//EN"

"http://java.sun.com/dtd/web-jsptaglibrary_1_1.dtd";>

1.0
1.1
fetch

valeur
FetchValue
JSP



I took the info from the bean tld so it should be correct

the class FetchValue is:
import javax.servlet.jsp.tagext.*;

public class FetchValue extends BodyTagSupport{
private static final long serialVersionUID = 1L;

public int doAfterBody(){
 BodyContent body = getBodyContent();
 String label = body.getString();
 System.out.println(label);
 try{
  body.getEnclosingWriter().println(label);
 }
 catch(Exception ex){
  ex.printStackTrace();
 }
 return EVAL_PAGE;
}
}

the jsp page for what I need is:
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/fetch.tld" prefix="fetch" %>

...

  
 
  

...

I get this error:
org.apache.jasper.JasperException: Unable to compile class for JSP

Thanks

From: "Eric Plante" <[EMAIL PROTECTED]>

> I have a logic:iterate on a Map. let say that the object name obj is

taken

> out of the Map. I use obj inside the logic:iterate to get the key and
> value of each obj without a problem.
>
> Now, what I need to do is to use the obj's key on another Map in the

form

> object
>
> The tag is supposed to print out the String value for obj's key in
> hashMap, obj come from treeMap.

So your form has two Maps that are keyed alike?  I don't think you need a
custom tag (or Struts tags) at all. This iterates over a treeMap and uses
the key of each 'obj' as the key into a hashMap:


  ${hashMap[obj.key]}


That's with the Maps in request scope... if they're coming from the form
bean, it would be items="${formBeanName.treeMap}" (assuming there is a
getTreeMap method on your form bean.)

The above also assumes JSTL 1.1.  If you're using JSTL 1.0 you'd need a
 in the
middle rather than just the expression.

Here's the JSP I was using to play with this:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>

<%
  java.util.TreeMap treeMap = new java.util.TreeMap();
  treeMap.put( "key1", "value1" );
  treeMap.put( "key2", "value2" );
  request.setAttribute( "treeMap", treeMap );

  java.util.HashMap hashMap = new java.util.HashMap();
  hashMap.put( "value1", "description1" );
  hashMap.put( "value2", "description2" );
  hashMap.put( "key1",   "descByKey1" );
  hashMap.put( "key2",   "descByKey2" );
  request.setAttribute( "hashMap", hashMap );
%>



  ${hashMap[obj.value]}





  ${hashMap[obj.key]}


If you need help adding JSTL to your webapp, just ask.  (We need to know
what version of the Servlet specification you're working with-- Servlet

2.4

(Tomcat 5.x) or something else?)

HTH,
--
Wendy Smoak






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
- Original Message - 
From: "Wendy Smoak" <[EMAIL PROTECTED]>

To: "Struts Users Mailing List" 
Sent: Sunday, October 23, 2005 12:05 PM
Subject: Re: Problems with custom taglibs



From: "Eric Plante" <[EMAIL PROTECTED]>

> I have a logic:iterate on a Map. let say that the object name obj is

taken

> out of the Map. I use obj inside the logic:iterate to get the key and
> value of each obj without a problem.
>
> Now, what I need to do is to use the obj's key on another Map in the

form

> object
>
> The tag is supposed to print out the String value for obj's key in
> hashMap, obj come from treeMap.

So your form has two Maps that are keyed alike?  I don't think you need a
custom tag (or Struts tags) at all. This iterates over a treeMap and uses
the key of each 'obj' as the key into a hashMap:


  ${hashMap[obj.key]}


That's with the Maps in request scope... if they're coming from the form
bean, it would be items="${formBeanName.treeMap}" (assuming there is a
getTreeMap method on your form bean.)

The above also assumes JSTL 1.1.  If you're using JSTL 1.0 you'd need a
 in the
middle rather than just the expression.

Here's the JSP I was using to play with this:
<%@ taglib uri="http://java.sun.com/jsp/jstl/co

Re: Problems with custom taglibs

2005-10-23 Thread Wendy Smoak

From: "Eric Plante" <[EMAIL PROTECTED]>


I have a logic:iterate on a Map. let say that the object name obj is taken
out of the Map. I use obj inside the logic:iterate to get the key and
value of each obj without a problem.

Now, what I need to do is to use the obj's key on another Map in the form
object

The tag is supposed to print out the String value for obj's key in
hashMap, obj come from treeMap.


So your form has two Maps that are keyed alike?  I don't think you need a
custom tag (or Struts tags) at all. This iterates over a treeMap and uses
the key of each 'obj' as the key into a hashMap:


 ${hashMap[obj.key]}


That's with the Maps in request scope... if they're coming from the form
bean, it would be items="${formBeanName.treeMap}" (assuming there is a
getTreeMap method on your form bean.)

The above also assumes JSTL 1.1.  If you're using JSTL 1.0 you'd need a
 in the
middle rather than just the expression.

Here's the JSP I was using to play with this:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>

<%
 java.util.TreeMap treeMap = new java.util.TreeMap();
 treeMap.put( "key1", "value1" );
 treeMap.put( "key2", "value2" );
 request.setAttribute( "treeMap", treeMap );

 java.util.HashMap hashMap = new java.util.HashMap();
 hashMap.put( "value1", "description1" );
 hashMap.put( "value2", "description2" );
 hashMap.put( "key1",   "descByKey1" );
 hashMap.put( "key2",   "descByKey2" );
 request.setAttribute( "hashMap", hashMap );
%>



 ${hashMap[obj.value]}





 ${hashMap[obj.key]}


If you need help adding JSTL to your webapp, just ask.  (We need to know
what version of the Servlet specification you're working with-- Servlet 2.4
(Tomcat 5.x) or something else?)

HTH,
--
Wendy Smoak






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



Problems with custom taglibs

2005-10-23 Thread Eric Plante
Hi,

After reading about how to make taglibs, I can't fathom how I can make what I 
want to do even afer consulting some tutorials.

I have a logic:iterate on a Map. let say that the object name obj is taken out 
of the Map. I use obj inside the logic:iterate to get the key and value of each 
obj without a problem.

Now, what I need to do is to use the obj's key on another Map in the form 
object which would be easy if I had control over the session and request object 
and was using normal jsp programming but I have no idea how to do so with 
struts using taglibs.

I had the idea of doing it by creating my own taglib but I didn't manage to do 
it even after consulting some tutorials.

I started with this tag configuration in mind:
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/fetch.tld" prefix="fetch" %>







PandoraForm is the form object.
hashMap is a property of type HashMap in PandoraForm.

The tag is supposed to print out the String value for obj's key in hashMap, obj 
come from treeMap.

I made this tld:

http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd";>

1.0
1.2
fetch

valeur
FetchValueIntoMap
JSP

name
true


property
true




now, assuming that it's good until now, I have trouble making my class, What I 
have now is this:

import javax.servlet.jsp.tagext.*;
import java.util.*;

public class FetchValueIntoMap extends BodyTagSupport{
private ??? property;
private ??? name;

private static final long serialVersionUID = 1L;

public int doAfterBody(){
System.out.println(property);
System.out.println(name);

String label = "";
BodyContent body = getBodyContent();
String key = body.getString();
System.out.println(key);
//will loop over the Map if I can get it
try{
body.getEnclosingWriter().println(label);
}
catch(Exception ex){
ex.printStackTrace();
}
return EVAL_PAGE;
}

public ??? getName(){
return name;
}
public void setName(??? name){
this.name = name;
}
public ??? getProperty(){
return property;
}
public void setProperty(??? property){
this.property = property;
}
}

Any idea how I can make this freak tag to work?
Thanks