whole_new_world whole_new_world - 1 year ago 94
Java Question

cannot import jsonarray into jsp in eclipse

I want to use JSONArray in jsp. I have imported the library like this

I also downloaded the java-json jar and paste into WEB-INF lib, please see the snapshot of my windows.


but the compiler still complains that Jsonarray cannot be resolved to a type. What could be wrong? Thank you.

Answer Source

The problem is that you wrote:

<%@ page import org.json.JSONArray %> 

But you should have written:

<%@ page import="org.json.JSONArray" %> 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download