It's not a secret anymore!
The moose likes JSP and the fly likes Retrive data using usebean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Retrive data using usebean" Watch "Retrive data using usebean" New topic

Retrive data using usebean

Kaustav Khan

Joined: Jul 23, 2011
Posts: 1
I want to fetch the data from the database & show in a jsp page using jsp:usebean in MVC model 2 architecture. Suppose after login a user can view his/her details which he entered at the time of registration & these data will be fetched using bean property.

This is Bean

This is the Business Logic

This is the

This is the Registraion page where the user give their detail at the time of registration-------registration.jsp

This is the final view Page where I getting the null value--view.jsp

How can I display the Id & respective Password of the member in the view.jsp page..?
Junilu Lacar

Joined: Feb 26, 2001
Posts: 6529

I'm not giving you an answer to your question but I will give you the reasons why, even though I might know what the problem is, I'm not going to give it to you :

1. Resentment - that you made me read code and constantly try to interpret those short names you have used all over your code. You are not doing anyone else a favor by using short, cryptic names like "rg", "rgg", "reg", "Reg", "RegBS". They make your code difficult to read and if you want people to review your code and help you find problems, you shouldn't make them work any harder than they should.

2. Agitation - I get agitated when I see bad names. There is a reason for separating the View and the Controller layers in MVC. You seem to want to combine them again in your "ViewControl" class. Also, what is "BS" in "RegBS"? Do you realize that "BS" is a very well-known acronym for "crap"? Another indication that you're mixing layers: "Model.BS.RegBS". From all appearances, RegBS is a Data Access Object. This IS NOT an object that is in the Model layer. This is an infrastructure service: it's responsibility is ORM of Reg objects to/from a database. The good thing is that you have kept that responsibility well separated, so far.

So fix these problems first then maybe I'd be inclined to go through that code again and help you find your bug.

Edit: Just so you don't get the wrong impression, I'm not really very upset or anything like that. It's hard to convey a playful "mad" tone but that's how you should read this post. Seriously, though, please make an effort to spell names out. Unreadable names really do bug me when I read code, especially when a little effort on the programmer's part to type out words would really go a long way to help improve readability.

Junilu - [How to Ask Questions] [How to Answer Questions]
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

useBean was famous in model 1 architecture(jsp), not now. and operating *List of Bean* in useBean is not a good idea...
I agree. Here's the link:
subject: Retrive data using usebean
jQuery in Action, 3rd edition