Retrieved data display on another jsp page in java
how to display retrieved data on another jsp page in java?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Shweta LodhaRank #31 · 39.8K reputationPosted Mar 11, 2014, 11:55 AM EDT
In your first.jsp file, try using $.post instead (more appropriate).
$.post("second.jsp", {'name': name}, function(data) { alert("Result from second.jsp: " + data.name + " " + data.type); } );In your second.jsp file, you can now get "name" variable like this
request.getParameter("name")Then, do your query and return the result
@page import="org.json.simple.JSONObject"%> if (request.getParameter("name") != null) { response.setContentType("application/json"); ... your select query ... JSONObject json = new JSONObject(); ... put your sql data like this ... json.put("name", "hello"); json.put("type", "world"); response.getWriter().write(json.toString()); } %> original link: http://stackoverflow.com/questions/21068389/pass-value-from-one-jsp-page-to-another-jsp-page-and-get-response-data-back-from