[英]how to store a jsp file in sql table and to execute it?
How can we do this in java? 我们如何在Java中做到这一点?
while (st.hasMoreElements())
{
list.add(st.nextElement().toString());
}
for (int i = 0; i < list.size(); i++)
{
ResultSet rs = s.executeQuery("select * from rultree");
while (rs.next())
{
if (rs.getString("name").equalsIgnoreCase(list.get(i)))
System.out.println(rs.getString("name"));
}
}
I retrieved the matched tokens... now I want to retrieve the jsp file of matched token and execute it 我检索了匹配的令牌...现在我想检索匹配的令牌的jsp文件并执行它
JSPs are one of the template engines that you can't easily store in the database. JSP是您不容易存储在数据库中的模板引擎之一。 Not that it's right to do it with other template engines, but at least it's possible.
用其他模板引擎来做并不是正确的,但是至少有可能。
JSPs are compiled to servlets, so they need to be present on the filesystem (unless you run the jsp-to-servlet compiler of the servlet container manually, but that's non-standard). JSP被编译为servlet,因此它们必须存在于文件系统中(除非您手动运行servlet容器的jsp-to-servlet编译器,但这是非标准的)。 If you want to dynamically load a jsp (still from the filesystem), then simply use:
如果要动态加载jsp(仍从文件系统加载),则只需使用:
request.getRequestDispatcher("/" + jspName + ".jsp").forward(request, response)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.