13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

434Chapter 19JSP: Servlets Turned Inside OutTable 19.2 New XML syntax for JSP c<strong>on</strong>structsStandard formatNew HTML format code code expr 19.3.5 New SyntaxBut what about that new syntax? It’s an XML-c<strong>on</strong>formant syntax, and it’s thesyntax for all the newer features added to JSP. In fact, even the old JSPsyntax, the statements that we’ve discussed, have an alternative new syntax(Table 19.2). Prior to JSP 2.0, that syntax was reserved for JSP that produceXML rather than HTML. (That’s a whole other can of worms that we w<strong>on</strong>’topen now.) Now, as of JSP 2.0, both forms can be used, if your Web server isJSP 2.0 compliant.You can see that the old syntax is more compact and less distracting thanthe large tags. We suspect that means the old syntax is likely to c<strong>on</strong>tinue to beused for a l<strong>on</strong>g time yet. 1This new syntax is also used for the last two parts of JSP that we will cover,useBean and tag libraries.19.3.6 JavaBeans in JSPFor those who really want to avoid doing any Java coding inside of a JSP, thereis additi<strong>on</strong>al syntax that will provide for a lot of capability but without havingto explicitly write any Java statements. Instead, you write a lot of arcane JSPdirectives, as we’ll show you in just a bit. Is this any better? In some ways yes,but in other ways, no, it’s just different syntax.What we’ll be able to do with this additi<strong>on</strong>al syntax is:1. Instantiate a Java class and specify how l<strong>on</strong>g it should be kept around2. Get values from this class3. Set values in this class1. The newer XML-style syntax would be useful if your JSP are generated by an XSLTstylesheet or are validated against a DTD, both topics being bey<strong>on</strong>d the scope of our discussi<strong>on</strong>.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!