Al salamo 3alykom,
I don't know why expression lang. doesn't work with me.
here's an example, and please tell me why :
--- the jsp page with EL ==> doesn't work :
<%-- In the name of ALLAH most gacious most merciful --%>
<%@ page language="java" %>
<%@ taglib uri="/cartlib" prefix="cart" %>
<html>
<jsp:useBean id="product" class="ch16.cart.ProductCatalog" scope="application" />
<cart:showCatalog productCatalog="${product}" addToShoppingCartUri="<%= response.encodeURL("AddToShoppingCart.jsp") %>" />
</html>
when using expressions instead, the page works .
the new page is :
<%-- In the name of ALLAH most gacious most merciful --%>
<%@ page language="java" %>
<%@ taglib uri="/cartlib" prefix="cart" %>
<html>
<jsp:useBean id="product" class="ch16.cart.ProductCatalog" scope="application" />
<cart:showCatalog productCatalog="<%= product %>"
addToShoppingCartUri="<%=
response.encodeURL("AddToShoppingCart.jsp") %>" />
</html>
The error was :
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: jsp.error.beans.property.conversion
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
org.apache.jasper.JasperException: jsp.error.beans.property.conversion
org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(JspRuntimeLibrary.java:885)
org.apache.jsp.ShowProductCatalog_jsp._jspService(ShowProductCatalog_jsp.java:77)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.20 logs.






Can you include the TLD of
Can you include the TLD of the cart taglib?
Ahmed Hashim hashimblog/
I already include it, watch out again
If you please, check it again please
the code that doesn't work:
<%-- In the name of ALLAH most gacious most merciful --%>
<%@ page language="java" %>
<%@ taglib uri="/cartlib" prefix="cart" %>
<html>
<jsp:useBean id="product" class="ch16.cart.ProductCatalog" scope="application" />
<cart:showCatalog productCatalog="${product}" addToShoppingCartUri="<%= response.encodeURL("AddToShoppingCart.jsp") %>" />
</html>
and this the code that works fine :
<%-- In the name of ALLAH most gacious most merciful --%>
<%@ page language="java" %>
<%@ taglib uri="/cartlib" prefix="cart" %>
<html>
<jsp:useBean id="product" class="ch16.cart.ProductCatalog" scope="application" />
<cart:showCatalog productCatalog="<%= product %>" addToShoppingCartUri="<%= response.encodeURL("AddToShoppingCart.jsp") %>" />
</html>
the two are the same except the colored piece.
thanx
***************** لا اله إلا الله *************************
I can figure out the
I can figure out the difference :)
but I am asking about the definition of <cart:showCatalog
Ahmed Hashim hashimblog/
here is it :
here is it :
<?xml version="1.0"?>
<taglib 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-jsptaglibrary_2_0.xsd"
version="2.0">
<tlib-version> 1.0 </tlib-version>
<short-name> shopping cart lib</short-name>
<tag>
<name>showCatalog </name>
<tag-class> ch16.cart.ShowCatalogHandler </tag-class>
<body-content> empty </body-content>
<attribute>
<name> productCatalog </name>
<type> ch16.cart.ProductCatalog </type>
<required> yes </required>
<rtexprvalue> yes </rtexprvalue>
</attribute>
<attribute>
<name> addToShoppingCartUri</name>
<type> java.lang.String </type>
<required> yes </required>
<rtexprvalue> yes </rtexprvalue>
</attribute>
</tag>
</taglib>
I just found when looking in http://exmpledepot.com i found that in JSTL there are two versions, one that support EL and the other that doesn't, is the Custom tags also like the JSTL ??
***************** لا اله إلا الله *************************
Sorry,can you verify that
Sorry,
can you verify that you have 2 jars in your application (jstl.jar, standard.jar)
Ahmed Hashim hashimblog/
موش فاهم حضرتك ؟
إيه لزمت ال ٢ جار، أنا موش شغال علي ال
jstl
يعني ال ٢ جار دول هما اللي مخلين ال إكسبرشن لانجوتش متشتغلش ؟؟
شكرا جدا و أسف علي تعبك معايا
***************** لا اله إلا الله *************************
Do the following steps
Salamo alikom,
You should do the following checks :
1. As Hashim said, make sure that the jstl.jar, standard.jar existing at the web application lib folder.
2. Make sure that you had included the JSTL Taglibrary :
<%@ taglib prefix=“c” uri=“http://java.sun.com/jsp/jstl/core” %>
3. What is the application server you are working at ?
There are some app servers that has some restrictions at EL execution.
4. Please answer these questions. If you still have problems, please tell.
Salamo alikom
1- in this example ididn't
1- in this example ididn't use jstl at all, just a custom tag.
2- i don't uses the jstl
3- tomcat 5.5.20
********* i have a Q************
I do custom tags using the TagSupport & BodyTagSupport classes ( i.e. i don't use SimpleTag interface) should i uses this new interface ??
***************** لا اله إلا الله *************************
It works fine
Sorry. I didn't completely read your problem specification so I thought you don't know how to use JSTL.
I had tried your case and it works fine with me.
I had tried the classic model of TL Development which is matching your case (Tag or TagSupport or BodyTagSupport) and passed a custom object to an attribute of the tag library and it works fine.
About your question, You haven't to use the Simple Tags. Although they provide a simpler model of TL Development but they are slower than the classic model as it instantiate the Tag Handler class at every occurance of the tag.
OK, What should u do now ???
Try to export the source code as a war file and upload to check it together. If you couldn't upload the file. Then send me your sample at(Hazems{at}eg.ibm.com) and insha Allah I will try to help you.
I think this is the last thing u can do
look at your web.xml file
if it looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app id="WebApp_1">
then EL will never work with u as it's
and you should do the following
change the part of WEB.xml matching the red text above and replace it with the following line
<web-app id="WebApp_ID" 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 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
if you are using <taglibe> the site will never start unless u put all of them inside <jsp-config> as follow
<jsp-config>
<taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
</jsp-config>
In other words you are using servlet 2.3 and EL work with servlet version 2.4
what I did is changing the servlet version of your project by removing reference to the DTD file which WEB.xml follow in validation (as servlet 2.3) and made reference to the XSD schema descripting WEB.XML for servlet 2.4.
good luck