一個(gè)簡(jiǎn)單的JavaWeb程序,但是在瀏覽器中不能運(yùn)行,提示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獲取表單數(shù)據(jù)示例</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">? ? 下面是表單內(nèi)容:? ? <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取到的表單數(shù)據(jù):<br>? ? <%? ? out.println("表單輸入userName的值:"+request.getParameter("userName")+"<br>");? ? out.println("表單輸入password的值:"+request.getParameter("password")+"<br>");? ? %>? ? </font>? </body></html>
1 回答
已采納

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