Meaningless Drivel is fun!*
The moose likes Servlets and the fly likes post to servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "post to servlet" Watch "post to servlet" New topic
Author

post to servlet

Ramon Haayema
Greenhorn

Joined: May 17, 2008
Posts: 14
Hi everyone,

i ame trying to post a arraylist to a servlet...
i really havo no idea hoe to this in the form i made.
with the standard input field this is no problem.
i understand how to get to the servlet but not how to post a arraylist.
many thanks in advance.
Ramon
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41177
    
  45
Since you say "form", I assume you're trying to do this from a browser with an HTML form?

ArrayList is a Java class, so it can't be used by HTML. Can you tell us in more detail what you're trying to do?


Ping & DNS - my free Android networking tools app
Ramon Haayema
Greenhorn

Joined: May 17, 2008
Posts: 14
Within the jsp file i have a arraylist.
that array list need to get the servlet.
like
<FORM method="post" action="servlet/Servlets.loginservlet">
<H5>User id :<BR>
<INPUT size="10" name="user">
<BR>
Password :<BR>
<INPUT type="password" name="password" size="10"><BR>
<INPUT type="submit" name="Login" value="login">

like this accept,i need to post the arraylist.

i hope this explaind it.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41177
    
  45
Actually, I'm more confused now. A JSP doesn't post to a servlet - it generates text to be sent to the browser. The browser -where there's no Java involved- then posts something to a server if the user submits a form.

Are you trying to make the elements of the ArrayList part of the HTML form? If so, how about making them hidden fields of the form?
[ July 19, 2008: Message edited by: Ulf Dittmer ]
Yatin Dhingra
Greenhorn

Joined: May 06, 2008
Posts: 5
i believe you need to carry data from servlet to jsp. you need scope to carry it.. you can use request or session scope(accor to requirment) to store array list object in servlet and then retrieve it in jsp
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: post to servlet
 
Similar Threads
Pass a resultset to a jsp from servlet
Struts 1 display ArrayList particular Element
Array lists syntax in jsp
sending a Collection from JSP to Servlet
add all selected data to datalist and send back to servlet