java - Passing an ArrayList of a class from a jsp to a servlet -
I have an ArrayList of a class room, I need to send a jsp to servlet
It seems that an HTML or jsp can send a value for a sublet through a form, the method I tried to give it as a hidden parameter as follows:
& Lt; Input type = "hidden" name = "allRooms" value = "& lt;% = request.getAttribute (" allRooms ")%>" / & Gt; But the way I submit this form, I get a compilation error "string can not be converted to list" for the following:
< Code> list & lt; Cell & gt; AllRooms = (list & lt; cell & gt;) request.getParameter ("allRooms"); Change the first parameter to the object type first and then converting it to the shown list below gives the only exception, but this time as a runtime exception: < Pre> object a = (object) request.getParameter ("allRooms"); & Lt; Cell & gt; AllRooms = (list & lt; cell & gt;); Is there a method to pass the list in the sublet or should I set it as a session variable in JSP?
Thanks in advance.
Use session . This is a best solution. ARLL to send through the HTML form. Instead use session
Comments
Post a Comment