Capture the value of JSP Expression Language variable into a java variable

is it possible to capture the value of JSP Expression Language variable into a java variable in a jsp page?

Eg: I have a variable ${error.type} and i want to capture the value of ${error.type} into a java variable, say something like this: String errortype = ${error.type} (I know this isn't possible) Is there anyway for doing this?
Actually I want to check if ${error.type} is null or not, if there is any value available I will show success message else an error message.
Thanks I'm new to java and JSP :)

But now both the text are displayed simultaneously irrespective of empty or not!
Even i tried ${errors.errors ? "some text when true" : "some text when false"} and guess what, every time i'm getting "some text when false" printed in browser though the value is getting initialized correctly. any idea why?

Answers

Actually I want to check if ${error.type} is null or not, if there is any value available I will show success message else an error message

You're looking for ${empty error.type} in order to know if error.getType() is null: