PROBLE;A CODIGO JAVA
Publicado por Sergio (1 intervención) el 31/03/2007 20:24:53
Hola, estoy intentando ejecutar algunos ejempos que me he encontrado por la web para iniciarme en esto de jsp. Pero tengo un problema. Estoy utilizando tomcat y cuando llamo a los ejemplos desde tomcat me da siempre error en el código java del jsp. ¿Alguien sabe por qué?
Os pongo el codigo que estoy interpretando:
<%@ page language="java" import="java.util.*, libreria.*" %>
<html>
<head>
<title>Página Principal de mi Librería</title>
</head>
<body bgcolor="#ffffee">
<h1><center>Página Principal de mi Librería</center></h1>
<table align="center" cellpadding="2" cellspacing="2" border="1"
width="80%" bgcolor="#dddddd">
<tr>
<th>Autor</th>
<th>Titulo</th>
<th>Ubicacion</th>
<th>Accion</th>
<th>ID</th>
</tr>
<%
LibrosBD librosBD = (LibrosBD) application.getAttribute("BaseDatos");
Collection libros = librosBD.getLibros();
if (libros != null) {
if (libros.size () > 0) {
for (Iterator iterator = libros.iterator(); iterator.hasNext();) {
Libro libro = (Libro) iterator.next ();
%>
<tr>
<td>
<%= libro.getAutor () %>
</td>
<td>
<%= libro.getTitulo () %>
</td>
<td>
<%= libro.getUbicacion () %>
</td>
<td align="center">
<destacar><a href="Form_Borrar.jsp?id=<%=libro.getId()%>">
Borrar</a></destacar>
<destacar><a href="Form_Modificar.jsp?id=<%=libro.getId()%>">
Modificar</a></destacar>
</td>
<td align="center">
<%= libro.getId () %>
</td>
</tr>
<% }
}
}
%>
</table>
<br>
<hr>
<center>
<destacar><a href="Form_Insertar.jsp">Añadir un Nuevo Libro</a></destacar>
</center>
</body>
</html>
Os pongo el codigo que estoy interpretando:
<%@ page language="java" import="java.util.*, libreria.*" %>
<html>
<head>
<title>Página Principal de mi Librería</title>
</head>
<body bgcolor="#ffffee">
<h1><center>Página Principal de mi Librería</center></h1>
<table align="center" cellpadding="2" cellspacing="2" border="1"
width="80%" bgcolor="#dddddd">
<tr>
<th>Autor</th>
<th>Titulo</th>
<th>Ubicacion</th>
<th>Accion</th>
<th>ID</th>
</tr>
<%
LibrosBD librosBD = (LibrosBD) application.getAttribute("BaseDatos");
Collection libros = librosBD.getLibros();
if (libros != null) {
if (libros.size () > 0) {
for (Iterator iterator = libros.iterator(); iterator.hasNext();) {
Libro libro = (Libro) iterator.next ();
%>
<tr>
<td>
<%= libro.getAutor () %>
</td>
<td>
<%= libro.getTitulo () %>
</td>
<td>
<%= libro.getUbicacion () %>
</td>
<td align="center">
<destacar><a href="Form_Borrar.jsp?id=<%=libro.getId()%>">
Borrar</a></destacar>
<destacar><a href="Form_Modificar.jsp?id=<%=libro.getId()%>">
Modificar</a></destacar>
</td>
<td align="center">
<%= libro.getId () %>
</td>
</tr>
<% }
}
}
%>
</table>
<br>
<hr>
<center>
<destacar><a href="Form_Insertar.jsp">Añadir un Nuevo Libro</a></destacar>
</center>
</body>
</html>
Valora esta pregunta


0