我希望从我的login.jsp
页面发送一个长值到struts动作从bean作为一个隐藏的字段。我已经做了映射等两个属性用户名和密码,并为他们的程序工作得很好。现在我想发送一个时间值作为一个名为"requesttime"的隐藏属性,将登录时间存储在一个表中,以便进行安全检查。但我一直不知道该怎么做。这是jsp页面中我卡住的部分。
<%long time = System.currentTimeMillis();%>
<html:form action="login">
<bean:message key="login.username"/>
<html:text property="username"/><br/>
<bean:message key="login.password"/>
<html:password property="password"/><br/>
<%--I wish to insert "time" as property "requesttime" as hidden here--%>
<html:submit value="login"/>
</html:form><hr/>
<html:errors/>
请不要介意我的无知。谢谢你提供的任何帮助。
使用脚本可以获得登录时间。现在做
& lt;输入类型="隐藏" id="时间">输入你得到的值。使用脚本会更好。然后在servlet中调用request.getParameter("time")并将其存储为字符串或整数。你的选择。希望对您有所帮助.....