• 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:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

How to send a group of values from client side to Server?

 
Ranch Hand
Posts: 240
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, great people!
Assume there is a healthcare application, It is admin/Doctor's task to choose the available time slots out of total slots for the day. He selects the slots and clicks on save button. These time slots have to be stored into 'available-slots' table in the db.
Now I want to know what is the way to send all these time slots from client-side to the Server/backend in one go?
Will they all be sent as array of object?
How will they be extracted at backend once received?
If there are 30 slots to be stored, will there 30 queries be fired to insert each time slot?
How would you do this if you had to build this application? I will be grateful to you if you could help me giving an idea about it.

Thanks.
timeslots.png
[Thumbnail for timeslots.png]
time-slots
 
Saloon Keeper
Posts: 6888
163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the data become available all at once, I would send one request, in order to cut down on network overhead. That might not matter much if client and server are on the same network, though - are they?
 
Marshal
Posts: 67510
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would make them checkboxes, styled with CSS to look like blocks. Then let the form do all the work of sending the values to the backend just as checkbox groups usually are (each with the same name and assembled by the servlet container¹ into an array).




¹ Assumes a Java backend; but as this was originally posted in an EJB forum, Java seems to be a given.
 
Bear Bibeault
Marshal
Posts: 67510
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unless only one can be chosen, and then I'd use radio buttons in the same way. But then, there's no question about multiple values, so...

Your description of the problem, and the screen capture you show don't really line up. Your problem description says the user is a doctor, but the figure shows how a patient selects a single time slot. I assume it was just an example of how you want the slots to appear on the form?
 
Arun Singh Raaj
Ranch Hand
Posts: 240
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Bear Bibeault,
As per my description, there is an Admin or Doctor who knows what time slots he can allow patients to visit, so he has to select multiple time slots he will be available in.

Thank you all for the information.
 
Arun Singh Raaj
Ranch Hand
Posts: 240
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The picture shows the view of patient's side, I apologise for the confusion, I just wanted to show the 'multiple time-slots'. The same type of slots will appear on the screen of Admin.
So please consider just the time-slots, not 'book an appointment' button n other view.
Thanks
 
Bear Bibeault
Marshal
Posts: 67510
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, that's what I wanted to make sure of. So, yes, the checkbox approach would work.

You can google around for how to make checkboxes look like blocks instead of their usual appearance (or use a CSS framework that has this built in -- Bootstrap may).

If you want/need to do it by hand, you'd pass the values in the query string as params with all the same name. That causes the servlet container to group them as an array for passing to your servlet.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai, I see your calendar design for your website.i need some calendar plugin. how to purchase this are plugins
 
Squanch that. And squanch this tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic