Boa tarde a todos,
pessoal, eu estou com um problema , não consigo recuperar um array do servlet para a view … alguem poderia me ajudar?? muito Obrigado![color=darkred] [/color]
Primeiramente , o Servlet(GET) - (recupero um id da view, e com ele , na chamada de um metodo , varro os arquivos de uma classe… depois os armazeno em um json e depois num JsonArray,
O PROBLEMA É QUANDO TENTO RESGATAR OS DADOS USANDO O METODO $.getJSON()…)
É PASSADO O SEGUINTE ERRO... (NA PAGINA)
“NetworkError: 404 Not Found - http://localhost:8080/uploader1/..js/jquery-1.9.1-min.js” jquery…-min.js
“NetworkError: 404 Not Found - http://localhost:8080/uploader1/..js/jquery-1.9.1-min.js” jquery…-min.js
O método getAttributeNode() não deve mais ser usado. No lugar, use getAttribute().
[Parar neste erro]
…ute(i),“string”==typeof r){try{r=“true”===r?!0:“false”===r?!1:“null”===r?null:+r…
jquery…-min.js (linha 3)
ReferenceError: JsonAndAjax is not defined
[color=red][b] [/color][/b]
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
//Recuperar o Nome da pasta de um parametro da queryString
PrintWriter out = resp.getWriter();
try {
String requestId = req.getParameter("requestId");
UploadDir upDir = new UploadDir(requestId, false);
ArrayList<File> listaFile = upDir.getFiles();
resp.setContentType("application/json;charset=UTF-8");
JSONArray jarr = new JSONArray();
for(File f : listaFile){
JSONObject job = new JSONObject();
job.put("Nome :", f.getName());
job.put("Size :" ,f.getTotalSpace());
job.put("Content type:", "jpg");
job.put("url:", "INCLUIR_URL_CORRETA");
jarr.put(job);
}
// out.println(jarr.toString());
// req.setAttribute("msg", jarr.toJSONObject(jarr));
// req.getRequestDispatcher("jqueryui.html").forward(req, resp);
} catch (UploadException e) {
e.printStackTrace();
out.println("{'error':"+e.toJson()+"}");
}
//recuperar list de File