Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java Open Source > Struts
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Struts section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 8th, 2008, 04:59 AM
ish ish is offline
Registered User
 
Join Date: Oct 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Struts 2.2, Json data and jsp problem, help pls

Hi

I am using struts 2.20, jsp and strutsjson plugIn. I have download plugIn into WEB-INF/lib directory. I think plugIn seem to be working.

I have following action <p>
public class CreateJsonAction implements Action
{
          JSONObject obj2=new JSONObject();
      obj2.put("StartDate","2007-04-12 11:00:00");
      obj2.put("GoogleRef","60.472024, 8.468946");
      obj2.put("Element","Sleeve/Backup");
      obj2.put("Film","Golden Child");

      List<JSONObject> myJsonList = new
                                ArrayList<JSONObject>();
      myJsonList.add(obj);
    return SUCCESS;
}


struts.xml
 <action name="FilmJsonAction3"
         class="web.struts.test.MyJsonAction">
      <result name="success"
              type="json">/WEB-INF/jsp/json.jsp</result>
 </action>

When I call this action from the browser, the action get activated and json data is pumped to the browser. But it displaying json data as string in a new window and doesn't open requested jsp ie json.jsp.

Please can you help me, how can I applied this json data (list if json data) to my jsp. So when I open this jsp page, data get populated. I would appreciated an example.

many thank

ish





Similar Threads
Thread Thread Starter Forum Replies Last Post
Struts+JSP nishi_gupta Struts 2 October 16th, 2007 02:58 AM
JSON problem with accentuation jlamas Ajax 0 September 8th, 2006 07:25 AM
JSP web Development ch-18 struts problem wilson_kwan JSP Basics 0 December 12th, 2004 01:17 PM
Chapter - Struts - Traditional or Model1- Pls help ipatchu JSP Basics 0 November 18th, 2003 03:06 AM
i am new in java and JSP...pls help! frankiepoon JSP Basics 0 August 18th, 2003 08:51 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.