1

プロジェクトにDatatables springを実装しようとしています。

ファイルRoleController.java

@Controller
public class RoleController {

@RequestMapping(value = "/masterRole")
public ModelAndView about() {
    RoleDAO dao = new RoleDAOImpl();
    List<Role> list = dao.list();
    ModelAndView model = new ModelAndView();
    model.addObject("list",list);
    model.setViewName("roleTile");
    return model;
     }
}

ファイルtiles.xml

  <definition name="roleTile" extends="base.definition" >
    <put-attribute name="title" value="DAM Role Master" />
    <put-attribute name="body" value="/WEB-INF/pages/viewRole.jsp" />
    <put-attribute name="menuselection" value="master" />
</definition>

ファイルviewRole.jsp

 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
 <%@ taglib prefix="datatables" uri="http://github.com/dandelion/datatables" %>

 <datatables:table id="roles" data="${list}" row="role" cssClass="table table-striped">
<datatables:column title="Id">
    <c:out value="${role.roleId}"></c:out>
</datatables:column>
<datatables:column title="Role">
    <c:out value="${role.role}"></c:out>
</datatables:column>
 </datatables:table>

次のエラーが表示されます

com.github.dandelion.datatables.core.configuration.ConfigurationStore.getPrototype(ConfigurationStore.java:82) の java.lang.NullPointerException com.github.dandelion.datatables.core.configuration.TableConfiguration.getInstance(TableConfiguration.java:117) ) com.github.dandelion.datatables.core.html.HtmlTable.(HtmlTable.java:76) で com.github.dandelion.datatables.jsp.tag.TableTag.doStartTag(TableTag.java:91) で org.apache .jsp.WEB_002dINF.pages.viewRole_jsp._jspService(viewRole_jsp.java:78)、org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)、javax.servlet.http.HttpServlet.service(HttpServlet.java) :803) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374) で org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337) で org.org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: 290) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) で org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630) で org.apache.catalina.core.ApplicationDispatcher .doInclude(ApplicationDispatcher.java:535) org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:472) org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968) org.apache.jasper.runtime.PageContextImpl の apache.jasper.runtime.PageContextImpl.doInclude(PageContextImpl.java:638)。include(PageContextImpl.java:632) org.apache.tiles.request.jsp.JspRequest.doInclude(JspRequest.java:123) org.apache.tiles.request.AbstractViewRequest.dispatch(AbstractViewRequest.java:47) org .apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47) org.apache.tiles.request.render.ChainedDelegateRenderer.render(ChainedDelegateRenderer.java:68) org.apache.tiles.impl.BasicTilesContainer .render(BasicTilesContainer.java:259) at org.apache.tiles.template.InsertAttributeModel.renderAttribute(InsertAttributeModel.java:188) at org.apache.tiles.template.InsertAttributeModel.execute(InsertAttributeModel.java:132) at org. org.apache.jsp.WEB_002dINF.pages.layout_jsp の apache.tiles.jsp.taglib.InsertAttributeTag.doTag(InsertAttributeTag.java:299)。_jspx_meth_tiles_005finsertAttribute_005f4(layout_jsp.java:222) は org.apache.jsp.WEB_002dINF.pages.layout_jsp._jspService(layout_jsp.java:95) で.servlet.http.HttpServlet.service(HttpServlet.java:803) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java) :337) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) で javax.servlet.http.HttpServlet.service(HttpServlet.java:803) で org.apache.catalina.core.ApplicationFilterChain. org.apache.catalina.core の internalDoFilter(ApplicationFilterChain.java:290)。org.apache.catalina.core の ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)。ApplicationDispatcher.invoke(ApplicationDispatcher.java:630) org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436) org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374) org org.apache.tiles.request.servlet.ServletRequest.forward(ServletRequest.java:265) の .apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302) org.apache.tiles.request.servlet.ServletRequest の.doForward(ServletRequest.java:228) で org.apache.tiles.request.AbstractClientRequest.dispatch(AbstractClientRequest.java:57) で org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47) でorg.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259) org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:397) org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:238) org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:221) org .apache.tiles.renderer.DefinitionRenderer.render(DefinitionRenderer.java:59) at org.springframework.web.servlet.view.tiles3.TilesView.renderMergedOutputModel(TilesView.java:114) at org.springframework.web.servlet.view .AbstractView.render(AbstractView.java:267) で org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1221) で org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1005) でorg.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:952) at org.springframework.web.org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961) で org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852) で servlet.DispatcherServlet.doService(DispatcherServlet.java:870) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) で org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) で javax.servlet.http.HttpServlet.service(HttpServlet.java) :803) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) で org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) で org.springframework.security.web。 org.springframework.security.web.access の FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)。org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84) の Intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter( FilterChainProxy.java:342) の org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) の org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) の org .springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.authentication .org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) の AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113) org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter. java:146) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) で org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154) で org.springframework .security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150) at org.springframework.security.web. org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199) の FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy. java:342) org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110) で org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) で.org.springframework.security.web.FilterChainProxy$VirtualFilterChain. org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57) の doFilter(FilterChainProxy.java:342) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) の org .springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) org.springframework.security.web.FilterChainProxy $VirtualFilterChain.org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192) の doFilter(FilterChainProxy.java:342) org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160) の org.springframework .web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java) :235) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) で org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) で org.apache.catalina.core. org.apache の StandardContextValve.invoke(StandardContextValve.java:175)。org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java: 109) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) で org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) で org.apache.coyote.http11.Http11Protocol $Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:744)org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) の invoke(StandardEngineValve.java:109) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) の org.apache .coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) で org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) で java.lang.Thread.run(Thread .java:744)org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) の invoke(StandardEngineValve.java:109) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) の org.apache .coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) で org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) で java.lang.Thread.run(Thread .java:744)実行 (Thread.java:744)実行 (Thread.java:744)

