Spring-mvc:提供已静态包含在另一个加载的 jsp 中的 JSP
这可能吗?我正在加载一个静态包含 jsp 片段的 JSP。然后我使用ajax仅重新加载jsp片段,但我得到
Caused by: org.apache.jasper.JasperException: Unable to load class for JSP
at org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:630)
at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:149)
... 143 more
Caused by: java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.jsp.customers.biddingRoomSearchContainer_jsp
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:134)
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)
at org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:628)
... 144 more
编辑:我正在使用处理程序注释映射和使用JstlView的InternalResourceViewResolver ... JSP视图层的标准设置...并且如果处理程序返回JSP的视图名已经静态包含到不同的 JSP 中,我收到此错误
is this possible? I'm loading a JSP that statically includes a jsp fragment. Then I use ajax to reload only the jsp fragment, but I get
Caused by: org.apache.jasper.JasperException: Unable to load class for JSP
at org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:630)
at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:149)
... 143 more
Caused by: java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.jsp.customers.biddingRoomSearchContainer_jsp
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:134)
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)
at org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:628)
... 144 more
EDIT: I'm using handler annotation mapping and InternalResourceViewResolver that uses JstlView ... Kinda standard setting for JSP view layer ... And if the handler returns a viewname of JSP that was already statically included into a different JSP, I get this error
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
决定将我的评论变成答案...
为了通过 Ajax 加载 JSP 片段,您需要将 URI 路径与 JSP 文件关联起来。假设您不需要通过控制器(问题中没有提到),那么您可以使用 mvc:view-controller Spring 3.0 中的功能。
在你的情况下,它可能看起来像:
Decided to turn my comment into an answer...
In order to load the JSP fragment via Ajax, you need to associate a URI path with the JSP file. Assuming you don't need to go via a controller (none was mentioned in the question), then you can use the mvc:view-controller feature in Spring 3.0.
In your case it might look something like: