It depends on what the attribute stored in the session actually is.
If it's an
Integer object, there's absolutely no point converting it to a
String and then back to an
Integer. Just cast it straight to an
Integer, as in the first approach.
If it's really a
String, I'd cast it to a
String and then use
Integer.parseInt to convert it:
int edindex = Integer.parseInt((String)request.getSession().getAttribute("e8DIndexNumber"));
I don't think I'd ever use your second form exactly like that.