File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Help reqd. in displaying results Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Help reqd. in displaying results" Watch "Help reqd. in displaying results" New topic

Help reqd. in displaying results

Priya Sri
Ranch Hand

Joined: Mar 30, 2004
Posts: 84
hi friends,

I am doing a project using java servlets,java beans and jsp pages.
I have a customer master form (HTML Or JSP) with input text fields and few buttons for insert,delete,first,next,previous,last.

I have a servlet which will take 'post' request from jsp page when one of these buttons clicked and calls the relavant functions which were implemented in java bean.

My Problem is, I want to display the relevant records in the data input form whenever the user clicks next,previous,delete buttons... etc.

For example, When the user clicks next button , the values in the data input fields should show the next customer record. I am able to pick the correct record from the bean to servlet but how can i replace the existing customer record values with the next customer record values in my data input form. I would like to know how you would implement this if they come across such a requirement.

David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724
If I good understand your question, I think you should JavaScript to clear the form and fill it with new values.

SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
Nitin Dubey
Ranch Hand

Joined: Oct 30, 2000
Posts: 126

When next button is clicked make a call to another servlet/JSP that will query the record and generate the HTML code that will be thrown to the client.

Nitin Dubey
Murthy Cherukumilli
Ranch Hand

Joined: Aug 05, 2004
Posts: 45
hi lakshmi

I am assuming that you are inserting the bean in the session and reading the bean from session on the jsp.

As you said you are getting the right bean into the servlet, after once you have the bean in the servlet replace this new bean in the session and then forward your request to your jsp then your Jsp will be automatically reloeaded with the data from new bean. (use struts if possible , will make your life easy)

Thanks<br />Murthy (SCJP 1.4 , SCWCD 1.4)
Senthil B Kumar
Ranch Hand

Joined: Feb 09, 2004
Posts: 160
May be the bean populated with the new set of data retrieved from the database, is not set in session.

Use a JSP to display the records, in your JSP use the usebean tag to show the data.

or create the bean with data retrieved from database, and put it in request object.

and get this bean in the jsp

and display the values from the bean as follows


MyBean myBeanObj = (MyBean) request.getAttribute("mybean");
String username = myBeanObj.getUserName();


<input type=text name=mytextbox value= "<%=username%>">

Work like you don't need the money. Love like you've never been hated. Dance like nobody's watching. Sing like nobody's listening. Live like it's Heaven on Earth.
Currently I Reside Here WEBlog
subject: Help reqd. in displaying results
It's not a secret anymore!