How to convert UUID value to string

java

Solution

This will convert your uniques session id to string

String suuid = UUID.randomUUID().toString();

Problem

I want to generate unique session id for my session. So i used UUID. Here what i did ``` if (session == null) { session = httpServletRequest.getSession(true); session.setAttribute("logedin", "0"); if (!httpServletRequest.isRequestedSessionIdFromCookie()) { UUID sessionID = UUID.randomUUID(); Cookie sessionCookie = new Cookie("JSESSIONID", "sessionID"); //problem } ``` The Cookie constructor accept two strings, how can i convert my UUID to string so it get the UUID value which is unique? Thanks

Original source