最近使用了2.3.x 版本的struts2。。。 使用json的时候,包一直都找不到。
而在struts2-json-plugin-2.3.3 包中是有json-default这个包的。。但是就是找不到
没办法了那只能够是我自己定义一个了 struts2-json.xml文件了。。
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts
PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.1.7.dtd">
<struts>
<package name="json-default" extends="struts-default">
<result-types>
<result-type name="json" class="org.apache.struts2.json.JSONResult" />
</result-types>
<interceptors>
<interceptor name="json"
class="org.apache.struts2.json.JSONInterceptor" />
<interceptor name="jsonValidation"
class="org.apache.struts2.json.JSONValidationInterceptor" />
<!-- Sample JSON validation stack -->
<interceptor-stack name="jsonValidationWorkflowStack">
<interceptor-ref name="basicStack" />
<interceptor-ref name="validation">
<param name="excludeMethods">input,back,cancel</param>
</interceptor-ref>
<interceptor-ref name="jsonValidation" />
<interceptor-ref name="workflow" />
</interceptor-stack>
</interceptors>
</package>
</struts>
之后再在 struts-default.xml中引用该文件。。。 struts2找到了json包了。。 问题解决
。。。
信息: Choosing bean (com.opensymphony.xwork2.util.PatternMatcher) for (#2)
五月 20, 2012 4:26:57 下午 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (org.apache.struts2.dispatcher.StaticContentLoader) for (#2)
五月 20, 2012 4:26:57 下午 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (com.opensymphony.xwork2.UnknownHandlerManager) for (#2)
五月 20, 2012 4:26:57 下午 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (org.apache.struts2.views.util.UrlHelper) for (#2)
五月 20, 2012 4:26:57 下午 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Overriding property struts.i18n.reload - old value: false new value: true
五月 20, 2012 4:26:57 下午 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Overriding property struts.configuration.xml.reload - old value: false new value: true
五月 20, 2012 4:26:58 下午 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Initializing Struts-Spring integration...
五月 20, 2012 4:26:58 下午 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Setting autowire strategy to name
五月 20, 2012 4:26:58 下午 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: ... initialized Struts-Spring integration successfully
五月 20, 2012 4:26:59 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-apr-8080"]
五月 20, 2012 4:26:59 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-apr-8009"]
五月 20, 2012 4:26:59 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 18691 ms
之前是找不到 会有一个严重的信息提示
希望有遇到这个问题的朋友 看到这个之后懂得如何解决~~