1 Reply Latest reply on Sep 19, 2011 7:48 PM by gimbal2

    When i am running following Servlet i am getting following exception pls te

    889155
      When i am running following Servlet i am getting following o/p
      java=[Ljava.lang.String;@37bf73

      instead of printing the stateList its printing the[Ljava.lang.String;@37bf73
      pls Explain why this Exception is coming
      DETAILS
      import java.io.*;
      import javax.servlet.*;
      import javax.servlet.http.*;
      ShowServlet2.java
      public class ShowServlet2 extends HttpServlet
      {
      public void doPost(HttpServletRequest req,
      HttpServletResponse res)throws ServletException,
      IOException
      {
      String searchString = req.getParameter("searchstring");
      String[] stateList = req.getParameterValues("state");
      PrintWriter pw = res.getWriter();
      pw.println(searchString+"="+stateList);
      }
      }
      Index.HTML
      <form action="/ShowServlet2" method="POST">
      Technology : <input type="text" name="searchstring" value="java">
      <br><br>
      State : <select name="state" size="5" multiple>
      <option value="NJ">New Jersey</option>
      <option value="NY">New York</option>
      <option value="KS">Kansas</option>
      <option value="CA">California</option>
      <option value="TX">Texas</option>
      </select>
      <br><br>
      <input type="submit" value="Search Job">
      </form>
      Web.xml
      <web-app>
      <servlet>
      <servlet-name>fourth </servlet-name>
      <servlet-class> ShowServlet2</servlet-class>
      </servlet>

      <servlet-mapping>
      <servlet-name>fourth </servlet-name>
      <url-pattern>/ShowServlet2</url-pattern>

      </servlet-mapping>

      </web-app>