Hi Fernando, try to add an attribute in displayProducts.tab file, like this:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core 
<http://java.sun.com/jsp/jstl/core> " %>
<%@ attribute name="normalPrice" fragment="true" %>
<%@ attribute name="onSale" fragment="true" %>
<%@ attribute name="anotherJSPFragment" fragment="true" %>
<%@ attribute name="myOwnJSPFragment" fragment="true" %>

<%@ variable name-given="name" %>
<%@ variable name-given="price" %>
<%@ variable name-given="origPrice" %>
<%@ variable name-given="salePrice" %>

<table border="1">
..........

Doing so, when you wrtie the following in your JSP page:

...

<tags:displayProducts>

    <jsp:attribute name="myOwnJSPFragment">
      This is the item: <font color="red"> ${name} </font><br/>
       <font color="blue"><strike>Was: ${origPrice}</strike></font><br/>
        <b>The price now is: ${salePrice}</b>
    </jsp:attribute>
</tags:displayProducts>

...

 

You are saying: "Use the attribute 'myOwnJSPFragment' of tag 'displayProducts' 
". If you haven't declared 

the attribute, you will get an error.

 

Regards,

Rubén

 

________________________________

De: fernando pardo [mailto:ingsopor...@gmail.com] 
Enviado el: jueves, 12 de noviembre de 2009 18:12
Para: Chavarría Teruel, Rubén
Asunto: Re: [java ee programming] Re: contuining with the lab 4008

 

hello Ruben Chavarria:

i already introduced the word:"MyOwnJSPFragment"
but it dont run so.
however with the atribute "otherJSPFragment" the aplication run well.
But why with the first atribute don´t run the aplication?

This is my displayproduct.tag:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"; %>
<%@ attribute name="normalPrice" fragment="true" %>
<%@ attribute name="onSale" fragment="true" %>
<%@ attribute name="anotherJSPFragment" fragment="true" %>

<%@ variable name-given="name" %>
<%@ variable name-given="price" %>
<%@ variable name-given="origPrice" %>
<%@ variable name-given="salePrice" %>

<table border="1">
  <tr>
    <td> 
      <c:set var="name" value="Hand-held Color PDA"/>
      <c:set var="price" value="$298.86"/>
      <jsp:invoke fragment="normalPrice"/>
    </td>
    <td> 
      <c:set var="name" value="4-Pack 150 Watt Light Bulbs"/>
      <c:set var="origPrice" value="$2.98"/>
      <c:set var="salePrice" value="$2.32"/>
      <jsp:invoke fragment="onSale"/>
    </td>
    <td> 
      <c:set var="name" value="Digital Cellular Phone"/>
      <c:set var="price" value="$68.74"/>
      <jsp:invoke fragment="normalPrice"/>
    </td>
    <td> 
      <c:set var="name" value="Baby Grand Piano"/>
      <c:set var="price" value="$10,800.00"/>
      <jsp:invoke fragment="normalPrice"/>
    </td>
    <td> 
      <c:set var="name" value="Luxury Car w/ Leather Seats"/>
      <c:set var="origPrice" value="$23,980.00"/>
      <c:set var="salePrice" value="$21,070.00"/>
      <jsp:invoke fragment="onSale"/>
    </td>
  <td>
      <c:set var="name" value="iPod"/>
      <c:set var="origPrice" value="$210.00"/>
      <c:set var="salePrice" value="$100.00"/>
      <jsp:invoke fragment="anotherJSPFragment"/>
    </td>
  </tr>
</table>

I have to say that in the displayproduct.tag.html not 
appears something relationed with the atribute "MyOwnJSPFragment" ¿will it be  
the factor,the cause?

thanks a lot
Diego



El 11 de noviembre de 2009 04:34, "Chavarría Teruel, Rubén" 
<rchavar...@indra.es> escribió:

Hi Fernando,

 

Can you send us this file, please? displayProducts.tag under 
TomcatJSPExample->Web Pages->WEB-INF->tags

 

It seems that you have not defined an attribute called "myOwnJSPFragment" in 
the tag file "displayProducts".

