I'm writing lot of JSP pages for different views. Those JSP retrieve request scope attributes which have very long names to prevent overlapping. An example is:
request.getAttribute("domain1.subdomain1.subdomain11.subdomain111.attributeName");
Equivalent in EL would be:
${requestScope['domain1.subdomain1.subdomain11.subdomain111.attributeName']}
Sometimes, my EL expressions are very long (for example when I use 3 different JavaBeans to create an HTML tag or call javascript function).
My question is about whether or not the solution I found is a good programming solution. Given the fact that each view has it's own page scope, at the beginning of my JSP, I want to put
<c:set var="attributeName" scope="page" value="${requestScope['domain1.subdomain1.subdomain11.subdomain111.attributeName']}"
And then in my EL expressions, I will use
${pageScope["attributeName"]}
Isn't this going to create confusion about the actual scope of the attribute when reading the JSP code?
subdomain111
and plug those components together for asubdomain11
jsp component and so on? – Rame${pageScope[attributeName]}
(without the quotes). – HamletattributeName
and use it's value to search in the pageScope which is actually not a String. – Profitsharing