[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: simple question on jsp

Venky Gangu wrote:
> Hey guys,
> Have a simple question (your guess is right, I am in the learning process).
> Following is a simple jsp where I have a 'text box', and 'two submit
> buttons'. I would like one button to process one jsp (student3a.jsp) and
> other to process other jsp (student3badd.jsp). Both these JSP's take the
> input from the text box and match the value in the text box for the query
> string and return some values from the database. For better understanding I
> have enclosed all the three jsp files ( I also have a bean which
> communicates with the db, but have not included here, as it is a
> straightforward code). Can someone, please let me know what the error is.
> Thanks for your help.
> If I use a html form with Action="jsp name" it is working fine, but then I
> had to use two text boxes for two buttons, and I don't want to do it that
> way (unless there is a different way in html). My goal is to have my first
> page to display a text box and two buttons, one button give me student's gpa
> and other student's course list using the concepts of jsp, javabean and jdbc
> (yes, your guess is right, this is a school assignment).

Ok. To start, I don't like boxes, buttons, etc... that are supposed to
work together not being enclosed in <form> tags, but that should not be
a problem. 

 if (request.getParameter("clist")=="Course List") {
 else {

1. "Course List".equals(request.getParameter("clist")) -- I know it
looks funny this way, but you don't need to wrry about a
NullPointerException if the getParameter returns a null.

2. else {
   <jsp ----
}    ------don't forget the <jsp: tag nedds to be part of the html, not
the java code.

There may be other probs as well, but those 2 stood out.