This week's book giveaway is in the Python forum.
We're giving away four copies of Hello World and have Warren & Carter Sande on-line!
See this thread for details.
Win a copy of Hello World this week in the Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Bear Bibeault
  • Liutauras Vilda
  • Devaka Cooray
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

struts2 (2.1.8.1) json result type problems

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 with the json plugin provided with struts.

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;

try {
Map json = new HashMap<String,String>();
json.put("apple", "Hi");
setJsonModel(json);


} 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
 
Sheriff
Posts: 9671
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Chandra aaaaa" please check your private messages for some administrative matter....
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags when posting code or configuration. Unformatted code and configuration is unnecessarily difficult to read. You can edit your post by using the button.

And BeForthrightWhenCrossPostingToOtherSites; this is a duplicate of the message in the struts-user mailing list. Thanks!
 
chandra addala
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am resubmitting my question again. I had tried other forms before posting here without much success.

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 with the json plugin provided with struts.

Struts.xml:

Struts Action:

I am calling this action using ajax(jquery) and here how i make a call.



When i execute this I am getting back the response from the action as below. Dont know why.

Even when I am trying to run this action directly from the browser, I get the same response.
 
Then YOU must do the pig's work! Read this tiny ad. READ IT!
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!