Jump to content
xisto Community
Sign in to follow this  
eInfiniti

Tomcat Jdbcrealm Form-based Security Problem

Recommended Posts

Hi. I am trying to set up Tomcat JDBCRealm form-based security for a project. For some reason, a JSP/html file with CSS style sheets associated it won't work with the login form. Please help if you can.

 

The login.jsp file is as follows. Without those 3 lines in blue color, the form-based security login works fine. But, with the blue lines, the login.jsp webpage will not show up as specified by the .css files; it will only display a plain webpage without any colors, graphics or the correct line-up. When I enter a correct combination of username and password in the form and hit the "Go" button, the browser will redirect to the SpryMenuBarHorizontal.css file rather than the correct page for login success. When I enter a wrong combination, nothing will go wrong and the next page will be the login failure page.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd;<html xmlns="http://www.w3.org/1999/xhtml/;<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %><title>Project 2</title>[color= #0000FF]<link href="project2.css" rel="stylesheet" type="text/css" /><script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script><link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />[/color]</head><body><h1>Login to Project 2</h1><p>If you have been issued a username and password, key them in here now!</p><form method="POST" action="j_security_check"><table>	<tr>		<td colspan="2">Login to the Tomcat-Demo application:</td>	</tr>	<tr>		<td>Name:</td>		<td><input type="text" name="j_username" /></td>	</tr>	<tr>		<td>Password:</td>		<td><input type="password" name="j_password"/ ></td>	</tr>	<tr>		<td colspan="2"><input type="submit" value="Go" /></td>	</tr></table></form></body></html>

After some observations, my intuition tells me that it is probably because the login file combination that is not specified correctly in web.xml. It seems that specifying the login.jsp file alone is not enough to have the colors, graphics and correct line-up displayed. Following is what is currently in web.xml with login.jsp alone specified as the form login page. It seems to me that the .css files also need to be specified somehow to make it work correctly. If I am correct, how should I specify the file combination in the form login page field? If not, how do I resolve the problem to allow form-based security to work with the CSS files. Thanks!

<login-config>		<auth-method>FORM</auth-method>		<realm-name>Project 2 Protected Area</realm-name>		<form-login-config>				<form-login-page>/login.jsp</form-login-page>				<form-error-page>/login_failure.html</form-error-page>		</form-login-config></login-config>

Notice from rvalkass:

Please remember to use BBCodes around code.


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.