1

i want to perform some test by using Json . I am using google app engine for development . I want to know how to import json lib and how i can import in jsp page . The work i have done so far can be seen in pictureenter image description here

i am not sure that i have added jar file correctly or not it is marked with red . Thanks

user667340
  • 531
  • 2
  • 10
  • 21

2 Answers2

1

You need to import them on jsp as well, the same way you have imported List

See Also

Community
  • 1
  • 1
jmj
  • 237,923
  • 42
  • 401
  • 438
  • for importing i have done done this <%@ page import="com.google.gson.Gson" %>and as it can be seen in the picture how i have added jar file but still its saying "com.google.gson.Gson doesnot not exit " – user667340 May 18 '11 at 16:27
  • ignore that error try to build and deploy. probably just a ide's issue. – jmj May 18 '11 at 16:28
  • After deploying An error occurred at line: -1 in the generated java file [javac] C:\DOCUME~1\test\LOCALS~1\Temp\Jetty_localhost_8080_web____.7ij05v\jsp\org\apache\jsp\Mediasense_jsp.java:10: package com.google.gson does not exist [javac] import com.google.gson.Gson; [javac] ^ – user667340 May 18 '11 at 16:37
  • Check for the jar , is it there in WEB-INF/lib ? – jmj May 18 '11 at 16:52
  • how can i add into WEB-INF/lib as i am using netbeans .In WEB-INF there is no lib folder . i have added into libraries as in the picture . Is it wrong ? – user667340 May 18 '11 at 16:57
1

Oh right Gson is the Google JSON library - you'll need to import it in your JSP. Make sure it's on the Build Path for your project for example

<%@ page import="com.google.gson.Gson" %>
swateek
  • 6,735
  • 8
  • 34
  • 48
planetjones
  • 12,469
  • 5
  • 50
  • 51
  • perfect but now its there is red line under com – user667340 May 18 '11 at 14:11
  • The compiler error (if you hover over the red line) should tell you more. – planetjones May 18 '11 at 14:14
  • it saying "package com.google.gson.Gson dosent exit " . I think its importing problem . now i have also added as properties -> build -> packages -> add jar . But still no hope – user667340 May 18 '11 at 14:19
  • yes i'm not much of a netbeans user, but you should right click the project > Properties > Libraries > Compile > Add Library. Make sure you have added the google gson library... – planetjones May 18 '11 at 14:21