Small clarification that the Servlet 2.4/JSP 2.0 specs don't include/require
JSTL. Although a given container may include a JSTL implementation (like Resin,
I believe), it's not a requirement. For example, Tomcat 5.0 does not include a
JSTL implementation. For JSP 1.2, use JSTL 1.0. For JSP 2.0, use JSTL 1.1. As
Robert illustrated, the taglib URIs are not the same for the two JSTL
versions.

Quoting Robert Taylor <[EMAIL PROTECTED]>:

> I'm sorry, I've missed parts of this thread, but this
> last message caught my eye when you said it's printing
> ${contentId} to the screen instead of the value of contentId.
> 
> Which servlet spec. does your container support? I've seen this
> type of behavior when the container supports Servlet Spec. 2.4 but
> the web.xml file is referring to the 2.3 dtd.
> 
> If your container does support the 2.4 spec, then make sure your
> web.xml file has
> 
> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>
> 
> in its root element.
> 
> Again, if your container does support the 2.4 spec, then you
> shouldn't need any .tld files or even jar files for JSTL.
> All you should have to do is add (or include) something like this to the
> top of your .jsp page.
> 
> <%-- JSTL Standard Tags --%>
> <%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>
> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"; prefix="fmt" %>
> 
> If your container does not support the 2.4 spec, then you will need
> to include the appropriate .tld and .jar files and update your web.xml
> file to reference the appropriate .tld file(s).
> 
> robert
> 
> 
> 
> 
> 
> > -----Original Message-----
> > From: klute [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, June 24, 2004 10:01 AM
> > To: Struts Users Mailing List
> > Subject: Re: Setting html:hidden property using JSTL
> >
> >
> > Hello All,
> >
> > I *really* appreciate your help.  Because of a
> > hard-pressing work deadline, i actually gave up on
> > getting that to work using JSTL and ended up using the
> >  ugly <input type="hidden" name="contentId"
> > value="<%=request.getAttribute("contentId")%>"/>
> > instead.
> >
> > I'll definitely come back to JSTL at a later time
> > since i consider that to be a proper way of doing this
> > sort of things.
> >
> > Robert, if ${contentId} is available as an attribute
> > (which it was) and not as a parameter, i would expect
> > it to produce null or something instead of literally
> > printing out ${contentId} string...
> >
> > Rick, i tried creating a var in the jsp and the result
> > would still be the same: the value of the hidden
> > property was printed out as {$myVar}. And, if i do
> > c:out in the begging of the jsp, i do get an actual
> > int value printed. weird... i definitely need to spend
> > more time doing my homework to understand how it
> > works...
> >
> > All the best,
> > James
> >
> > --- Rick Reumann <[EMAIL PROTECTED]> wrote:
> > > klute wrote:
> > >
> > > > Yes, the struts-el.jar is in WEB-INF/lib
> > > >
> > > > --- Rick Reumann <[EMAIL PROTECTED]> wrote:
> > > >
> > > >>klute wrote:
> > > >>
> > > >>
> > > >>><input type="hidden" name="contentId"
> > > >>>value="${contentId}">
> > > >>>
> > > >>>This are the tagligs i am importing on this page:
> > > >>><%@ taglib uri="/WEB-INF/struts-bean.tld"
> > > >>>prefix="bean" %>
> > > >>><%@ taglib uri="/WEB-INF/struts-html.tld"
> > > >>>prefix="html" %>
> > > >>><%@ taglib uri="/WEB-INF/struts-html-el.tld"
> > > >>>prefix="html-el" %>
> > > >>><%@ taglib uri="http://java.sun.com/jstl/core";
> > > >>>prefix="c" %>
> > > >>>
> > > >>>
> > > >>>What am i doing wrong?
> > >
> > > Not sure. If you have
> > > - struts-el jar included
> > > - proper definition of the tld in web.xml
> > > - proper declaration for the tld on top of the page
> > >
> > > then using it as:
> > > <html-el:hidden property="contentId"
> > > value="${contentId}"/>
> > > should be fine.
> > >
> > > The only thing I'm still concerned about and maybe
> > > somehow it's related
> > > is that contentId has to be a property of your
> > > ActionForm or else Struts
> > > would complain that it couldn't find the property
> > > 'contentId' Are you
> > > maybe creating the "contentId" var dynamically first
> > > in the JSP page and
> > > then trying to set as above? "Usually" you don't
> > > need to do like you are
> > > doing (setting the value) since that value can be
> > > set before you get to
> > > the page and thus just doing <html:hidden
> > > property="contentId" would be
> > > fine.
> > >
> > > What does <c:out value="${contentId}"/> produce on
> > > the page (or in
> > > source) when placed right before the html-el hidden
> > > tag?
> > >
> > > --
> > > Rick

-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

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

Reply via email to