whole_new_world whole_new_world - 9 days ago 6
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.

snapshot
snapshot2

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

Answer

The problem is that you wrote:

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

But you should have written:

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