wood burning stoves 2.0*
The moose likes JSP and the fly likes Newbie help - forms and javabeans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Newbie help - forms and javabeans" Watch "Newbie help - forms and javabeans" New topic
Author

Newbie help - forms and javabeans

Linda Thomas
Ranch Hand

Joined: Jun 21, 2004
Posts: 36
I have been working as a student Web Developer at my college since January of last year. For having worked here for 17 months I feel I lack much of the skill I think I should have. I don't think my supervisor has worked much with JSP before but perhaps with Java.

So now I have a new project and I want to implement JavaBeans because I believe the last project I did was sloppy and inefficient. I have a few questions related to the project I'm going to work with:

(Project is a system for counselors to register, be authorized, add clients, update, etc...)

1. We use stored procedures in class files to do all our database stuff (though I do code directly to the database to generate listboxes), but we have had a lot of trouble carrying information from page to page. While session variables are great they can sometimes be confusing (where to create and where to empty). The forms can be quite big so I'd like to use a bean to store information. Can I use a bean to capture information, display it on a verify page and then send the information to a class file from the bean? Usually we use request.getParameter on the class file and put the variables we want to pass in a URL or hidden fields for a form. This seems messy to me. I've done basic form stuff with beans and know how to get the beans to store information from a form, but on the verify page when the user clicks submit and calls the class file, how will I get the information in the bean?

2. Most forms I make have only a couple of listboxes. Some are generated from the database and some we use a functions.jsp to assign values, ie. if labType = 1 labName = Open Lab. My supervisor wants me to use the functions file to set up some pretty big listboxes which is cool but we have been storing each select in its own .jsp file. So for addRoom.jsp, it calls displayLabtype with the code:
<jsp:include page="displayLabtype.jsp" flush="true">
<jsp aram name="LabType" value="<%=LabType%>" />
</jsp:include>
My largest form is going to have a minium of 12 dropdown boxes. I don't really want to create a different .jsp page for each. I do like the idea of seperating this information to make it easier to read the code so I thought maybe I could make one ListBox.jsp and have an if statement to test a parameter I'd pass to define which listbox I want.
How do most pages generate forms with this much information? I've read about java.awt.List and javax.swing.JList but to be honest it is a bit confusing for me. Would either of these provide a viable option?

I don't know how much experience my supervisor has with JSP and there is a language barrier so I feel I need to be aggressive with my own education. I also need to know what I'm doing so I can explain it to him. There are 4 students here and I'm the most senior one and feel I should know more than them so I can help them cope. There isn't much in the way of standards and we have joined forces to make a work binder of information to help us and new students learn to work with JSP and to make our code clearer and easier to read. So many of our programs are all written different ways that it is difficult to go to a working project for reference to what we are doing now.

I really feel that javabeans would be helpful since we've had problems passing information between pages, especially if there are special characters. Can anyone suggest some good beginner sites that can explain the basics to me because when I try to find code now I find I'm struggling with a lot of common knowledge that advance programmers do not explain. I'd like to get the basics down pack so I can understand more advanced coding.

Thanks!
Linda
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Newbie help - forms and javabeans
 
Similar Threads
Date javascript drop downs dynamically filled with jsp
Multiple forms with Use bean.
Form data loss
Problem with forward and include JSP tag
Strange problem in retrieving the table data in a jsp