Paging In java

J

jagadesh

Hi guys ,

i need to implement a paging type of application. what my requirement
is i will develop a medical form
and give it to the patient.The medical form contains sections with
field in it like firstname,lastname and age .so when the patient is
given the form the patient should see the form in paging way .
consider if i have 10 sections , i need to show 2 sections for every
page and when i click next i should get next 2 sections in another
page.and the main thing is if i type any answers in any of the field
in first page and go to second page,the answers in first page are to
be saved like cache . what is the best way to implement this .should i
save the answers in Database or maintain a hashMap for every section
in client side so that when the patient clicks submit all answers in
that are send to database

Can anyone sort me out from this issue?

Thank u.
 
R

RedGrittyBrick

jagadesh said:
Hi guys ,

i need to implement a paging type of application. what my requirement
is i will develop a medical form
and give it to the patient.The medical form contains sections with
field in it like firstname,lastname and age .so when the patient is
given the form the patient should see the form in paging way .
consider if i have 10 sections , i need to show 2 sections for every
page and when i click next i should get next 2 sections in another
page.and the main thing is if i type any answers in any of the field
in first page and go to second page,the answers in first page are to
be saved like cache . what is the best way to implement this .should i
save the answers in Database or maintain a hashMap for every section
in client side so that when the patient clicks submit all answers in
that are send to database

I would use a JTabbedPane or a CardLayout.

http://java.sun.com/docs/books/tutorial/uiswing/components/tabbedpane.html
http://java.sun.com/docs/books/tutorial/uiswing/layout/card.html

You can also find 3rd party Wizard Panel classes or articles. It's not
hard to roll your own if you want something simple.
 
A

Arved Sandstrom

jagadesh said:
Hi guys ,

i need to implement a paging type of application. what my requirement
is i will develop a medical form
and give it to the patient.The medical form contains sections with
field in it like firstname,lastname and age .so when the patient is
given the form the patient should see the form in paging way .
consider if i have 10 sections , i need to show 2 sections for every
page and when i click next i should get next 2 sections in another
page.and the main thing is if i type any answers in any of the field
in first page and go to second page,the answers in first page are to
be saved like cache . what is the best way to implement this .should i
save the answers in Database or maintain a hashMap for every section
in client side so that when the patient clicks submit all answers in
that are send to database

Can anyone sort me out from this issue?

Thank u.

What technology are you using for your web application? That information
would help with some of the details in an answer.

One of your requirements stipulates that there will be no database
commit until a submit on the final page. So in the easiest approach
you'll end up either storing data between requests in session scope or
passing them as request parameters.

In terms of what you see, this is perhaps more implementation dependent.
Although in principle you could have N different pages or just one (in
the latter case you'd show only the current sections).

AHS
 
J

jagadesh

Iam using Gwt as my User Interface . i will be writing the code in
java.is it better to store data in hashmap between pages or in
session.
meanwhile my requirement changed as i will have a save button for
every page . so if patient fills the page 1 with answers , he can save
the data there itself and move to next page.


any more alternates . thanks for all the solutions guys
 
A

Arved Sandstrom

jagadesh said:
Iam using Gwt as my User Interface . i will be writing the code in
java.is it better to store data in hashmap between pages or in
session.
meanwhile my requirement changed as i will have a save button for
every page . so if patient fills the page 1 with answers , he can save
the data there itself and move to next page.


any more alternates . thanks for all the solutions guys
What is the function of the Save button on each page, as opposed to the
Next button you planned before? If it's actually saving to the database
then you no longer have a problem. Or am I misunderstanding what the
Save button is doing?

AHS
 
R

RedGrittyBrick

jagadesh said:
Iam using Gwt as my User Interface .

I don't know GWT but I hope I am right in assuming that it allows you to
write a Java Desktop application using Swing widgets and have that
compiled to an equivalent set of HTML/Javascript for deplyment as a
web-server based application accessed using a web-browser.

i will be writing the code in
java.is it better to store data in hashmap

It is better to store data in objects of the appropriate types. Usually
these would be objects you have constructed for that purpose. In some
circumstances these kinds of objects are referred to as Data Transfer
Objects (DTO), in other circumstances people might describe them as
problem-domain objects that model real-world concepts. These objects
might be fields of a model class of some sort but they would have a
scope that enables them to fulfil their purpose within your application.

This sounds vague because you haven't revealed an details of your
application, so I can only discuss generalities.

between pages or in session.

Whichever you need in order for your application to fulfil it's purpose.

meanwhile my requirement changed as i will have a save button for
every page . so if patient fills the page 1 with answers , he can save
the data there itself and move to next page.

any more alternates . thanks for all the solutions guys

From your earlier postings it seemed as if you were leading the user
through some task broken down into stages where some stages depended on
selections or entries made in earlier stages. I wouldn't have a save
button on every page, I'd try to match my customer's expectations from a
"wizard" style of dialogue.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,274
Latest member
JessMcMast

Latest Threads

Top