java - cannot find symbol:method getFactory() -


symbol: method getfactory() location: variable mapper of type org.codehaus.jackson.map.objectmapper

i added below jar

enter image description here

below how import them

<%@ page import="java.io.*,java.util.*, javax.servlet.*,java.text.*" %> <%@ page import="javax.swing.*" %> <%@page import="java.text.dateformat"%> <%@page import="java.text.simpledateformat"%> <%@page import="java.sql.preparedstatement"%> <%@ page language="java"%> <%@page import="java.sql.resultset"%> <%@page import="java.sql.statement"%> <%@ include file="dbconfig.jsp" %>   <%@page import="java.io.file"%> <%@page import="org.codehaus.jackson.map.objectmapper"%> <%@page import="java.net.*"%> <%@page import="org.codehaus.jackson.annotate.jsonignoreproperties"    import=" org.codehaus.jackson.jsonencoding" import=" org.codehaus.jackson.jsonfactory" import=" org.codehaus.jackson.jsongenerationexception" import=" org.codehaus.jackson.jsongenerator" import=" org.codehaus.jackson.map.jsonmappingexception"      %> 

and below code

objectmapper mapper = new objectmapper(); mapper.getfactory().configure(jsongenerator.feature.escape_non_ascii, true);         string jsonstr = mapper.writevalueasstring( jsonmap ); response.getoutputstream().print( jsonstr ); 

i error in getfactory() , escape_non_ascii

how rid of error in getfactory() , escape_non_ascii

your imports using jackson 1.9.x doesn't have method getfactory() in objectmapper. there method getjsonfactory(), you'd not need it. call mapper.configure( jsongenerator.feature.escape_non_ascii, true );


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -