tags:

views:

27

answers:

1

I have a request object with String attribute name1. When request is sent to JSP I would like to use name1 parameter as a name of application scope bean to retrieve its status. I have tried

 <jsp:getProperty name="${name1}" property="status" />

and

${${objName}.status}

and

${applicationScope.${objName}.status}

but it does not work.

+1  A: 

You cannot nest EL expressions. It's one expression. Use the brace notation.

${applicationScope[objName].status}

See also:

BalusC
Thank BalusC. Tried but it does not seem to work. It doesn't show any text after I put it pararpah tag in my JSP.
Mike55
Do you anyway **understand** how it is working? At least, `objName` must refer to a `String` with value `name1`. All it is doing under the hoods is `getServletContext().getAttribute("name1").getStatus()`. You might want to edit your question to remove the ambiguity from your question and add the actual values of which you're sure that you have it in the desired scopes.
BalusC
I set up a different JSP for test and it works. The objName was not intialized the first time request was passed (before submitting it from form). Thanks.
Mike55