编写一个JSP程序

编写一个JSP程序,第1张

<script type="text/javascript">

function c() {

var a=parseInt (document.getElementById("n1").value)

var b=parseInt(document.getElementById("n2").value)

document.getElementById("n4").value=(a+b)

}

</script>

<style type="text/css"神旦>

#n1,#n2,#n3,#n4{

border: 2px solid

}

</style>带皮

</head>

<body>

<input id="n1" type="text" />加上

<input id="n2" type="text" />

<input id="n3" type="button" value="等于"/ onclick="c()">

<input id="n4" type="text"/>

</body>

</html>蠢瞎差

Eclipse 要简神春拦耐瞎雹用Java EE

Eclipse IDE for Java EE Developers

http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR2/eclipse-jee-indigo-SR2-win32.zip

你好,两个jsp文件,test02.jsp,test03.jsp.代码如下:

<%@ page contentType="text/htmlcharset=gb2312" %>

<%

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

try{

int n = Integer.parseInt(num)

if(n%2==0)

request.setAttribute("type","偶数"槐裤祥)

else

request.setAttribute("type","奇纯谨数")

request.getRequestDispatcher("test03.jsp").forward(request,response)

}catch(Exception e){

e.printStackTrace()

}

%>

<%@ page contentType="text/htmlcharset=gb2312" %>

<% String type = (String)request.getAttribute("type")%>

<html>

<head><铅搏title>页面一</title></head>

<body>

<form action="test02.jsp" method="get">

请输入一个数字:<input type="text" name="num" />

<input type="submit" value="提交" />

</form>

${type }

</body>

</html>


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/12529145.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-26
下一篇 2023-05-26

发表评论

登录后才能评论

评论列表(0条)

保存