This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

How can I get my form inside the arraylist?  RSS feed

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Netbeans in this project. I need to pass the typed information in the form using POST to an arraylist so that when the Servlet is called by GET, it displays a table with the data! But I'm totally new to programming and my knowledge only extends to creating simple forms using POST and receiving POST. Someone can possibly explain this or post a code that do this?

My codes are:


and

 
Rancher
Posts: 1878
15
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you mean you wish to store information retrieved in servlet in an array list?
 
Nate Lewis
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

"Do you mean you wish to store information retrieved in servlet in an array list?"
Swastik Dey



Yes, I wanna save this informations (name, email, phone) in an array list so i can retrieved and display with servlet!
 
Nate Lewis
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! To be specific I need to make a form (html5) where people can type name, email and phone number. Call a Servlet (POST) Save the data in Arraylist and if the Servlet is called directly (GET) it must display a table with the informations that were typed.
 
Master Rancher
Posts: 3629
40
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this data supposed to last for the session?
If so, you can store the ArrayList in the session (which you can get from the request object).

Since this is data represents something (maybe a User?) then it would make more sense to create a User class that holds these three pieces of data, and store that in the session.
 
Author and ninkuma
Marshal
Posts: 66804
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never use an array (or list) to store structured data. At minimum use a Map implementation, at best a custom class representing the structured data.

Why aren't you using JSP to create the HTML views?
 
Nate Lewis
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont have experience with coding with Servlets, the only thing I know is how to create the form. The rest is very difficult to me and I really need to understand this
Someone can show me an example off how can I do this? or a video where something like it its done.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!