Note that there are some explanatory texts on larger screens.

plurals
  1. POneglect it--------------Sending an array to servlet from jsp page and recieving it in servlet------------ neglect it
    primarykey
    data
    text
    <p>*</p> <blockquote> <p>neglect it</p> </blockquote> <p>*</p> <p>I am lerner in JSP and java field. I am stuck in a problem. I hv mentioned my code below.</p> <p>My JSP code:</p> <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org /TR/html4/loose.dtd"&gt; &lt;html&gt; &lt;script src="http://code.jquery.com/jquery-1.9.1.js"&gt;&lt;/script&gt; &lt;script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"&gt;&lt;/script&gt; &lt;script&gt; $(document).ready(function() { $("#save").click( function () { var arrayxx= new Array(5); arrayxx[0]=0; arrayxx[1]=3; arrayxx[2]=4; arrayxx[3]=9; $.get('Save1',{arrayX:arrayxx},function(responseJson) { } ); }); }); &lt;/script&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt; &lt;title&gt;Insert title here&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;input type="button" id="save" value="save" &gt;&lt;/input&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>My servlet:</p> <pre><code> import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class Save1 extends HttpServlet { private static final long serialVersionUID = 1L; public Save1() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("INSIDE SERVLET"); String [] yourList = request.getParameterValues("arrayX"); System.out.println(request.toString()); System.out.println(yourList[0]); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } } </code></pre> <p>I cant able to pass the array from JSP to servlrt. Please help me with this. When i receive the array, i found that array does not contain any element.</p> <p>Thanks in advance</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload