GoConqr has a new look! Let us know what you think.

Notes

Tabuada controlada em JSP

Gabriel Rocha JSP Portuguese 1 page

Content of the notes (1)

Page 1

Primeiro um formulário básico

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>JSP Page</title>

</head>

<body>

<h1>Tabuada</h1>

<form action="tabuada.jsp">

Insira um número:<br>

<input type="text" name="num" placeholder="número">

<br> <br><br>

<input type="submit" value="Submit">

</body>

</html>

Depois um get com a ação controlada ( O usuário só pode inserir valores menores ou iguais a 10)

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>JSP Page</title>

</head>

<body>

<h1>Resultado</h1>

<%

String n1 = request.getParameter("num");

int n;

n = Integer.parseInt(n1);

%>

<%

if (n <=10){

for (int i=1;i<=10;i++)

out.println(n +"*"+i + " = " + n*i+"<br><br>");

}

else{

out.print("Valor não disponível");

}

%>

</body>

</html>

Information

Description
Tabuada em JSP com get e controle if else.
Created by
Gabriel Rocha · Aug 2017
Updated
Aug 28, 2017
Views
199
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?