Welcome 微信登录
编程资源 图片资源库 蚂蚁家优选 PDF转换器

首页 / 操作系统 / Linux / Struts 转化Json时候出现出现无法转化

在处理action 返回json数据时候出现:Class org.apache.struts2.json.JSONWritercan not access a member of class Oracle.jdbc.driver.BaseResultSet withmodifiers "public"该问题的产生是由于某些对象json无法转化导致;处理:在struts 中配置:eg: <package name="loginJson"extends="json-default" >        <action name="rolejson_*"class="roleAction" method="{1}">            <result name="rolePage"type="json">/WEB-INF/pages/system/roleManagePage.jsp            <paramname="excludeProperties">page.list[d+].prSUSEr,page.list[d+].setPri,roleService</param>            </result>        </action></package>其中的参数:<param name=”excludeProperties”> 可以排除你不需要的属性注意凡是在在action 中有get()方法的json均会默认去转化它。。当然这也包括你配置的service 属性,本次出现的问题就是在service上。。排除后就不再出现问题;你也可以使用 name=”includeProperties” 添加你想要转化的属性;这个类似与spring作为分发页面功能时候使用的:JsonConfigjsonConfig = new JsonConfig();jsonConfig.setExcludes(String[]excludes);