Hi connelly,

Your problem has a straightforward solution.
Simply use getParameter(<name>) to obtain the value of username and
passsword fields in your HTML and then run through the validation
logic.


manoj


>From: connelly <[EMAIL PROTECTED]>
>Reply-To: "A mailing list for discussion about Sun Microsystem's Java
>        Servlet API Technology." <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Fwd: Re: passing valuees from javascript to servlets
>Date: Wed, 17 Nov 1999 11:57:38 -0700
>
>Given the information that was passed back and forth on this conversation,
>I
>have a question for you guys.
>
>I  am working on a project where I need to do some validation against a
>database with the "username  and password".  Since they will be inputing
>this
>in on the html side and I need to do validation on the Servlet side, would
>I be
>doing the same thing(or something similar)?  I understand how to pass it
>back
>now but how would this work on TextFields or would I shoot the data back
>to the servlet on the "onClick" of the Login button?
>
>Any suggestion you would have would be greatly appreciated.
>
>Jeremiah
>
>
>On Tue, 16 Nov 1999, you wrote:
> > But how do I pass the parameter 'category' to the ServletB as a variable
>in
> > the following as suggested by you.
> >
> > <tr><td>
> >     <a href="/servletB?category=xxxxx">yyyyy</a>
> >     </td></tr>
> >
> > That is what I am finding tricky to do.
> >
> > Manoj
> >
> >
> > >From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
> > >Reply-To: "A mailing list for discussion about Sun Microsystem's Java
> > >        Servlet API Technology." <[EMAIL PROTECTED]>
> > >To: [EMAIL PROTECTED]
> > >Subject: Re: passing valuees from javascript to servlets
> > >Date: Tue, 16 Nov 1999 08:20:49 -0800
> > >
> > >manoj kumar wrote:
> > >
> > > > Hi Andras/Pradeep,
> > > >
> > > > Thanks for the help.
> > > > My problem is a little bit more complicated.
> > > > I am able to pass values from a HTML element to a Servlet.
> > > > My problem is that based on that value I want to fire a query on a
> > >table.
> > > > Let me further expalin the problem.
> > > > Upon clicking a HTML link(or button), a servlet is called(A), which
> > >fires  a
> > > > select query on a table
> > > >
> > > > select category_description from category_master
> > > >
> > > > The result of this query is formatted into an html page and sent
>back
> > > > to browser.Now the user selects a particular category and presses
> > > > submit/next(whatever).This results in a call to another servlet(B)
>or
> > > > the same servlet(A,how..?) which in turn fires another query
> > > >
> > >
> > >You don't need JavaScript to do this, although you could use it for
>some
> > >fancier user interface effects.
> > >
> > >The simplest approach:
> > >
> > >* Change the above query to something that selects the
> > >   key as well as the description:
> > >
> > >     select category_code, category_description
> > >         from category_master
> > >
> > >* In servlet A (the one that does the query above), create
> > >   an HTML table with one row per category.  The table will
> > >   show the descriptions in a column.
> > >
> > >* For each category description, create a hyperlink to your
> > >   second servlet, passing the category code as a query
> > >   parameter.  You'll end up with something like this:
> > >
> > >     <tr><td>
> > >     <a href="/servletB?category=xxxxx">yyyyy</a>
> > >     </td></tr>
> > >
> > >   where "/servletB" is the URL of your second servlet,
> > >   xxxxx is the category code for this row, and yyyyy is
> > >   the category description for this row.
> > >
> > >* The user sees a list of hyperlinks.  When he or she clicks
> > >   one, it calls servlet B and passes the category code of the
> > >   selected category.  In servlet B, you can retrieve this with:
> > >
> > >     String category = request.getParameter("category");
> > >
> > >* Use this to dynamically construct your second SQL statement.
> > >
> > > >
> > > > select product_name from product_master where category_code=xxxxxx
> > > > This 'xxxxxxx' is something which should correspond to the category
> > >selected
> > > > by the user in the previously generated html page(by servlet A).
> > > > I was thinking of making it possible through javascript but couldn't
> > >find a
> > > > solution.
> > > >
> > >
> > >You could use a similar approach to the above to create, for example, a
> > ><select> element for the categories instead of a list.  If you add an
> > >"onchange" JavaScript event handler, you could even have it submit the
> > >request
> > >immediately, without waiting for another button to be pressed.  See one
>of
> > >the
> > >many web sites focused on JavaScript for details of how to do this.
> > >
> > > >
> > > > hope this clears the idea.
> > > >
> > > > help is immidiately needed.
> > > >
> > > > thanks
> > > >
> > > > manoj
> > > >
> > >
> > >Craig McClanahan
> > >
> >
> >___________________________________________________________________________
> > >To unsubscribe, send email to [EMAIL PROTECTED] and include in the
>body
> > >of the message "signoff SERVLET-INTEREST".
> > >
> > >Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > >Resources: http://java.sun.com/products/servlet/external-resources.html
> > >LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> >
> > ______________________________________________________
> > Get Your Private, Free Email at http://www.hotmail.com
> >
> >
>___________________________________________________________________________
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
>body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > Resources: http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to