So I have a login.jsp where I have hard coded the username and password values. My issue is I want the login to automatically submit the username and password values withhout a user having to physically click login. So the login in screen will pretty much only be visible for a split second before the user is redirected to the next page.
<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>
Simply add the following line at the end of the script section, to submit the login form automatically: