You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Marcus Beyer <mb...@stormlight.de> on 2005/01/24 12:26:43 UTC

precompilation and JSTL

Hello all!

I am trying to precompile my JSPs using org.apache.jasper.JspC.
Problem: The ones that use JSTL result in uncompilable Java code.
[Sorry for my english. Is it uncompilable or incompilable?]

Example:

   <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
   <title>JSTL test</title>
   <c:if test="${true}">
     <c:out value="this is JSTL :)" />
   </c:if>	

The resulting Java file contains this line:

   if (_jspx_meth_c_out_0(_jspx_th_c_if_0, _jspx_page_context))
   return true;

The (Eclipse) compiler complains:

   The method _jspx_meth_c_out_0(JspTag, PageContext) in the type
   test_jsp is not applicable for the arguments (IfTag, PageContext)

"IfTag" is org.apache.taglibs.standard.tag.el.core.IfTag.
"JspTag" is javax.servlet.jsp.tagext.JspTag.

IfTag extends javax.servlet.jsp.jstl.core.ConditionalTagSupport.
ConditionalTagSupport extends javax.servlet.jsp.tagext.TagSupport.
TagSupport implements javax.servlet.jsp.tagext.JspTag.

So this looks right. Any idea what the problem is?
I am using JSTL 1.1.2 with Tomcat 5.0.26.

best wishes,
Marcus Beyer


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: precompilation and JSTL

Posted by Marcus Beyer <mb...@stormlight.de>.
Tim Funk schrieb:

> Is your web.xml using the 2.4 declaration?

Yes it is.

The problem has to do with precompilation, because it works if I deploy 
the JSPs instead of the servlets.

>> Example: <c:out value="1 + 2 = ${1 + 2}" />

The precompiled Java code looks like this:

_jspx_th_c_out_1.setValue(new String("1 + 2 = ${1 + 2}"));

Whereas the Java code compiled after deployment looks like this:

_jspx_th_c_out_1.setValue((java.lang.Object) 
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("1 + 2 = 
${1 + 2}", java.lang.Object.class, (PageContext)_jspx_page_context, 
null, false));

Why is it different??

-- 

Grüße, Marcus

<http://www.Stormlight.de>

"Whatever you do will be insignificant,
  but it is very important that you do it." -- Gandhi

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: precompilation and JSTL

Posted by Marcus Beyer <mb...@stormlight.de>.
David Smith schrieb:

> Just a thought:
> Last I knew using the j2ee jar w/ Tomcat == EVIL.  You can either use 
> the j2ee distribution on Sun's site OR Jakarta Tomcat (w/ j2sdk, not 
> j2ee), but never j2ee and jakarta tomcat together.  It'll create some 
> really ugly version conflicts.  If you use jakarta tomcat from 
> jakarta.apache.org, use the jar files that have the specific functions 
> you need instead.

Oh yeah. Now it works! I also forgot to clean the previously precompiled ...

Thank you, David and Tim!!

-- 

Grüße, Marcus

<http://www.Stormlight.de>

"Whatever you do will be insignificant,
  but it is very important that you do it." -- Gandhi

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: precompilation and JSTL

Posted by David Smith <dn...@cornell.edu>.
Just a thought: 

Last I knew using the j2ee jar w/ Tomcat == EVIL.  You can either use 
the j2ee distribution on Sun's site OR Jakarta Tomcat (w/ j2sdk, not 
j2ee), but never j2ee and jakarta tomcat together.  It'll create some 
really ugly version conflicts.  If you use jakarta tomcat from 
jakarta.apache.org, use the jar files that have the specific functions 
you need instead. 

For jstl, that would be the standard-1.1 tag lib available here: 
http://jakarta.apache.org/taglibs/index.html.  D/L the standard taglibs, 
drop the jars in your WEB-INF/lib directory, and include the taglibs in 
your web.xml per the docs.  Restart the context and your done.

--David

Tim Funk wrote:

> Is your web.xml using the 2.4 declaration?
>
> -Tim
>
> Marcus Beyer wrote:
>
>> Tim Funk schrieb:
>>
>> I finally solved my (first) problem: I had a wrong lib (J2EE 1.3) in 
>> my class path. So there was some kind of version mismatch ...
>>
>>> Are you sure you want
>>> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
>>> and not
>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
>>
>>
>>
>> But still my pages do not work if I specify to use the jstl 1.1 taglib.
>>
>> Example: <c:out value="1 + 2 = ${1 + 2}" />
>>
>> With 1.0 taglib I get "1 + 2 = 3".
>> With 1.1 taglib I get "1 + 2 = ${1 + 2}".
>>
>> Any idea about this?
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: precompilation and JSTL

