Hello all.

I have a question concerning the correct way to use quotes inside of
expressions, when those expressions are inside attributes.  What is the
correct syntax?  I've looked in the JSP specification and I can't find a
clear answer.

Below I've listed three different ways that I can create attribute
values using a combination of static strings and method returns.  All
three are accepted by Tomcat.  However, my IDE doesn't accept all of
them.  


Which of these three are acceptable by the JSP specs?


Mixed Double-Quotes
This is where double quotes inside the expression are not interpreted as
the end of the attribute:
<taglib:validate 
   failureURL="<%=
"/path/"+obj.getParam("local")+"/path2/"+obj.getParam("userid") %>" />

Alternative Quotes
This is where all quotes inside the attribute are single quotes,
preventing the interpreter/compiler complaining about a premature
completion of the attribute:
<taglib:validate 
   failureURL="<%=
'/path/'+obj.getParam('local')+'/path2/'+obj.getParam('userid') %>" />

Escaped Double-Quotes
This is where all quotes inside the attribute are escaped (this is
probably the hardest of the three to read):
<taglib:validate 
   failureURL="<%=
\"/path/\"+obj.getParam(\"local\")+\"/path2/\"+obj.getParam(\"userid\")
%>" />



Thanks
--
Jay Glanville

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to