JSP程序运行不了

来源:百度知道 编辑:UC知道 时间:2024/09/23 06:25:50
<%@ page contentType="text/html;charse=GB2312" %>
<html><body bgcolor="cyan">
<font size="4">
<p>JSP页面测试
<% int x=100,y=500,z;
z=x+y;
%>
</p>
<p>x+y的和为:<%@ =z %>
</p>
</font></body>
</html>
这是我写的JSP程序,放在web的webapps的chaper2下,但在浏览器中输入http://localhost:8080/chaper2/first.jsp后出现如下错误:HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: /first.jsp(9,18) Invalid directive
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultEr

<p>x+y的和为:<%@ =z %> 这一句错了~~
应该是:<p>x+y的和为:<%=z %>

<%@ =z %> 改为<% =z %>
<%= %> 表达式标记,把变量值显示到页面
<%@ %>是静态标记,作用很多,就不多说了!

<p>x+y的和为:<%@ =z %>中去掉“@”试试。