Posted by Tim Funk <fu...@joedog.org>.
Is your web.xml using the 2.4 declaration?

-Tim

Marcus Beyer wrote:

> Tim Funk schrieb:
> 
> I finally solved my (first) problem: I had a wrong lib (J2EE 1.3) in my 
> class path. So there was some kind of version mismatch ...
> 
>> Are you sure you want
>> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
>> and not
>> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
> 
> 
> But still my pages do not work if I specify to use the jstl 1.1 taglib.
> 
> Example: <c:out value="1 + 2 = ${1 + 2}" />
> 
> With 1.0 taglib I get "1 + 2 = 3".
> With 1.1 taglib I get "1 + 2 = ${1 + 2}".
> 
> Any idea about this?
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: precompilation and JSTL

Posted by Marcus Beyer <mb...@stormlight.de>.
Tim Funk schrieb:

I finally solved my (first) problem: I had a wrong lib (J2EE 1.3) in my 
class path. So there was some kind of version mismatch ...

> Are you sure you want
> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
> and not
> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

But still my pages do not work if I specify to use the jstl 1.1 taglib.

Example: <c:out value="1 + 2 = ${1 + 2}" />

With 1.0 taglib I get "1 + 2 = 3".
With 1.1 taglib I get "1 + 2 = ${1 + 2}".

Any idea about this?


-- 

Grüße, Marcus

<http://www.Stormlight.de>

"Whatever you do will be insignificant,
  but it is very important that you do it." -- Gandhi

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: precompilation and JSTL

Posted by Marcus Beyer <mb...@stormlight.de>.
Tim Funk schrieb:

> Are you sure you want
> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
> and not
> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
> 
> -Tim
> 
>>   <c:if test="${true}">
>>     <c:out value="this is JSTL :)" />
>>   </c:if>  

Strange. After changing to JSTL 1.1 taglib, that c:if thing above does 
not work anymore. Isn't ${true} correct here?


-- 

Grüße, Marcus

<http://www.Stormlight.de>

"Whatever you do will be insignificant,
  but it is very important that you do it." -- Gandhi

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: precompilation and JSTL

Posted by Marcus Beyer <mb...@stormlight.de>.
Tim Funk schrieb:

> Are you sure you want
> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
> and not
> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

Oh, right. Thank you!

Unfortunately the error persists nevertheless ...


-- 

Grüße, Marcus

<http://www.Stormlight.de>

"Whatever you do will be insignificant,
  but it is very important that you do it." -- Gandhi

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: precompilation and JSTL

Posted by Tim Funk <fu...@joedog.org>.
Are you sure you want
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
and not
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

-Tim

Marcus Beyer wrote:
> 
> Hello all!
> 
> I am trying to precompile my JSPs using org.apache.jasper.JspC.
> Problem: The ones that use JSTL result in uncompilable Java code.
> [Sorry for my english. Is it uncompilable or incompilable?]
> 
> Example:
> 
>   <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
>   <title>JSTL test</title>
>   <c:if test="${true}">
>     <c:out value="this is JSTL :)" />
>   </c:if>   
> 
> The resulting Java file contains this line:
> 
>   if (_jspx_meth_c_out_0(_jspx_th_c_if_0, _jspx_page_context))
>   return true;
> 
> The (Eclipse) compiler complains:
> 
>   The method _jspx_meth_c_out_0(JspTag, PageContext) in the type
>   test_jsp is not applicable for the arguments (IfTag, PageContext)
> 
> "IfTag" is org.apache.taglibs.standard.tag.el.core.IfTag.
> "JspTag" is javax.servlet.jsp.tagext.JspTag.
> 
> IfTag extends javax.servlet.jsp.jstl.core.ConditionalTagSupport.
> ConditionalTagSupport extends javax.servlet.jsp.tagext.TagSupport.
> TagSupport implements javax.servlet.jsp.tagext.JspTag.
> 
> So this looks right. Any idea what the problem is?
> I am using JSTL 1.1.2 with Tomcat 5.0.26.
> 
> best wishes,
> Marcus Beyer
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org