Win a copy of Java Challengers this week in the Java in General 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

struts2 ajax file upload

 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

My application is based on struts2 and dojo. Basically I am trying to upload a file and send the response back as JSON. Response is coming back from the server; able to view through firebug in firefox. But not able to display it on the browser. Not sure about it. Here is the part of code

Script:

function sendToServer(formId, indicatorId, viewId) {
// document.getElementById(indicatorId).style.display = '';
var bindArgs = {
transport: "IframeTransport",
formNode: formId,
handleAs: "json",
form: dojo.byId('attachFileForm'),
load: function(type, data, evt) {

// var data1 = JSON.parse(data);
// console.log(data1.validUser);
document.getElementById(viewId).innerHTML = data;
}
};
var request = dojo.io.bind(bindArgs);


}

Action :

boolean validUser = false;
response.setContentType("application/json");

String jsonObject = "{ \"validUser\": \"" + validUser +"\"} ";
out.print(jsonObject);

return null;


Struts.xml

<action name="fileUploadAction" class="com.venom.action.FileUploadAction" method="display">
<result name="none">pages/index.jsp</result>
</action>

Please help.
response.png
[Thumbnail for response.png]
 
vrayudu kumar
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On further investigation found that it's not calling the "load: function(type, data, evt)". Dojo experts please help

 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic