Servlets :: Login Form - All Attributes Are Null And HTTP Status 404 Error In Some Cases
May 20, 2014
I'm a new Java user and I'm trying to code a simple login page. In first page (NewFile.jsp) users should enter their username and password and should click on "login", or click on "sign up".
1.) If user enters his username and password correctly, a login page (LoginPage.jsp) appears and says "welcome null" but it should show the name of that user instead of null.
2.) In that login page there is an edit button to edit profile information. When I clicked on it, every information is "null" and when I edit them and click on "Submit" button;
HTTP Status 404 -
type Status report
message
description The requested resource () is not available.
GlassFish Server Open Source Edition 3.1.2
that message appears.
3.) If I click on "Sign Up" button at the beginning, a registration jsp (SignUpPage.jsp) appears. After filling up text boxes and clicking on "Submit", same Status 404 screen appears.
I created a mysql database called "loginpage" using xampp. In that database there is a table called "users" and it has un, pass, name, surname, email and degree attributes.
Here is a screenshot of my project explorer:
Here is my code:
1. NewFile.jsp
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.util.*"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
[Code] .....
View Replies
ADVERTISEMENT
May 22, 2014
I'm trying to learn java by making a login page using java, servlet, javascript, html and mysql. I can login with username and password, I can get all the information from database in the edit page. However, when I edit and click on "Submit" in EditPage.jsp, it gives HTTP Status 404. Same screen appears when I click on "Sign Up" from first page (NewFile.jsp) and click on "Submit" button after filling up user information.
I am posting all my code here but probably important ones are:
EditPage.jsp, Edit.java, EditDetails.java, UpdateUser.java and for Sign Up SignUpPage.jsp and Registration.java.
Firstly here are my error message and ss from my project explorer:
Here is my code:
LoginServlet.java
package com.amzi.servlets;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
[Code] ....
View Replies
View Related
Mar 9, 2014
i am using netbeans6.7.1 version i implemented one program i.e web application ..when am excuting this one i got one error http status 500...
this is the code:
SumServlet.java
package com.sum;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
[code]....
View Replies
View Related
Mar 9, 2014
correct this error
WishSrv.java
package com.wish;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Calendar;
import javax.servlet.ServletException;
[code]...
View Replies
View Related
Feb 26, 2014
Below is my Servletclass code
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MyFirstServlet extends HttpServlet {
[Code] .....
I have configured tomcat7 in my ecclipse ide...
View Replies
View Related
May 5, 2014
The JSP page is opening but the problem is if l click on the ADD or EDIT button l receive the 405 error Iam using MySQL and glassfish server
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
[Code].....
View Replies
View Related
Oct 16, 2012
I am working wit netbean 7.2 ide,oracle 10g. the servlet program does not connected to the oracle db. i always recieve a
HTTP Status 404 -
type Status report
message
descriptionThe requested resource () is not available.
Oracle GlassFish Server 3.1.2.2
View Replies
View Related
Feb 13, 2014
I have created a jsp file which does the simple task of reading data from a mysql database and displaying the results on a web page. Please see below:
<%@ page import="java.io.*,java.util.*,java.sql.*"%>
<%@ page import="javax.servlet.http.*,javax.servlet.*" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
[Code] ....
However, each time I run the jsp file in the browser with my localhost as server, I get an HTTP Status 500 error.
View Replies
View Related
Jul 26, 2014
iam unable to view my login form using servlet below are my files....
***************************************************************************
LoginServ.java
***************************************************************************
package com.peg.servUserLogin;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
[code]....
i tried ruuning my LoginServ file and i get no error but i also i am not getting any output..(loging page)
View Replies
View Related
Jan 30, 2014
I have configured form based JAAS in my app. Basically, in web.xml I have declared security constraints on certain jsp page, declared specific roles, login and error pages. So, my login form is:
<form id="loginForm" action="j_security_check" method="post">
<p>
<label for="name">Username</label> <input name="j_username"
id="username" type="text" required/>
[Code] ....
This works fine when some user tries to access some of the pages declared in <security-constraint> tag of web.xml.
Container automatically manages login process, redirects to login page and if login details are valid, gives access to secured page.
Now, how should I implement login system so that user can go to login page (possibly same login form) and log in from there?
View Replies
View Related
Feb 20, 2014
I am trying to use hidden variable in project.When I launch my project i am able to get the welcome page.But when submit login values i am getting HTTP 404 error- Resource not found error.
`My home Page/Login Page
<body>
<form action="<%=request.getContextPath() %>/LoginServlet" method="get">
USERNAME<input type="text" name="uname"><br>
PASSWORD<input type="password" name="pass"><br>
<input type="submit" name="submit" value="submit">
My LoginServlet
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
System.out.println("sandeep");
PrintWriter out=response.getWriter();
String userName=request.getParameter("uname");
[code].....
View Replies
View Related
Mar 8, 2015
below is my code and this exception was thrown in another page so I created a new page and only imported just a single package still its throwing an exception? Any reasons why?
<%@page contentType="text/html" pageEncoding="UTF-8" %>
<%@page import="java.sql.*;" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
View Replies
View Related
Feb 8, 2015
I'm trying to create a userlogin program using mysql. I have an error at line 70.
package userDatabasePack;
import java.sql.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class UserLogin {
public static void main (String[]args) throws SQLException{
[code]....
View Replies
View Related
Jan 8, 2015
I want to understand how is it possible to send data (image + text) along a single form. Here is my code:
<form method="post" action="updateAccount"
encType="multipart/form-data">
<input type="file" name="file" value="Select image ..." /> <input
type="submit" value="Start Upload" /> <br>
<textarea rows="8" cols="54" name="about">Yes
View Replies
View Related
May 25, 2014
Looking for some simple use cases for servlet filters other than tracking requests ? I was thinking of using a filter to filter out offensive language from entered text. Would that be a good use case ?
View Replies
View Related
Feb 26, 2014
I am new to java(beginner) and i am not aware of servlets, yet to learn i want a simple login app using swing in 3tire arch using pojos.
View Replies
View Related
Jul 30, 2006
What is the difference between Attributes and Parameters.that is difference between two methods request.getAttribute() and request.getParameter() and why we have this two methods?
View Replies
View Related
Jun 24, 2014
I am building an application that has two types of users. While some of the fields (ie: username, email address, password) are the same for both user types, other fields are different for each user type.
Therefore, I would like to split up the process of registering (ie: writing the user info to database) into two parts:
1) registering the common fields among both user types (servlet 1)
2) registering the specific fields based on the user type that is registering (servlet 2a and servlet 2b).
Therefore, once servlet 1 is processed, I wish to forward the request to servlet 2a or 2b depending on what type of user is registering.
I wish to do this since I will have other parts of my application that will make use of servlets 2a and 2b as well. Is this possible to do (redirect request parameters from jsp to servlet and then to another servlet)?
View Replies
View Related
Apr 5, 2014
I have written some error checking code
File name ErrorPage.jsp
<%@ page language="java" isErrorPage="true" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Error</title>
</head>
[code]...
I have put error.jsp and badpage.jsp file in public access folder that is web content in eclipsewhen I am running the code I am status code of 500 and not the errorpage.jsp message .
View Replies
View Related
May 10, 2014
i have one html page through which i want to go to servlet page but after submit it give the http 404 error.
i am using tomcat apache server.
View Replies
View Related
Oct 27, 2011
in my web.xml I declared a resource under the block
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
This resource is about a login page.But when I logout or when I visit some pages like Contacts or Home Page, I wouldn't use HTTPS protocol.At the moment, HTTPS remain in the url even if I declared this protocol only for that resource..This is my (little) web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
[code]....
View Replies
View Related
May 21, 2014
Session attributes after logging into web-app:
Session Attributes
thisUsersAllowedRoles=45
username=hw
authenticatedUser=org.hw.client.payroll.model.User@2c8a09da
supervisorCode=
authenticated=true
[Code] ....
Every now and then while debugging I lose session attributes:
Session Attributes
thisUsersAllowedRoles=45
username=hw
supervisorCode=
authenticated=true
[Code] ....
The authenticatedUser and menu attributes are gone. I never know when it's going to happen so I can't trace it. Any guesses why those type session objects would die?
I attached an image of what menu object looks like.
View Replies
View Related
Jan 30, 2014
I have a secured Struts application in WebSphere that uses FORM j_security_check for authentication.There is also a Post Logon "filter" defined which runs some code after a login is processed.The extract from web.xml showing the login configuration and filter is as follows:
<login-config>
<auth-method>FORM</auth-method>
<realm-name>MyRealm</realm-name>
<form-login-config>
<form-login-page>/login.html</form-login-page>
<form-error-page>/error.html</form-error-page>
[code]....
If a user isn't logged into the application and they try to access one of the secured servlets, for example quotes.do, they are directed to the login page to enter their information.If they login successfully, they are then directed to quotes.do, rather than the default "welcome" page. Is there a setting in the web.xml or the post logon filter where I can force j_security_check to ALWAYS go to the default welcome page after a successful login?
View Replies
View Related
Aug 28, 2014
So I have a screen I click on. The "webPage" comes back as the requested resource unavailable.
What I don't get is that when I run the server locally on my machine it works just fine. But when this is deployed out to server I get the error. The screen comes up but the data doesn't show up. Where should I look to troubleshoot this?
@RequestMapping(value = "/webPage_data", method = RequestMethod.GET)
public @ResponseBody
DataTableDto pastControllerDataFeed(Model model) {
View Replies
View Related
Mar 19, 2015
I am trying to use three cookies in a servlet to store the background and foreground color and text size but my code is not working for some reason. When I run the servlet I get an IndexOutOfBounds exception and in my code is says my cookies are not ever used, when they should be to store the variables?
package httpServlets;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Date;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
[code]....
View Replies
View Related
Mar 26, 2014
After confirmation to the login details I added new cookie having logging information and then dispatched this request to controller servlet where this cookie is checked if it is present then user is forwarded to a particular page. Otherwise is redirected to the sign in page. Now the problem is when we add cookies then it is added into "response" object and when we get cookies we get them from "request" object. So for the first time redirection to controller servlet "response" object would not have this cookie as it is not available in "request" object. But will be available for later requests.
My question is what is the way to get this cookie in the first request. Or is there any way to send refresh like response to the browser so that this cookie is added??
View Replies
View Related