亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

為什么我這個點提交根本就沒反應

這個是表單的代碼

<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"%>

<%

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 'user.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>

? ? <h1>用戶注冊</h1>

? ? <hr>

? ? <form action="request.jsp" name="regform" method="post" >

? ? <table>

? ? <tr>

? ? <th>用戶名:</th>

? ? <td><input type="text" name="username"/></td>

? ? </tr>

? ? <tr>

? ? <th>愛好:</th>

? ? <td><input type="checkbox" name="favorite”" value="read">讀書</td>

? ? <td><input type="checkbox" name="favorite" value="music"/>音樂</td>

? ? <td><input type="checkbox" name="favorite" value="movie"/>電影</td>

? ? <td><input type="checkbox" name="favorite" value="Internet"/>上網</td>

? ? </tr>

? ? <tr>

? ? <td colspan='2'><input type="button" value="提交" /></td>

? ? </tr>

? ? </table>

? ? </form>

? </body>

</html>

這個是request的代碼

<%@ page language="java" import="java.util.*" contentType="text/html; charset=GBK"%>

<%

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 'index.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>

? ? <h1>request內置對象</h1>

? ? 用戶名:<%=request.getParameter("username") %><br>

? ? 愛好:<%

? ? String[] favorites=request.getParameterValues("favorite");

? ? if(favorites!=null)

? ? {

? ? for(int i=0;i<favorites.length;i++)

? ? {

? ? out.println(favorites[i]+"&nbsp;&nbsp;");

? ? }

? ? }

? ? ?%>

? </body>

</html>

完全跟老師的一樣,為啥點提交沒有反應,求大神解答

正在回答

1 回答

input里的type="button"改成submit 試試。

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

為什么我這個點提交根本就沒反應

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

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

公眾號

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