This Domain(Admin5.com) is for Sale:

Velocity 的应用示例

时间:2007-10-22  来源:不详  作者:林子

System.err.println(msg o);

}

public static Properties initServletEnvironment(VelocityServlet v)

{

// init only onceif (m_servletConfig != null)

{

return m_servletConfig;

}

//debugPrintln("initServletEnvironment....");

try

{

/* *call the overridable method to allow the *derived classes a shot at altering the configuration *before initializing Runtime */Properties p = new Properties();

ServletConfig config = v.getServletConfig();

// Set the Velocity.FILE_RESOURCE_LOADED_PATH property// to the root directory of the context.String path = config.getServletContext().getRealPath("/");

//debugPrintln("real path of / is : " path);

p.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, path);

// Set the Velocity.RUNTIME_LOG property to be the file// velocity.log relative to the root directory// of the context.p.setProperty(Velocity.RUNTIME_LOG, path "velocity.log");

// Return the Properties object.//return p;

Velocity.init(p);

m_servletConfig = p;

return p;

}

catch (Exception e)

{

debugPrintln(e.getMessage());

//throw new ServletException("Error initializing Velocity: " e);

}

return null;

//this.getServletContext().getRealPath("/");

}

看完这篇,您有何感觉呢?

文章评论

共有位Admini5网友发表了评论 查看完整内容

24小时热门信息