All pastes #2070601 Raw Edit

Unnamed

public text v1 · immutable
#2070601 ·published 2011-05-27 21:11 UTC
rendered paste body
public void getSiteAddresses(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException
    {
        JSONObject json = new JSONObject();
        try
        {
            Map address;
            List addresses = new ArrayList();

            int count = 15;

            for (int i=0 ; i<count ; i++)
            {
                address = new HashMap();
                address.put("CustomerName"    , "Decepticons" + i);
                address.put("ClientAccountId" , "1999" + i);
                address.put("SiteId"          , "1888" + i);
                address.put("Number"          , "7" + i);
                address.put("Building"        , "StarScream Skyscraper" + i);
                address.put("Street"          , "Devestator Avenue" + i);
                address.put("City"            , "Megatron City" + i);
                address.put("ZipCode"         , "ZZ00 XX1" + i);
                address.put("Country"         , "CyberTron" + i);
                addresses.add(address);
            }
            json.put("Addresses", addresses);
        }
        catch (JSONException jse)
        {

        } 
        response.setContentType("application/json");
        response.getWriter().write(json.toString());
    }