My favorites
▼
|
Sign in
lineadecodigo
Web Code Samples in spanish
Project Home
Downloads
Wiki
Issues
Source
Checkout
Browse
Changes
Source path:
svn
/
trunk
/
lineadecodigo_servlet
/
WebContent
/
sumar-datos.jsp
r478
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Sumar datos</title>
</head>
<body>
<h1>Sumar datos</h1>
<%
String datoUno = request.getParameter("dato1");
String datoDos = request.getParameter("dato2");
try {
int uno = Integer.parseInt(request.getParameter("dato1"));
int dos = Integer.parseInt(request.getParameter("dato2"));
int suma = uno + dos;
out.println("La suma de " + datoUno + " + " + datoDos + " = " + Integer.toString(suma));
} catch(NumberFormatException nfe) {
out.println("Los datos recibidos no son nĂºmeros enteros");
}
%>
<br><br>
<hr>
Artículo disponible en: <a href="http://lineadecodigo.com/java/recibir-un-parametro-numerico-en-una-jsp/">http://lineadecodigo.com/java/recibir-un-parametro-numerico-en-una-jsp/</a><br/>
<a href="http://lineadecodigo.com" title="Linea de Codigo">lineadecodigo.com</a>
</body>
</html>
Show details
Hide details
Change log
r149
by vcuervo on Jul 30, 2009
Diff
Sumar datos en una JSP
Go to:
...rvlet/WebContent/sumar-datos.jsp
Project members,
sign in
to write a code review
Older revisions
All revisions of this file
File info
Size: 1136 bytes, 39 lines
View raw file
Powered by
Google Project Hosting