日期:2014-05-18  浏览次数:20847 次

tomcat白屏~~求助!!
我用tomcat运行写好的velocity模版,出现白屏,不提示错误,让我很郁闷...

文件目录如下C:\Tomcat   5.0\webapps\table

TestVelocity.java代码
package   cn.ac.ict;

import   java.io.*;
import   java.util.*;
import   javax.servlet.*;
import   javax.servlet.http.*;
import   org.apache.velocity.*;
import   org.apache.velocity.context.*;
import   org.apache.velocity.servlet.*;
import   org.apache.velocity.app.*;
import   org.apache.velocity.exception.*;
import   javax.swing.table.*;  

public   class   TestVelocity   extends   VelocityServlet{

protected   Properties   loadConfiguration(ServletConfig   config)
throws   IOException,FileNotFoundException
{
Properties   p=new   Properties();
String   path=config.getServletContext().getRealPath( "/ ");
if(path==null)
{
System.out.println( "TestVelocity.loadConfiguration(): "+
"unable   to   get   the   current   webapp   root.Using   '/ '. ");
path= "/ ";
}
p.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH,path);
p.setProperty( "runtime.log ",path+ "velocity.log ");
return   p;
}

public   Template   handleRequest(HttpServletRequest   request,HttpServletResponse   response,Context   context)
{
Template   outty=null;
try
{
// Hashtable   userlist=new   Hashtable();

java.util.List   user   =   new   java.util.ArrayList(5);  
user.add(   new   User(   "John ",   "john@some.domain ",   true   )   );  
                user.add(   new   User(   "   Alice   ",   "alice@other.domain ",   false   )   );  
                user.add(   new   User(   "Tom ",   "tom@other.domain ",   true   )   );  
                user.add(   new   User(   "Elisa ",   "elisa@some.domain ",   false   )   );  
                user.add(   new   User(   "Zine ",   "zine@other.domain ",   true   )   );  
/*
User   u=new   User();
u.setName( "John ");
u.setEmailAddress( "john@some.domain ");
u.setMale(true);
userlist.put(u.getName(),u);

u.setName( "Alice ");
u.setEmailAddress( "alice@other.domain ");
u.setMale(false);
userlist.put(u.getName(),u);

u.setName( "Tom ");
u.setEmailAddress( "tom@other.domain ");
u.setMale(true);
userlist.put(u.getName(),u);

u.setName( "Elisa ");
u.setEmailAddress( "elisa@some.domain ");
u.setMale(false);
userlist.put(u.getName(),u);

u.setName( "Zine ");
u.setEmailAddress( "zine@other.do