Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Pass data to new JSP  RSS feed

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JSP that retrieves JSON data from a remote server using a Java scriptlet.

String url = "http://www,";
URL jsonpage = new URL(urlStr);
URLConnection urlcon = jsonpage.openConnection();
BufferedReader buffread = new BufferedReader(new InputStreamReader(urlcon.getInputStream()));
String jsonObj = buffread.readLine();

I parse the jsonOBJ, then dynamically create rows for an HTML table using Javascript for each partNo found in the search. Each table row shows only summary info...partNo, description, supplier. The partNo field is created as a link in one of the cells:

var a = document.createElement("a");
var url = "showDetails.jsp?" + partNo;
a.setAttribute("href", url);
var cell = row.insertCell(-1);

I want to show the user the full details of the partNo on a separate HTML / JSP Page when clicked. So I tried passing the partNo to the new JSP as part of the url (see above), and then use AJAX to GET the info from the server again.

url: "http://www,",
type: "get",
dataType: "json",
success: function(data) {
error: function() {

I'm getting the dreaded CORS error and JSONP format is not available from the remote server. What is the best way to show the details of the clicked partNo in a new JSP window?
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!