简体   繁体   中英

Uncertain how to send a long value as hidden to action from in struts from a jsp page

I wish to send a long value from my login.jsp page to the struts action from bean as a hidden field. I have done the mapping etc for the two properties username and password and for them the program works fine. Now I want to send a time value as a hidden property named "requesttime" to store the time of login in a table for security check. But I have not been able to figure out how to do it. Here is the part of the jsp page where I am stuck.

<%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/>

Please do not mind my ignorance. And thank you for whatever help you may provide.

Using script you can get the time of login. Now do
< input type="hidden" id="time"> and enter the value you got. Using scriplets would be better. Then in servlet call the request.getParameter("time") and store as a string or as an integer. Your choice. Hope this helps.....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM