标题:[求助]怎么输出这个啊
只看楼主
寂寞天涯人
Rank: 1
等 级:新手上路
帖 子:172
专家分:0
注 册:2006-3-18
 问题点数:0 回复次数:1 
[求助]怎么输出这个啊

我用这个文件
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@import="java.util.*;"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<form id="form1" name="form1" method="post" action="file:///C|/Program Files/Apache Software Foundation/Tomcat 5.0/webapps/myjsp/d.jsp">
请输入你的姓名
<label>
<input name="usename" type="text" id="usename" />
</label>
<label>
<input type="submit" name="Submit" value="提交" />
</label>
</form>
<%!
public String zi(String str){
String s=str;
try{
byte [] t=s.getBytes("ISO-8859-1");
s=new String (t);
return s;
}catch(Exception e){
return s;
}
}
%>
<%

out.println("你输入的是:"+zi(request.getParameter("usename")));
%>
<% Date dd=new Date();
out.println(dd.toString());
%>

</body>
</html>
结果输出这个:

type Exception report

message

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

exception

org.apache.jasper.JasperException: /d.jsp(2,3) Invalid directive
	org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
	org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
	org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:90)
	org.apache.jasper.compiler.Parser.parseDirective(Parser.java:506)
	org.apache.jasper.compiler.Parser.parseElements(Parser.java:1539)
	org.apache.jasper.compiler.Parser.parse(Parser.java:126)
	org.apache.jasper.compiler.ParserController.doParse(ParserController.java:220)
	org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
	org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:203)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:470)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
怎么会事啊,我该怎么弄啊,好象是没配置好吧,要怎么弄啊,帮忙啊 

搜索更多相关主题的帖子: blank PUBLIC import target java 
2006-03-27 22:53
〃雙掱ぴ搋兜づ
Rank: 1
等 级:新手上路
威 望:2
帖 子:48
专家分:0
注 册:2006-3-24
得分:0 
<%@import="java.util.*;"%>

import 前面必须有page

还有把
<% Date dd=new Date();
out.println(dd.toString());
%>
改成
<%
out.println(new java.util.Date().toLocaleString());
%>

就行了呢。为什么头上有java.util.*的包的引用。怎么页面里直接new Date()就不行了呢

请楼下的指教

[此贴子已经被作者于2006-3-28 9:13:36编辑过]


2006-03-28 09:08



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-53277-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.453364 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved