一個簡單的JavaWeb程序,但是在瀏覽器中不能運行,提示Invalid location of tag (form),但是我找不到原因是什么????<%@ page language="java" import="java.util.*" pageEncoding="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>request獲取表單數據示例</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>? ? <font size="2">? ? 下面是表單內容:? ? <form action="Form.jsp" ?method="post">? ? 用戶名:<input type="text" name="userName" size="10"/>? ? 密碼:<input type="password" name="password" size="10"/>? ? <input type="submit" value="提交">? ? </form>? ? 下面是表單提交以后用request取到的表單數據:<br>? ? <%? ? out.println("表單輸入userName的值:"+request.getParameter("userName")+"<br>");? ? out.println("表單輸入password的值:"+request.getParameter("password")+"<br>");? ? %>? ? </font>? </body></html>
1 回答
已采納

呦呦米
TA貢獻90條經驗 獲得超59個贊
在jsp頁面使用標簽過程中有時候不注意規則的話,會提示一些錯誤。
Invalid location of tag (form),主要是因為<form>和<table>標簽使用混亂,form 應該寫到table外面去,并且form標簽里面也不能套form標簽??梢栽趂orm標簽里 把input都放到table中試試?
添加回答
舉報
0/150
提交
取消