Velocity 的应用示例
{
ps.setString(index, (String) parameter);
}
else
{
ps.setObject(index, parameter);
}
}
catch (Exception e)
{
//Utilities.debugPrintln(e.getMessage());
e.printStackTrace();
}
}
public static void closeDbConnection(java.sql.Connection con)
{
try
{
con.close();
}
catch (Exception e)
{
Utilities.debugPrintln(e.getMessage());
}
}
public static String getResultPage(String title, String message, String jumpLink,VelocityServlet servlet, HttpServletRequest request,HttpServletResponse response, Context context)
{
Template template = null;
context.put("MessageTitle", title);
context.put("ResultMessage", message);
context.put("JumpLink", jumpLink);
try
{
template = servlet.getTemplate("/templates/Message.htm");
StringWriter sw = new StringWriter();
template.merge(context, sw);
return sw.toString();
}
catch (Exception ex)
{
文章评论
共有位Admini5网友发表了评论 查看完整内容