Click here to Skip to main content
15,886,069 members
Home / Discussions / Java
   

Java

 
QuestionGabor Patch Generator Pin
amirsharifzadeh20-Dec-14 22:01
amirsharifzadeh20-Dec-14 22:01 
SuggestionRe: Gabor Patch Generator Pin
Richard MacCutchan20-Dec-14 22:14
mveRichard MacCutchan20-Dec-14 22:14 
QuestionHow to Use Delimiters in my program(Does not work and Crashes) Pin
Kaytlyn Grace Lau20-Dec-14 7:44
Kaytlyn Grace Lau20-Dec-14 7:44 
AnswerRe: How to Use Delimiters in my program(Does not work and Crashes) Pin
Richard MacCutchan20-Dec-14 21:06
mveRichard MacCutchan20-Dec-14 21:06 
AnswerRe: How to Use Delimiters in my program(Does not work and Crashes) Pin
Richard MacCutchan21-Dec-14 4:01
mveRichard MacCutchan21-Dec-14 4:01 
GeneralRe: How to Use Delimiters in my program(Does not work and Crashes)(SOLVED) Pin
Kaytlyn Grace Lau21-Dec-14 9:18
Kaytlyn Grace Lau21-Dec-14 9:18 
GeneralRe: How to Use Delimiters in my program(Does not work and Crashes)(SOLVED) Pin
Richard MacCutchan21-Dec-14 22:44
mveRichard MacCutchan21-Dec-14 22:44 
Question[SOLVED] Does not redirect properly Pin
Django_Untaken14-Dec-14 20:52
Django_Untaken14-Dec-14 20:52 
Hello. I am trying to authenticate input from databse using JDBC and then redirect the user to another page accordingly. Here is my code for small servlet that does authentication
Java
public class ServletAuthUser extends HttpServlet
{
	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
	{
	  try
	  {
		String sUserName = request.getParameter("username");
		String sPassword = request.getParameter("password");

		String sURL = "Jdbc:Odbc:ServletsDB_DSN";
		String sForName = "sun.jdbc.odbc.JdbcOdbcDriver";
		MyDatabase db = new MyDatabase(sURL, sForName);		
			
		boolean bIsUserValid = (sUserName.equals("admin") && sPassword.equals("admin")) ? true : false;//boolean bIsUserValid = db.AuthUser(sUserName, sPassword);
		db.CloseConnection();
			
		if(bIsUserValid == true)
        		response.sendRedirect("welcome.html");
		else
			response.sendRedirect("error.html");
}

And here is my welcome page.
HTML
<html>
	<head>
		<title>Welcome</title>
	</head>
	<body>
		<h1>Welcome ADMIN.</h1>
	</body>
</html>


I have tried recompiling the servlets and then restarted the apache server several times but my login servlets still shows me the old output that I tried little ago (another servlet which generates data using JDBC). Why is it still showing the same old output despite recompiling the servlet and restarting the server? Please ask for any info if you need. Thanks for any input.


EDIT
I was not writing the deployment descriptor properly.

modified 19-Dec-14 14:13pm.

QuestionRe: Does not redirect properly Pin
Richard MacCutchan14-Dec-14 22:19
mveRichard MacCutchan14-Dec-14 22:19 
QuestionLogin Details Authentication Pin
JayantiSh13-Dec-14 12:08
JayantiSh13-Dec-14 12:08 
AnswerRe: Login Details Authentication Pin
Richard MacCutchan13-Dec-14 21:33
mveRichard MacCutchan13-Dec-14 21:33 
GeneralRe: Login Details Authentication Pin
JayantiSh16-Dec-14 3:27
JayantiSh16-Dec-14 3:27 
GeneralRe: Login Details Authentication Pin
TorstenH.17-Dec-14 2:19
TorstenH.17-Dec-14 2:19 
Generaljava Pin
Member 109275319-Dec-14 1:48
Member 109275319-Dec-14 1:48 
GeneralRe: java Pin
Richard MacCutchan9-Dec-14 6:11
mveRichard MacCutchan9-Dec-14 6:11 
GeneralRe: java Pin
TorstenH.11-Dec-14 22:14
TorstenH.11-Dec-14 22:14 
QuestionPassing JTextField Values to MouseListener Interface Pin
Django_Untaken2-Dec-14 3:37
Django_Untaken2-Dec-14 3:37 
AnswerRe: Passing JTextField Values to MouseListener Interface Pin
Richard MacCutchan2-Dec-14 5:27
mveRichard MacCutchan2-Dec-14 5:27 
GeneralRe: Passing JTextField Values to MouseListener Interface Pin
Django_Untaken3-Dec-14 5:52
Django_Untaken3-Dec-14 5:52 
GeneralRe: Passing JTextField Values to MouseListener Interface Pin
Richard MacCutchan3-Dec-14 6:26
mveRichard MacCutchan3-Dec-14 6:26 
QuestionAuthentication and Encryption Pin
Anele Ngqandu2-Dec-14 2:26
Anele Ngqandu2-Dec-14 2:26 
AnswerRe: Authentication and Encryption Pin
Richard Deeming2-Dec-14 2:38
mveRichard Deeming2-Dec-14 2:38 
GeneralRe: Authentication and Encryption Pin
Anele Ngqandu2-Dec-14 2:44
Anele Ngqandu2-Dec-14 2:44 
AnswerRe: Authentication and Encryption Pin
ZurdoDev2-Dec-14 2:41
professionalZurdoDev2-Dec-14 2:41 
GeneralRe: Authentication and Encryption Pin
Anele Ngqandu2-Dec-14 2:45
Anele Ngqandu2-Dec-14 2:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.