http://www.amazon.com/Beginning-JSP-...rds=jsf+giulio
Estoy trabajando con los ejemplos del libro y en un capitulo el autor da paso a paso un sistema de carrito de compras que si bien no es apropiado para produccion lo que trata es de hacernos familiarizarnos con la mecanica de JSF.
El tema es que cuando ejecuto la pagina me da este error:
Cita:
rg.apache.jasper.JasperException: PWC6033: Error in Javac compilation for JSP
PWC6199: Generated servlet error:
source value 1.5 is obsolete and will be removed in a future release
PWC6199: Generated servlet error:
target value 1.5 is obsolete and will be removed in a future release
PWC6199: Generated servlet error:
To suppress warnings about obsolete options, use -Xlint:-options.
PWC6197: An error occurred at line: 66 in the jsp file: /index.jsp
PWC6199: Generated servlet error:
incompatible types: java.lang.Object cannot be converted to ebookshop.Book
PWC6199: Generated servlet error:
/index_jsp.java uses or overrides a deprecated API.
PWC6199: Generated servlet error:
Recompile with -Xlint:deprecation for details.
PWC6199: Generated servlet error:
/index_jsp.java uses unchecked or unsafe operations.
PWC6199: Generated servlet error:
Recompile with -Xlint:unchecked for details.
PWC6199: Generated servlet error:
source value 1.5 is obsolete and will be removed in a future release
PWC6199: Generated servlet error:
target value 1.5 is obsolete and will be removed in a future release
PWC6199: Generated servlet error:
To suppress warnings about obsolete options, use -Xlint:-options.
PWC6197: An error occurred at line: 66 in the jsp file: /index.jsp
PWC6199: Generated servlet error:
incompatible types: java.lang.Object cannot be converted to ebookshop.Book
PWC6199: Generated servlet error:
/index_jsp.java uses or overrides a deprecated API.
PWC6199: Generated servlet error:
Recompile with -Xlint:deprecation for details.
PWC6199: Generated servlet error:
/index_jsp.java uses unchecked or unsafe operations.
PWC6199: Generated servlet error:
Recompile with -Xlint:unchecked for details.
Me fijo en index.jsp y el netbeans me marca este problema
Book aBook = shoplist.elementAt(i); ERROR> INCOPATIBLE TYPES OBJETCS CANNOT BE CONVERTED TO BOOKS
mi codigo es
Código:
Me preocupa un poco que quizas sea un problema del libro, que este desactualizado pero bueno, pense que como era de 2012 no esra tan viejo page language="java" contentType="text/html" pageEncoding="UTF-8"%> <%@page trimDirectiveWhitespaces="true" %> <%@page session="true" import="java.util.Vector, ebookshop.Book" %> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>E-bookshop</title> <style type="text/css"> body {background-color: gray; font-size: 10pt;} H1 {font-size: 20 pt;} table {background-color: white;} </style> </head> <body> <h1>BookShop Online</h1> <hr/><p/> <% //Scriptlet 1: chekeamos si la lista de libros esta inicializada Vector <Book> booklist = (Vector<Book>)session.getValue("ebookshop.list"); if (booklist == null){ response.sendRedirect("/ebookshop"); } else { %> <form name="addForm" action="eshop" method="post"> <input type="hidden" name="do_this" value="add"> Book: <select name="book"> <% //Scriptlet 2: copiar la lista al combobox for (int i =0; i < booklist.size(); i++){ out.println("<option>" + booklist.elementAt(i) + "</option>"); } %> </select> Quantity: <input type="text" name="qty" size="3" value="1"> <input type="submit" value="add"> </form> <p/> <% //Scriptlet 3: nos fijamos si el carrito esta vacio Vector shoplist = (Vector<Book>)session.getAttribute("ebookshop.cart"); if (shoplist !=null && shoplist.size() > 0){ %> <table border="1" cellpadding="2"> <tr> <td>Titulo</td> <td>Precio</td> <td>Cantidad</td> <td></td> </tr> <% //Scriptlet 4: muestra los libros en el carrito for (int i =0; i < shoplist.size(); i++){ Book aBook = shoplist.elementAt(i); %> <tr> <form name="removeForm" action="eshop" method="post"> <input type="hidden" name="position" value="<%=i%>"> <input type="hidden" name="do_this" value="remove"> <td><%=aBook.getTitle()%></td> <td align="right">$<%=aBook.getPrice()%></td> <td><input type="submit" value="Remove from cart"</td> </form> </tr> <% } %> </table></p> <form name="checkoutForm" action="eshop" method="post"> <input type="hidden" name="do_this" value="checkout"> <input type="submit" value="Checkout"> </form> <% } } %> </body> </html>