大神幫忙調(diào)試下此程序啊!void方法下out.print語句總是報錯
<%@ 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 '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>This is my first web</h1>
??? <hr>
??? <!-- 注釋1 -->
??? <%-- 注釋2 --%>
??? <% out.println("第一個網(wǎng)頁");//注釋3 %><br>
??? <%! String name ="龍哥";
??? ?String textFun1(){
??? ??return "威武";
??? ?}
??? ?void textFun2(JspWriter out)throws Exception
??? ?{
??? ??out.println(name+"威武");????//——————————這里總報錯!
??? ?}
???? %><br>
???? 原來<%=name%><%=textFun1() %><br>
???? <% textFun2(out); %>
? </body>
</html>
2016-03-09
代碼是沒有問題的,至少我是運行出來了
,完全復(fù)制粘貼沒有任何問題,你的問題可能不是出在代碼上,望采納