At the beginning of displayProducts.tag, we can read the definitions for the 
attributes. 

 

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"; %>
<%@ attribute name="normalPrice" fragment="true" %>
<%@ attribute name="onSale" fragment="true" %>
<%@ variable name-given="name" %>
<%@ variable name-given="price" %>
<%@ variable name-given="origPrice" %>
<%@ variable name-given="salePrice" %>

 

Try to include your attribute "myOwnJSPFragment" and tell us.

 

Hope it well help you,

 

Rubén Chavarría Teruel

________________________________

De: java-ee-j2ee-programming-with-passion@googlegroups.com 
[mailto:java-ee-j2ee-programming-with-pass...@googlegroups.com] En nombre de 
fernando pardo
Enviado el: martes, 10 de noviembre de 2009 19:16
Para: java-ee-j2ee-programming-with-passion@googlegroups.com
Asunto: [java ee programming] contuining with the lab 4008

 

hello guys :
Someone could help me please about the lab 4008 

i have the following products.jsp file and then the mistake generated:


<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<html>
  <head>
    <title>JSP 2.0 Examples - Display Products Tag File</title>
  </head>
  <body>
    <h1>JSP 2.0 Examples - Display Products Tag File</h1>
    <hr>
    <p>This JSP page invokes a tag file that displays a listing of 
    products.  The custom tag accepts two fragments that enable
    customization of appearance.  One for when the product is on sale
    and one for normal price.</p>
    <p>The tag is invoked twice, using different styles</p>
    <hr>
    <h2>Products</h2>
    <tags:displayProducts>
      <jsp:attribute name="normalPrice">
    Item: ${name}<br/>
    Price: ${price}
      </jsp:attribute>
      <jsp:attribute name="onSale">
    Item: ${name}<br/>
    <font color="red"><strike>Was: ${origPrice}</strike></font><br/>
    <b>Now: ${salePrice}</b>
      </jsp:attribute>
    <jsp:attribute name="myOwnJSPFragment">
      This is the item: <font color="red"> ${name} </font><br/>
       <font color="blue"><strike>Was: ${origPrice}</strike></font><br/>
        <b>The price now is: ${salePrice}</b>
    </jsp:attribute>

    </tags:displayProducts>
    <hr>
    <h2>Products (Same tag, alternate style)</h2>
    <tags:displayProducts>
      <jsp:attribute name="normalPrice">
    <b>${name}</b> @ ${price} ea.
      </jsp:attribute>
      <jsp:attribute name="onSale">
    <b>${name}</b> @ ${salePrice} ea. (was: ${origPrice})
      </jsp:attribute>
    </tags:displayProducts>
  <hr>
        <h2>Products (Same tag, the 3rd style)</h2>
        <tags:displayProducts>
            <jsp:attribute name="normalPrice">
                My own display format: ${name}  ${price} per item
            </jsp:attribute>
            <jsp:attribute name="onSale">
                My own display format ${name}  ${salePrice} per item (Yesterday 
it was: ${origPrice})
            </jsp:attribute>
        </tags:displayProducts>

  </body>
</html>



The mistake generated is:


Estado de HTTP 500 - 

________________________________


type Informe de excepción

Mensaje

DescripciónEl servidor encontró un error interno () que impide satisfacer la 
solicitud.

Excepción 

org.apache.jasper.JasperException: PWC6033: Imposible compilar clase para JSP














PWC6197: Se produjo un error en la línea: 31 del archivo JSP: 
/jsp2/tagfiles/products.jsp




PWC6199: Error en servlet generado:




string:///products_jsp.java:92: cannot find symbol




symbol  : method setMyOwnJSPFragment(javax.servlet.jsp.tagext.JspFragment)









location: class org.apache.jsp.tag.web.displayProducts_tag









PWC6199: Error en servlet generado:




Note: string:///products_jsp.java from  uses unchecked or unsafe operations.









PWC6199: Error en servlet generado:









Note: Recompile with -Xlint:unchecked for details.

nota Las causas de los seguimientos de pila completos de la excepción y su root 
se encuentran disponibles en los Sun GlassFish Enterprise Server v2.1 registros.

________________________________


Sun GlassFish Enterprise Server v2.1




thanks a lot



 

 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Java EE (J2EE) Programming with Passion!" group.
To post to this group, send email to
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to