<%@page contentType="text/html;charset=Big5"%>
<html>
<head><title>form_data</title></head>
<body>
<form method="post" action="form2.jsp">
姓名:<input type="text" name="Name">
</br>
身高:<input type="int" name="Hieght">
</br>
體重:<input type="int" name="Wieght">
</br>
<input type="submit" value="送出">
</form>
</body>
</html>
----------------------form2.jsp---------------------------
<%@page contentType="text/html;charset=Big5"%>
java.util.*;
<HTML>
<HEAD><TITLE>presentation</TITLE></HEAD>
<BODY>
<% //request.setCharcterEncoding("big5");
String name = request.getParameter("Name");
int hieght = Integer.parseInt(request.getParameter("Hieght"));
int wieght = Integer.parseInt(request.getParameter("Wieght"));
double bmi = wieght/(hieght*hieght/10000);
%>
<%= name %>;
BMI=<%= bmi %>
</BODY>
</HTML>
沒有留言:
張貼留言