问题是这样的:我用天气接口获取了一串JSON数据,然后这串数据解析之后只能在控制台输出。最终想把解析后的数据放到页面上显示,以漂亮的页面展现出来。在摸索的途中遇到问题,从JSP页面中获取了一个字符串(city),然后想把这个字符串传入相应的函数中(Getweather)返回结果。此时控制台报错:六月 01, 2018 3:59:25 下午 org.apache.catalina.core.StandardWrapperValve invoke严重: Servlet.service() for servlet [com.W.test2] in context with path [/Weather] threw exception [Servlet execution threw an exception] with root causejava.lang.ClassNotFoundException: org.apache.http.conn.scheme.SchemeSocketFactory at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1292) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1121) at com.W.WeatherUtils.getWeatherData(WeatherUtils.java:46) at com.W.WeatherUtils.<init>(WeatherUtils.java:27) at com.W.GetWeather.<init>(GetWeather.java:16) at com.W.test2.doGet(test2.java:24) at javax.servlet.http.HttpServlet.service(HttpServlet.java:634) at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:651) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:407) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:754) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1376) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source)页面报错:ServletJSP我用的Eclipse,xml配置文件似乎没有用过。请问我需要怎么改才能把后台的数据输出到页面中?
2 回答
qq_晚安的猫_0
TA贡献3条经验 获得超0个赞
web.xml配置你的query,有没有用你直接访问localhost:8080/query看你resp打印的内容是否正常,后台用req.setAtribute或者getsession.setAtribute的形势将你的值放进map,前台用<%xxx=request.getAtribu(你设置的map)%>
添加回答
举报
0/150
提交
取消