第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

JSP跳轉獲取不到參數

JSP跳轉獲取不到參數

寶慕林4294392 2018-12-06 12:08:36
/******MyJsp3.jsp的全部代碼*********/ <%@ page language="java" import="java.util.*" contentType="text/html;charset=GB2312" pageEncoding="GB2312"%><%@ page import="java.io.*" %><%@ page import="javax.servlet.*" %><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><base href="<%=basePath%>"> <title>My JSP 'MyJsp3.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"><meta http-equiv="cache-control" content="no-cache"><meta http-equiv="expires" content="0"><meta http-equiv="keywords" content="keyword1,keyword2,keyword3"><meta http-equiv="description" content="This is my page"><!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body bgcolor="cyan"> This is my JSP page. <br> <font size="1"> <p> 輸入三角形三邊長度,用逗號隔開:<br> <form action="MyJsp3" method="post" name="form"> <input type="text" name="boy"> <input type="submit" value="送出" name="submit"> </form> </font> <%! double a[]=new double[3]; String answer=null; %> <%int i=0; boolean b=true; String s=null; double result=0; double a[]=new double[3]; String answer=null; s=request.getParameter("boy"); if(s!=null) { StringTokenizer fenxi=new StringTokenizer(s,","); while(fenxi.hasMoreTokens()) { String temp=fenxi.nextToken(); try { a[i]=Double.valueOf(temp).doubleValue(); i++; } catch(NumberFormatException ex) { out.print("<br>"+"請輸入數字字符"); } } if(a[0]+a[1]>a[2]&&a[0]+a[2]>a[1]&&a[1]+a[2]>a[0]&&b==true) { double p=(a[0]+a[1]+a[2])/2; result=Math.sqrt(p*(p-a[0])*(p-a[1])*(p-a[2])); out.println("面積:"+result); } else { answer="您輸入的三邊不構成三角形。"; out.println("<br>"+answer); } } %> <p> 您輸入的三邊是:<br> <%=a[0] %><br> <%=a[1] %><br> <%=a[2] %><br></body></html> 打開是這樣的下圖,輸入3,4,5 ?然后點按鈕 結果出現錯誤
查看完整描述

1 回答

?
湖上湖

TA貢獻2003條經驗 獲得超2個贊

很簡單,action="MyJsp3"里面忘了加后綴名,應該是action="MyJsp3.jsp"。哎呀搞了一天才開竅

查看完整回答
反對 回復 2018-12-16
  • 1 回答
  • 0 關注
  • 674 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號