-1

    <form action="<%=request.getContextPath()%>/login" method="post">
        Email: <input type="email" name="email">
        Password : <input type="password" name="psw">
        <button type="submit" value="submit">Submit</button>
    </form>

I have this login form.After submitting the values, it goes to the controller where the user authentication takes place and after authentication it moves to the home page.I want to generate a session id every time a user login so that, that user id can be used to get other information of the user(i.e some details like mobile no,address etc according to the need) that were filled during the registration. I am doing all this using jsp and mvc. Thanks in advance.

  • Does this answer your question? [Efficient method to generate UUID String in JAVA (UUID.randomUUID().toString() without the dashes)](https://stackoverflow.com/questions/3804591/efficient-method-to-generate-uuid-string-in-java-uuid-randomuuid-tostring-w) – Kartik May 26 '20 at 05:49
  • I want to generate a HttpSession session id each time a user login into the website so that I can use that session id in getting more details about the user. – mahi chauhan May 28 '20 at 04:38

1 Answers1

0
public static String getToken() {
        return  String.valueOf(System.currentTimeMillis()).substring(8, 13) + UUID.randomUUID().toString().substring(1,10);
    }

or

public static String getUUID() {
        return UUID.randomUUID().toString();
    }