Goldberg
2016-03-09 12:57
<%@ 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("第一个网页");//注释3 %><br>
<%! String name ="龙哥";
String textFun1(){
return "威武";
}
void textFun2(JspWriter out)throws Exception
{
out.println(name+"威武"); //——————————这里总报错!
}
%><br>
原来<%=name%><%=textFun1() %><br>
<% textFun2(out); %>
</body>
</html>
代码是没有问题的,至少我是运行出来了,完全复制粘贴没有任何问题,你的问题可能不是出在代码上,望采纳
JAVA遇见HTML——JSP篇
248278 学习 · 3215 问题
相似问题