Author Login
Post Reply
user Digest 29 Aug 2010 11:08:13 -0000 Issue 9158
Topics (messages 207322 through 207326):
json result type with struts 2.1.8.1
207322 by: chsekhar
207323 by: Dale Newfield
207324 by: chsekhar
207325 by: Rafael Taboada
207326 by: chsekhar
Administrivia:
---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)
----------------------------------------------------------------------

Attachment:
user_207322.ezm (zipped)
I am trying to do a result type of "json" from my struts2 action. Here is the
configuration I have in my code. I am using struts 2.1.8.1 on websphere
server. I am using the json plugin I got with struts 2.1.8.1
Struts.xml:
<package name="example" namespace="/" extends="json-default">
<action name="vendorList"
class="com.stg.providerportal.actions.AjaxVendorListAction">
<result name="success" type="json"></result>
</action>
</package>
Struts Action:
private Object jsonModel;
public String execute() throws Exception {
String nextStep = SUCCESS;
Map session = getSession();
SessionParams params = (SessionParams)
session.get(Constants.KEY_SESSION_PARAMS);
try {
Map json = new HashMap<String,String>();
json.put("apple", "Hi");
//vendorList = populateVendors(params,taxID,billingZipCode);
setJsonModel(json);
//session.put(Constants.KEY_SESSION_VENDOR_LIST, vendorList);
} catch (Exception e) {
CILogUtil.logInfo(e, params);
nextStep = AppConstants.SYSTEM_UNAVAILABLE;
}
return SUCCESS;
}
I am calling this action using ajax(jquery) and here how i make a call.
$.getJSON('vendorList.action' ,
{
"taxID": taxID,
"billingZipCode": billingZipCode
},
function(json) {
alert('hi');
});
$.ajaxSetup({"error":function(XMLHttpRequest,textStatus, errorThrown) {
alert(textStatus);
alert(errorThrown);
alert(XMLHttpRequest.responseText);
}});
When i execute this I am getting back the response from the action as below.
Dont know why.
Error 404: SRVE0190E: File not found: /vendorList.action
Even when I am trying to run this action directly from the browser, I get
the same response.
http://localhost:9081/providerportal1/vendorList.action?taxID=111billingZipCode=1111
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_207323.ezm (zipped)On 8/27/10 12:39 PM, chsekhar wrote:
> <result name="success" type="json"></result>
I didn't really look at the details of your message because I've got to
run, but why does that result have a body, instead of
<result name="success" type="json"/>
-Dale

Attachment:
user_207324.ezm (zipped)
I tried without body as you mentioned but no difference in the behaviour.
DNewfield wrote:
>
> On 8/27/10 12:39 PM, chsekhar wrote:
>> <result name="success" type="json"></result>
>
> I didn't really look at the details of your message because I've got to
> run, but why does that result have a body, instead of
> <result name="success" type="json"/>
>
> -Dale
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_207325.ezm (zipped)Try deleting namespace="/" en your package tag
On Fri, Aug 27, 2010 at 12:23 PM, chsekhar <chandrasekhar.a@(protected):
>
> I tried without body as you mentioned but no difference in the behaviour.
>
>
> DNewfield wrote:
> >
> > On 8/27/10 12:39 PM, chsekhar wrote:
> >> <result name="success" type="json"></result>
> >
> > I didn't really look at the details of your message because I've got to
> > run, but why does that result have a body, instead of
> > <result name="success" type="json"/>
> >
> > -Dale
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/json-result-type-with-struts-2.1.8.1-tp29554492p29554954.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
--
Rafael Taboada
Software Engineer
Cell : +511-992741026
"No creo en el destino pues no me gusta tener la idea de controlar mi vida"

Attachment:
user_207326.ezm (zipped)
If I remove that it is not going to my action itself. It is going to the
default action I had set in another package.
Rafael Taboada wrote:
>
> Try deleting namespace="/" en your package tag
>
> On Fri, Aug 27, 2010 at 12:23 PM, chsekhar
> <chandrasekhar.a@(protected):
>
>>
>> I tried without body as you mentioned but no difference in the behaviour.
>>
>>
>> DNewfield wrote:
>> >
>> > On 8/27/10 12:39 PM, chsekhar wrote:
>> >> <result name="success" type="json"></result>
>> >
>> > I didn't really look at the details of your message because I've got to
>> > run, but why does that result have a body, instead of
>> > <result name="success" type="json"/>
>> >
>> > -Dale
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@(protected)
>> > For additional commands, e-mail: user-help@(protected)
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://old.nabble.com/json-result-type-with-struts-2.1.8.1-tp29554492p29554954.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>
>
> --
> Rafael Taboada
> Software Engineer
>
> Cell : +511-992741026
>
> "No creo en el destino pues no me gusta tener la idea de controlar mi
> vida"
>
>
--
Sent from the Struts - User mailing list archive at Nabble.com.