[英]how to pass a javascript array object from a jsp page to another jsp page or servlets
The Problem is - i have generated a javascript JSON array (below screenshot) in a jsp page. 问题是-我在jsp页面中生成了一个javascript JSON数组(在屏幕截图下方)。 Now i want to send that javascript array object from the current page(JSP) to another page(JSP or servlet).
现在,我想将该JavaScript数组对象从当前页面(JSP)发送到另一个页面(JSP或servlet)。 Please help.
请帮忙。 Please provide me the alternative solutions as well which will work best.
请同时向我提供最佳解决方案。
************ To be more precise ***************** I am having a project which involves JSP and Servlets. ************更准确地说,****************我有一个涉及JSP和Servlet的项目。 Now there is index.jsp which asks a user to upload data sheet(excel sheet), the file is uploaded on the server by calling/sending the file through a servlet.
现在有index.jsp,它要求用户上传数据表(excel工作表),通过通过servlet调用/发送文件将文件上传到服务器上。 That servlet then tries to extract the data(rows and columns) and generates a 2D Java array with same dimensions.
然后,该servlet尝试提取数据(行和列)并生成具有相同尺寸的2D Java数组。 This array is then sent to a JSP page (output.jsp) which gets this java array and converts it to JavaScript JSON array called as " data ".
然后将此数组发送到JSP页面(output.jsp),该页面将获取此java数组并将其转换为称为“ data ”的JavaScript JSON数组。 I am performing some edit operations on this page and the changes gets affected in array accordingly.
我正在此页面上执行一些编辑操作,并且更改会相应地影响数组。 What i want is - I want to send that data array object to another jsp page where i can convert it into Java Array for further use.
我想要的是-我想将该数据数组对象发送到另一个jsp页面,在这里我可以将其转换为Java Array以便进一步使用。
you can probably save java script array object as a session attribute & get that in another JSP. 您可能可以将Java脚本数组对象另存为会话属性,并在另一个JSP中获得它。
session.setAttribute("Object",object)
session.getAttribute("Object",object)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.