The compact syntax was introduced for increased readability and
compatibility with JSP expressions. Additionally, using the compact
syntax keeps your HTML valid, which helps IDEs to highlight ESP.

There are however cases, where the default syntax is the more compact
way to express something, e.g. if you want to have extended control
structures in the scriptlet.

<% 
var value;
if (foo==bar) {
        value = "foo";
} else {
        value = "bar";
}
%>

<a href="http://${value}.com/";>

vs.

<a href="http://<% if (foo==bar) {%>foo<%} else {%>foo<%} %>">


regards,

Lars

On Mon, 2008-02-18 at 08:52 +0100, Felix Meschberger wrote:
> Hi all,
> 
> Hmm, I am getting unsure ... Why was the compact syntax "${...}"
> introduced at all ? Was it to mimic Expression Language stuff ? Not
> sure, whether we really need this in ESP.
> 
> If someone could enlighten me ?
> 
> Regards
> Felix
> 
> 
> Am Sonntag, den 17.02.2008, 13:46 -0800 schrieb Lars Trieloff (JIRA):
> > [ 
> > https://issues.apache.org/jira/browse/SLING-248?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12569755#action_12569755
> >  ] 
> > 
> > Lars Trieloff commented on SLING-248:
> > -------------------------------------
> > 
> > I think we should re-open, as the compact syntax should extend the default 
> > syntax, not replace it.
> > 
> > > esps not executed quite correctly
> > > ---------------------------------
> > >
> > >                 Key: SLING-248
> > >                 URL: https://issues.apache.org/jira/browse/SLING-248
> > >             Project: Sling
> > >          Issue Type: Bug
> > >          Components: Scripting
> > >         Environment: windows xp, java 5
> > >            Reporter: Michael Marth
> > >            Assignee: Felix Meschberger
> > >             Fix For: 2.0.0
> > >
> > >
> > > I have an .esp with this code snippet:
> > > posted by <a 
> > > href="/microsling/content/blogs/main.html?poster=<%=resource.node.posterName%>">
> > >  <%=resource.node.posterName%></a>
> > > the first <%=resource.node.posterName%> does not get executed, the second 
> > > does.
> > > I experimented a bit and think that <%= %> scripts embedded in an html 
> > > attribute do not get executed.
> > 
> 

Reply via email to