问题
I have a simple jsf app developed and working on tomcat 6.0.13. I added some security contraints to the entire application by adding the usual setting in web.xml.
When I now deploy the application to tomcat and check, it works absolutely fine in firefox, I get my Login.html rendered(code below) and once authorised takes me to the relevant page. When I navigate to the same app in IE, i get the login prompt as below but clicking on the Submit button doesn't do anything. It just stays there like it's not posting back to the server, as the server doesn't seem to get any response from the client browser(no errors, no logs, etc).
What am I doing wrong?
<html>
<head>
<style type="text/css">
.cssGenericHeaderColumn
{
font-family: Verdana, Arial, Sans-Serif;
font-size:14px;
font-weight: bold;
text-align: left;
vertical-align: left;
}
.cssGenericEntryLabel
{
font-family: Verdana, Arial, Sans-Serif;
font-size:13px;
font-weight: lighter;
text-align: left;
vertical-align: top;
}
</style>
</head>
<body>
<form method="POST" action="j_security_check">
<table align="center">
<tr>
<td colspan="2" class="cssGenericHeaderColumn">
Welcome to blah blah
</td>
</tr>
<tr>
<td class="cssGenericEntryLabel">
User name
</td>
<td class="cssGenericEntryLabel">
<input type="text" name="j_username">
</td>
</tr>
<tr>
<td class="cssGenericEntryLabel">
Password
</td>
<td class="cssGenericEntryLabel">
<input type="password" name="j_password">
</td>
</tr>
<tr>
<td>
</td>
<td class="cssGenericEntryLabel">
<button class="cssGenericEntryLabel"> Submit </button>
</td>
</tr>
</table>
</form>
</body>
Thanks
回答1:
You should be using <input type="submit">
or <button type="submit">
instead of a standard button to have a fullworthy submit button.
So, replacing
<button class="cssGenericEntryLabel">Submit</button>
by
<button type="submit" class="cssGenericEntryLabel">Submit</button>
or
<input type="submit" value="Submit" class="cssGenericEntryLabel" />
should fix your problem.
Please note that this problem is in no way related to JSF. It's just related to basic HTML.
来源:https://stackoverflow.com/questions/6531075/j-security-check-for-jsf-app-not-working-in-ie