所以我有一个 login.jsp,我在其中硬编码了用户名和密码值。我的问题是我希望登录自动提交用户名和密码值,而用户不必物理单击登录。因此,在用户被重定向到下一页之前,登录屏幕几乎只能在瞬间可见。
<div class="center-me">
<form:form name="login" id="login">
<div class="login_header_logo">
<img border="0" src="<c:url value='img/pidslogo.gif' />" />
</div>
<div id="login_header">
<h1>Login</h1>
</div><!-- #login_header -->
<div id="login_content">
<form:errors path="*" cssClass="validationErrors" />
<table id="form_fields">
<tr>
<td class="label">
Username:
</td>
<td class="field">
<form:input path="username" cssClass="inputField" />
</td>
</tr>
<tr>
<td class="label">
Password:
</td>
<td class="field">
<form:password path="password"cssClass="inputField" />
</td>
</tr>
<tr <c:if test="${repoListSize <= 1}">class="repository" style="display:none" </c:if>>
<td class="label">
Repository:
</td>
<td class="field">
<form:select id="repository" path="repository" multiple="false">
<c:forEach items="${repoList}" var="item">
<form:option value="${item.valueField}">${item.labelField} </form:option>
</c:forEach>
</form:select>
</td>
</tr>
</table>
<div id="submit1">
<input type="submit" value="Login" />
</div>
</div><!-- #login_content -->
</form:form><!-- #login -->
</div>
<script language="javascript">
TSG.util.onPageReady(function() {
if (parent.frames.length > 0)
{
parent.location = this.location;
}
if (window.opener)
{
window.opener.document.location=this.location;
window.close();
}
document.login.username.focus();
Nifty("div#login_header","top, big");
});
document.getElementById("username").value = "111111111";
document.getElementById("password").value = "111111111";
</script>