Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/08/2008, 08:46
Anarko
 
Fecha de Ingreso: febrero-2004
Mensajes: 1.987
Antigüedad: 20 años, 3 meses
Puntos: 22
Esta mal mi TomCat?, por que devuelve el error [HTTP Status 500] ?

Hola,

esto va de maravilla:

--------------------------------------
<HTML>
<HEAD>
<TITLE>La segunda página con JSP</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<%! int x = 9; %>
<%! public long factorial (long numero) throws IllegalArgumentException
{
if ((numero < 0) || (numero > 20))
throw new IllegalArgumentException("Fuera de Rango");
if (numero == 0) return 1;
else return numero * factorial(numero - 1);
} %>
<% try {
long resultado = factorial (x); %>
<p align=center> <%= x %>! = <%= resultado %></p>
<% } catch (IllegalArgumentException e) { %>
<p>El argumento para calcular el factorial esta fuera de rango.</p>
<% } %>
</BODY>
</HTML>
--------------------------------------

Esto también me corre perfecto:

---------------------------------------
<%
int v=1;
while(v<7){
v++;
%>
<h2>Test!</h2>
<%
}
%>
---------------------------------------

Pero este código:

--------------------------------------
<table>
<tr><th><i>x</i></th><th><i>x</i>!</th></tr>
<% for (long x = 0; x <=20; ++x) { %>
<tr><td><%= x %></td><td><%= factorial (x) %></td></tr>
<% } %>
</table>
--------------------------------------

devuelve un error:

HTTP Status 500

Que puede ser?