• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

redirection problem

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sir
i want to redirect my page like i fill username and password in a HTML page and then it will be checked in a SERVLET and then as the username and password it will be get redirected to a JSP page..
below is the code--:::


it is running properly but when it will be redirected to a JSP page it will not showing any output......and not also giving any error..please tell me the mistake i m making....
thank you
gaurav

[EDIT - code tags added by Dave]
[ February 16, 2005: Message edited by: David O'Meara ]
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's not the way to do it in Servlets, have a look at response.sendredirect()

Please try to use code tags when posting code.

thanks,
Dave.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, and this is more of a JDBC issue than a servlet one, it is very inefficient to pull all the records from the table and loop through them in the Java code like that.

Instead of "SELECT * FROM LOGIN", use
"SELECT * FROM LOGIN WHERE user_name = '" + user + "' AND password = '"" + pass + "'";
(or better, use a preparedStatement).

This will return either 0 or 1 rows.

This lets the database, which is much more suited to this type of work, handle the searching. It also cuts down on the network traffic between the database and webserver machines.
 
look! it's a bird! it's a plane! It's .... a teeny tiny ad
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic