Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JSP and JavaBeans

Status
Not open for further replies.

crguy

Programmer
May 24, 2001
34
CA
Hi,

I am new to Java.

I have a JSP page that will pass a customer ID to getCustName.java. I do not know how to write a simple select statement JavaBean that will take the custID and select the custName and then in turn send it to another JSP page. Can anybody help with this?

Thanks
VC


 
The sending the data to another JSP is accomplished in the first JSP handling the request via either a request.sendRedirect() or
Code:
<jsp:forward page=otherjsp.jsp />
, the functioning of the bean to retrieve the username based on userid would be pretty standard code using JDBC and JNDI which you can find examples of in any halfdecent book on enterprise Java.
 
I assume I could use the <form> tag to submit the custID from one JSP to another. Is this correct?

ThanksVC
 
You may also use HTTPSession to store and pass values (name value pairs) to next page. Else you may do getParameter of the form field in the invoked page.
 
Hi,

Thanks for the comments, but I think I solved my problem.
This is what I did, I created a Java class (javaClass.java). I placed all my business logic in this class.

I then use the <jsp: include...> and <jsp: foward...>
in my JSP pages.

Not sure if this is the correct approach, but it does work.

Thanks
VC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top