> Hello guys,
> i'm developing a JSP page, starting from an example.
>
> I'm using JPivot, a tag library for rendering OLAP results.
> Everything works well, but i need a bit of customization.
JSTL also sports database tags.
> <jp:table id="table01" query="#{queryGuaber}"/>
>
> As you can see in tag tag <jp:table it use query="#{queryGuaber}. What
> is that syntax ? I mean the # and the bracket.
Are you sure the character is '#' and not '$'?
> <%
> out.println(table01.extensions.drillMember.enabled);
> %>
You absolutely never need an 'out.println' in JSP. Just put the expression in
the HTML, or use <c:out ... />
<p>
${table01.extensions.drillMember.enabled}
</p>
Furthermore, the "." notation in your Java scriptlet implies that you used
public instance members, a bad practice. It is usually better to provide
accessor methods:
// Java, not EL
out.println( table01.getExtensions() [drillMember].isEnabled() );
But of course, the EL in JSP is preferable.
By its nature, a JSP translate all its HTML into "out.println()" calls, so you
don't have to.
- Lew
SirHaplo - 12 Feb 2007 14:12 GMT
> > Hello guys,
> > i'm developing a JSP page, starting from an example.
[quoted text clipped - 3 lines]
>
> JSTL also sports database tags.
Of course, but with JPivot i can visually build MDX querys and render
the results.
This is very useful for our customers.
> > <jp:table id="table01" query="#{queryGuaber}"/>
>
> > As you can see in tag tag <jp:table it use query="#{queryGuaber}. What
> > is that syntax ? I mean the # and the bracket.
>
> Are you sure the character is '#' and not '$'?
Absolutely sure.
> > <%
> > out.println(table01.extensions.drillMember.enabled);
[quoted text clipped - 6 lines]
> ${table01.extensions.drillMember.enabled}
> </p>
Thanks a lot for the advice, but i used out.printl as an example ;)
> Furthermore, the "." notation in your Java scriptlet implies that you used
> public instance members, a bad practice. It is usually better to provide
[quoted text clipped - 3 lines]
>
> But of course, the EL in JSP is preferable.
This is a good advice, but the code isn't mine. In future if i will
write my own Tag Library i will follow your rule.
Finally, no one know the meaning of #{} ?
Thanks a lot
Lew - 12 Feb 2007 15:01 GMT
Lew wrote:
>> Furthermore, the "." notation in your Java scriptlet implies that you used
>> public instance members, a bad practice. It is usually better to provide
[quoted text clipped - 3 lines]
>>
>> But of course, the EL in JSP is preferable.
> This is a good advice, but the code isn't mine. In future if i will
> write my own Tag Library i will follow your rule.
This is not related to tag libraries but Expression Language (EL) and regular
Java syntax.
The expression "table01.extensions.drillMember.enabled" in Java scriptlet will
only compile if the member variables are public, which is bad practice.
- Lew