私はデータテーブルが初めてです。私を助けてください。

休止状態とタイルを使用した Spring 4 との段階的な統合のための Datatbles へのリンクも招待されています。

4

2 に答える 2

2

web.xmlエラーは、データテーブルの構成が見つからないことを示しています

ステップ 1:インweb.xml

<!-- Dandelion-Datatables servlet definition -->
<servlet>
    <servlet-name>datatablesController</servlet-name>
    <servlet-class>com.github.dandelion.datatables.extras.servlet2.servlet.DatatablesServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>datatablesController</servlet-name>
    <url-pattern>/datatablesController/*</url-pattern>
</servlet-mapping>

<!-- Dandelion servlet definition and mapping -->
<servlet>
  <servlet-name>dandelionServlet</servlet-name>
  <servlet-class>com.github.dandelion.core.web.DandelionServlet</servlet-class>
  <load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
  <servlet-name>dandelionServlet</servlet-name>
  <url-pattern>/dandelion-assets/*</url-pattern>
</servlet-mapping>

  <!-- Dandelion filter definition and mapping -->
 <filter>
   <filter-name>dandelionFilter</filter-name>
   <filter-class>com.github.dandelion.core.web.DandelionFilter</filter-class>
 </filter>
 <filter-mapping>
   <filter-name>dandelionFilter</filter-name>
   <url-pattern>/*</url-pattern>
</filter-mapping>

ステップ 2:必要な jar ファイルを追加する

commons-beanutils-1.9.1.jar tandelion-
core-0.10.0.jar
datatables-core-0.10.0.jar
datatables-jsp-0.10.0.jar
datatables-servlet2-0.9.3.jar
ehcache-core-2.6 .9.jar
jackson-annotations-2.2.3.jar
jackson-core-2.2.3.jar
jackson-databind-2.2.3.jar
json-simple-1.1.1.jar
jstl-api.jar
jstl-impl.jar
log4j-1.2.16.jar

その他の jar: Spring jar + tiles jar + hibernate jar

注:プロジェクトのニーズに応じて jar について説明しました。必要に応じて jar を追加できます。

于 2014-06-02T06:31:16.630 に答える
1

あなたの問題は、あなたのweb.xml. すでにフォーラムで報告されており、v0.10.1 で修正が利用可能になり、宣言の欠落についてユーザーに警告されます。

datatables-servlet2エクストラについて 1 つだけ注意してください。v0.10.0以降、存在しなくなりました。したがって、これを削除して、0.9.3 と 0.10.0 の両方で発生する可能性のある依存関係の問題を回避することをお勧めします。

の新しい宣言web.xmlは次のとおりです。

<!-- Dandelion-Datatables filter used for basic export -->
<filter>
    <filter-name>datatables</filter-name>
    <filter-class>com.github.dandelion.datatables.core.web.filter.DatatablesFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>datatables</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

ドキュメントのエクスポート セクションが更新され、最新の変更が反映されました。

于 2014-06-02T11:17:33.833 に答える