Struts 2 JSON sample
Download my sample Struts 2 JSON sample war here.
I spent hours reading and googling around learning JSON on struts 2. Yes, there are many tutorials about this but i guess, there where no nonsense sample like a “war” file that you can just run. So, i made one. I know a lot of java programmers starting out Struts 2 and JSON are looking for this one.
Here’s what you should do:
1. Download this war.
2. On tomcat, put it on webapp folder
3. Run tomcat with your localhost like this: http://localhost:8080/struts2json/
That’s it! No-frills, simple JSON on Struts 2 sample. Struts 2 is really much more simplier than Struts 1. Its just that there’s fewer samples and tutorials in Struts 2 than 1, i dont know why. Hope, this’ll help you start out.
Please leave a comment or message me if i left out something.
update: included the java source code on the war file. sorry, i totally forgot. my bad :) you can look it up together with the class file. rock on!
September 8, 2008 at 9:00 pm
[...] on Struts 2 annotation. Im pretty lazy writing right now. Also, you might also be interested in my Struts 2 JSON sample if you are starting out on Struts [...]
October 10, 2008 at 9:45 pm
Thanks for your war file, I was googling half the day, but just getting a wrong message that tell me it can’t read a public method of Oracle when I used struts2 json plugin 0.3, maybe your setting can help me.
thank you very much!
October 12, 2008 at 9:46 am
can you post ur code here and elaborate more on ur problem? sorry for replying late, i got sick :(
October 21, 2008 at 8:59 pm
Direct to the point! Thanks for the help ;)
October 28, 2008 at 3:09 am
This makes it much clearer. However how do you move objects that are not String objects. Do you have to define the objects in the Javascript portion?
Thx
Elan
October 28, 2008 at 11:45 am
Elan, you could convert the object in javascript using the “eval()”. google it up. :)
November 27, 2008 at 3:31 am
Very Quick tutorial for techies.
November 27, 2008 at 4:15 am
Great man, let me know, I fyou have more example like this.
March 19, 2009 at 12:05 am
Very concise and working examples. Thanks.
One feature that I would love to see is binding incoming JSON values. That would complete the example.
May 4, 2009 at 7:39 am
Great Tutorial!!! thanks…
I was need it!!
Sorry my bad english!
Im Brazilian…
hehehe
May 16, 2009 at 2:09 pm
tats qool, thanks man..
June 18, 2009 at 2:23 pm
Where to find source code of this war? ..I want code
June 19, 2009 at 5:59 am
use 7zip or winrar or something else to uncompress the war file. You can find the source code inside. Good luck :)
June 19, 2009 at 5:56 am
Good and elegant struts2 code… i love your war… :)
July 2, 2009 at 7:13 pm
Hi,
I have got an error tat IllegalAccessException:
java.lang.IllegalAccessException: Class com.googlecode.jsonplugin.JSONWriter can not access a member of class org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper with modifiers “public”
August 20, 2009 at 1:29 pm
I don find the method getJSON implemented in the source code.. could you please give me a clear view on this issue… I am actually in urgent need to work with struts and json. If you don mind , can i get your full source code , so that i learn them clearly
September 10, 2009 at 9:01 pm
Hi,
Thank you for your nice example.
Do you have a similar example on binding incoming JSON values?
December 21, 2009 at 1:35 pm
Amazing because its so simple and small. I am using Struts 2.1.8 and it still works as is without any additional changes!!
Thanks for a simple example without all the stupid crap that most examples on this topic have added. And thanks for not showing DOJO but using the simple prototype js library. Its lightweight and gets the job done!
Thanks again.
SK
December 26, 2009 at 5:47 pm
thank 100% working
December 28, 2009 at 5:10 am
Yeah! thanx man!
December 29, 2009 at 6:28 pm
very helpfull for me. :)
thx man.
December 30, 2009 at 5:42 pm
thanks for your war its very heplfull for me :)
February 7, 2010 at 12:49 pm
BEST tutorial ever, I’ve spent all day looking for a tutorial like this one, THANKS!!!
February 10, 2010 at 11:59 am
Great Work. Saves a time lot
March 16, 2010 at 8:38 pm
Nice attempt. you make me lazy too!
May 10, 2010 at 6:21 pm
Nice mate!
like it!
@: to Other readers, please also look at the apache struts2 Tutorial for the rule of JSON!!!
Gambatte all !! :)
May 26, 2010 at 9:21 pm
If my package extends hibernate-default and i add json-default my application isn’t working. Do you have any suggestions?
Thank you!
June 17, 2010 at 9:12 pm
hi I have created my own sample based from this :D thanks
http://justlikeinschool.blogspot.com/2010/06/struts-2-and-jquery-without-fuss.html
August 3, 2010 at 6:00 am
I just wanted something simple to show me the basics of how json works and is this was exactly what I was looking for.
THANKS!
August 19, 2010 at 1:18 pm
Thanks a lot…u saved my life.
October 7, 2010 at 9:22 pm
Hi,
I am trying to run this war file but nothing to do.. Sorry but I am very new to struts. I was trying to implement json with struts. Can i have the source code of this sample please?. I really need to have an executable sample
thnx, Ester
October 25, 2010 at 1:08 pm
good one.
wondering why the action is invoked twice.
the “SampleList” printed twice. happens if u run in any browsers.
thanks,
rj
October 26, 2010 at 12:51 am
Hello, I deployed your war and it run fine but when I click the button I just can see an alert saying “sTIKIFLEM sample” 1, 2, 3… but nothing about json sintax. Please let me know what I am doing wrong.
Thx in advance.
Juan
January 8, 2011 at 4:42 am
Thanks a lot!! as you said that is what I was looking for.
Good job1
April 26, 2011 at 8:51 pm
Dude , Its really saved my Time Thanks for such a nice demo
May 28, 2011 at 7:57 pm
Thanks, we need more examples like this to kick start the learning process. It is great, simple, straight forward example
June 23, 2011 at 9:57 am
thank you! your very helpful :D
July 11, 2011 at 3:31 pm
You saved my life….. you simply rock!!!!! God bless :)
February 2, 2012 at 1:45 pm
Best website to search fot this software is for me FreePlatinumDownloads….
[...]Struts 2 JSON sample « stikiflem’s techblog[...]…