Web Development with JavaEE Developing Custom Tag Libraries and XML Processing with JSP
|
|
- Jonas Richardson
- 6 years ago
- Views:
Transcription
1 Applied Autonomous Sensor Systems Web Development with JavaEE Developing Custom Tag Libraries and XML Processing with JSP AASS Mobile Robotics Lab, Teknik Room T2222
2 Contents 1. Introduction to Custom Tags 2. Developing Custom Tag Libraries Tag, TagIteration, and BodyTag interface 3. XML Processing With JSP xml library (JSTL), XPath, JDOM 4. Session Tracking
3 Contents Introduction To Custom Tags
4 1 Introduction To Custom Tags Custom Action Elements (= Custom Tags) custom actions can manipulate JSP content (Beans can t) implemented by a tag handler class Advantages portability work in any JSP container simplicity can be used by unsophisticated users allows for a convenient division of the work Java programmers can implement custom tags and page authors can use them in a familiar way (XML syntax)
5 1 Introduction To Custom Tags Tag Library collection of custom actions class file tag library descriptor (TLD file) [action names class] mapping using the TLD, the container can verify that the attributes are correct can be packaged (JAR file) for simple deployment JSP containers must accept packaged tag libraries the package must include a TLD the prefix is used as an XML namespace
6 1 Introduction To Custom Tags Tag Handler run-time representation of a custom action implements a tag handler interface Tag Handler Interfaces Tag: basic methods needed in all tag handlers tag init, dostarttag(), doendtag() IterationTag: re-evaluation of the body doafterbody() BodyTag: tag body manipulation setbodycontent(), doinitbodytag()
7 1 Introduction To Custom Tags Custom Tags Development implement a tag handler class make the compiled class available for the container place the.class file in WEB-INF/classes write the TLD file place the.tld file in WEB-INF
8 1 Introduction To Custom Tags Using Custom Tags A Simple Example <p> <% for(int i = 1; i <= 5; ++i) { %> <font size="<%=i%>">different sizes...</font><br/> <% %> </p> <%@taglib uri="/mycustomtags" prefix="my" %>... <p> <my:repeattext rep="5" reptext="different sizes..." /> </p>
9 1 Introduction To Custom Tags Using Custom Tags taglib directive uri="/mycustomtags" prefix="my" %> import a set of compiled action classes into a JSP assign a prefix to the loaded tag library call the custom action as <prefix:actionname> <my:repeattext rep="5" reptext="different sizes..." />
10 1 Introduction To Custom Tags Custom Tag to Action Class Mapping TagHandler class implements the custom action tag library declaration wdwj2ee.mytag a tag library descriptor (TLD) in WEB-INF (required in JSP 2) the correct TLD is identified by the URI in the TLD URIs are mapped when the server starts globally unique URI required mytld.tld <%@taglib uri="se.oru.wdwj2ee.mycustomtags" prefix="my" %>... <my:repeattext rep="5" reptext="different sizes..." />
11 1 Introduction To Custom Tags Custom Tag to Action Class Mapping RepeatTextTag.class mytld.tld <taglib... > <uri>se.oru.wdwj2ee.mycustomtags</uri> <tag> <name>repeattext</name> <tag-class>wdwj2ee.repeattexttag</tag-class> </tag> </taglib> uri="se.oru.wdwj2ee.mycustomtags" prefix="my" %>... <my:repeattext rep="5" reptext="different sizes..." />
12 1 Introduction To Custom Tags Tag Library Descriptor (TLD) XML document that describes a tag library maps action names to tag handler classes defines the attributes web container can verify whether the provided attribute list is correct specifies which scripting variables are created by the action! intended to be used also by authoring tools! file extension = tld! TLD must be deployed in WEB-INF (META-INF for JARs)
13 3 Introduction To Custom Tags The TLD file URI <?xml version="1.0" encoding="utf-8"?> <taglib version="2.0"... > <tlib-version>1.0</tlib-version> <jsp-version>1.2</jsp-version> <short-name>mytags</short-name> <uri>se.oru.wdwj2ee.mycustomtags</uri> <tag> <name>checklogin</name> <tag-class>wdwj2ee.checklogintag</tag-class> <body-content>empty</body-content> <description>forwards to "loginurl" </description> <attribute> <name>loginurl</name> <required>true</required> <rtexprvalue>true</rtexprvalue> </attribute> </tag> </taglib> default prefix tag name tag class (incl. package) action body treatment attribute name obligatory or not? allow request time expressions?
14 3 Introduction To Custom Tags The TLD file [default] <body-content> empty action body must be empty JSP action body can contain JSP elements (actions, scriptlets,...) tagdependent disables processing of JSP elements in the body <rtexprvalue> true or yes request-time expressions are allowed: <... attr = '<%=request.getparameter("parname")%>'/>
15 3 Introduction To Custom Tags The checklogin Custom Tag checks whether the user is logged in and forwards to a central login page otherwise <% if(session.getattribute("loggedin") == null) { %> <% %> <html> <jsp:forward page="/login.jsp" /> <head><title>for authorised users only... </head></title> <body>...
16 3 Introduction To Custom Tags The checklogin Custom Tag checks whether the user is logged in and forwards to a central login page otherwise <%@taglib uri="/mycustomtags" prefix="my" %> <my:checklogin loginurl="/login.jsp" /> <html> <head><title>for authorised users only... </head></title> <body>...
17 3 Introduction To Custom Tags The checklogin Custom Tag Tag Handler Class package se.oru.wdwj2ee; import javax.servlet.jsp.tagext.*; import javax.servlet.jsp.jspwriter; import javax.servlet.jsp.jspexception; import javax.servlet.http.httpsession; public class CheckLoginTagHandler extends TagSupport { private String m_strloginurl; public String getloginurl() { return m_strloginurl; public void setloginurl(string strloginurl) { m_strloginurl = strloginurl; public int dostarttag() throws JspException {... WDWJ2EE/src/se/oru/wdwj2ee/CheckLoginTagHandler.java
18 3 Introduction To Custom Tags The checklogin Custom Tag Tag Handler Class package se.oru.wdwj2ee; import javax.servlet.jsp.tagext.*; import javax.servlet.jsp.jspwriter; import javax.servlet.jsp.jspexception; import javax.servlet.http.httpsession; public class CheckLoginTagHandler extends TagSupport { private String m_strloginurl; public String getloginurl() { return m_strloginurl; public void setloginurl(string strloginurl) { m_strloginurl = strloginurl; public int dostarttag() throws JspException {... WDWJ2EE/src/se/oru/wdwj2ee/CheckLoginTagHandler.java
19 3 Introduction To Custom Tags The checklogin Custom Tag Tag Handler Class package se.oru.wdwj2ee; import javax.servlet.jsp.tagext.*; import javax.servlet.jsp.jspwriter; import javax.servlet.jsp.jspexception; import javax.servlet.http.httpsession; public class CheckLoginTagHandler extends TagSupport { private String m_strloginurl; public String getloginurl() { return m_strloginurl; public void setloginurl(string strloginurl) { m_strloginurl = strloginurl; public int dostarttag() throws JspException {... WDWJ2EE/src/se/oru/wdwj2ee/CheckLoginTagHandler.java
20 3 Introduction To Custom Tags The checklogin Custom Tag Tag Handler Class package se.oru.wdwj2ee; import javax.servlet.jsp.tagext.*; import javax.servlet.jsp.jspwriter; import javax.servlet.jsp.jspexception; import javax.servlet.http.httpsession; public class CheckLoginTagHandler extends TagSupport { private String m_strloginurl; public String getloginurl() { return m_strloginurl; public void setloginurl(string strloginurl) { m_strloginurl = strloginurl; public int dostarttag() throws JspException {... WDWJ2EE/src/se/oru/wdwj2ee/CheckLoginTagHandler.java
21 3 Introduction To Custom Tags The checklogin Custom Tag Tag Handler Class package se.oru.wdwj2ee; import javax.servlet.jsp.tagext.*; import javax.servlet.jsp.jspwriter; import javax.servlet.jsp.jspexception; import javax.servlet.http.httpsession; public class CheckLoginTagHandler extends TagSupport { private String m_strloginurl; public String getloginurl() { return m_strloginurl; public void setloginurl(string strloginurl) { m_strloginurl = strloginurl; public int dostarttag() throws JspException {... WDWJ2EE/src/se/oru/wdwj2ee/CheckLoginTagHandler.java
22 3 Introduction To Custom Tags The checklogin Custom Tag Tag Handler Class public int dostarttag() throws JspException { try { HttpSession session = pagecontext.getsession(); if(session.getattribute("loggedin") == null) { pagecontext.forward(m_strloginurl); return SKIP_BODY; catch(java.io.ioexception ioe) { throw new JspException(ioe.toString()); catch(javax.servlet.servletexception se) { throw new JspException(se.toString()); return EVAL_BODY_INCLUDE;! custom tags can access predefined variables: pagecontext, request, response, session, application,...
23 3 Introduction To Custom Tags The checklogin Custom Tag Tag Handler Class public int dostarttag() throws JspException { try { HttpSession session = pagecontext.getsession(); if(session.getattribute("loggedin") == null) { pagecontext.forward(m_strloginurl); return SKIP_BODY; catch(java.io.ioexception ioe) { throw new JspException(ioe.toString()); catch(javax.servlet.servletexception se) { throw new JspException(se.toString()); return EVAL_BODY_INCLUDE;! custom tags can access predefined variables: pagecontext, request, response, session, application,...
24 3 Introduction To Custom Tags The checklogin Custom Tag Tag Handler Class public int dostarttag() throws JspException { try { HttpSession session = pagecontext.getsession(); if(session.getattribute("loggedin") == null) { pagecontext.forward(m_strloginurl); return SKIP_BODY; catch(java.io.ioexception ioe) { throw new JspException(ioe.toString()); catch(javax.servlet.servletexception se) { throw new JspException(se.toString()); return EVAL_BODY_INCLUDE;! custom tags can access predefined variables: pagecontext, request, response, session, application,...
25 3 Introduction To Custom Tags The checklogin Custom Tag Tag Handler Class public int dostarttag() throws JspException { try { HttpSession session = pagecontext.getsession(); if(session.getattribute("loggedin") == null) { pagecontext.forward(m_strloginurl); return SKIP_BODY; catch(java.io.ioexception ioe) { throw new JspException(ioe.toString()); catch(javax.servlet.servletexception se) { throw new JspException(se.toString()); return EVAL_BODY_INCLUDE;! custom tags can access predefined variables: pagecontext, request, response, session, application,...
26 Contents Developing Custom Tag Libraries
27 2 Developing Custom Tag Libraries Custom Actions Tag Interface <prefix:actionname attr1="value1" attr2="value2" > The body </prefix:actionname> Properties handled by get/set methods setattr1("value1") setattr2("value2") dostarttag() doendtag()! custom actions can be thought of as extended JavaBeans
28 2 Developing Custom Tag Libraries Tag Handler can add content to the response can set response headers can add or remove variables in the JSP scopes can initiate to include the action s body or not TagSupport Class sets PageContext provides a default implementation for dostarttag() and doendtag()
29 2 Developing Custom Tag Libraries dostarttag() called when the start tag is encountered used for initialisation to decide whether to ignore the body (SKIP_BODY) or to include the result of processing it (EVAL_BODY_INCLUDE) doendtag() called when the end tag is encountered must return EVAL_PAGE: continue processing the rest of the page SKIP_PAGE: aborts processing of the rest of the page <c:if> <c:redirect>
30 2 Developing Custom Tag Libraries Custom Actions Tag Interface <prefix:actionname attr1="value1" attr2="value2" > The body </prefix:actionname> SimpleTagSupport Class setattr1("value1") setattr2("value2") dostarttag() doendtag() default implementation for Tags own Tags can inherit basic functionality
31 2 Developing Custom Tag Libraries SimpleTagSupport (JSP 2.0) simpler invocation protocol single dotag() method no integer return values (like SKIP_BODY) called once and only once tag body can be accessed as a JSP Fragment tag body can be evaluated repeatedly (JspBody().invoke()) tag body cannot be modified SimpleTag interface has the same power as the Tag interface predefined variables are not defined by default convenient for writing very simple tags no return value in the SimpleTagSupport implementation
32 2 Developing Custom Tag Libraries Custom Actions Tag Interface package se.oru.wdwj2ee; import javax.servlet.jsp.tagext.*; import javax.servlet.jsp.*; import javax.servlet.http.httpsession; public class CheckLoginTagHandler extends TagSupport { public int dostarttag() throws JspException { // initialisation, return SKIP_BODY or EVAL_BODY_INCLUDE public int doendtag() throws JspException { // initialisation, return EVAL_PAGE or SKIP_PAGE public void release() { // set used variables to null super.release();... // get/set methods for the attribute values
33 2 Developing Custom Tag Libraries Custom Actions IterationTag interface inherits Tag can ask the container to evaluate the body multiple times TagSupport Class default implementation for IterationTags own IterationTags extend TagSupport
34 2 Developing Custom Tag Libraries Custom Actions IterationTag interface <prefix:actionname attr1="value1" attr2="value2" > The body </prefix:actionname> doafterbody() setattr1("value1" ) setattr2("value2" ) dostarttag() doafterbody() doendtag() called after the action element s body was processed <c:foreach>
35 2 Developing Custom Tag Libraries IterationTag Interface a simple <foreach> <%@taglib uri="my.mycompany.mytaglib" prefix="my"%> <%@taglib uri=" prefix="c"%>... <ul> <my:simpleloop items="mycollection" var="curritem"> <li> <c:out value="${curritem.name"/> (<c:out value="${curritem.gender"/>) </li> </my:simpleloop> </ul>...
36 2 Developing Custom Tag Libraries IterationTag Interface a simple <foreach>... public class SimpleLoopTag extends TagSupport { private Iterator ititems; private String stritems; public void setitems(string stritems) { this.stritems = stritems; private String strvar; public void setvar(string strvar) { this.strvar = strvar; public int dostarttag() throws JspException { public int doafterbody() {
37 2 Developing Custom Tag Libraries IterationTag Interface a simple <foreach>... public class SimpleLoopTag extends TagSupport { private Iterator ititems; private String stritems; public void setitems(string stritems) { this.stritems = stritems; private String strvar; public void setvar(string strvar) { this.strvar = strvar; public int dostarttag() throws JspException { public int doafterbody() {
38 2 Developing Custom Tag Libraries IterationTag Interface a simple <foreach>... public class SimpleLoopTag extends TagSupport { private Iterator ititems; private String stritems; public void setitems(string stritems) { this.stritems = stritems; private String strvar; public void setvar(string strvar) { this.strvar = strvar; public int dostarttag() throws JspException { public int doafterbody() {
39 2 Developing Custom Tag Libraries IterationTag Interface a simple <foreach> public class SimpleLoopTag extends TagSupport { public int dostarttag() throws JspException { Collection coll = (Collection) pagecontext.findattribute(stritems); if(coll == null) throw new JspException("No items found"); this.ititems = coll.iterator(); if(ititems.hasnext()) { pagecontext.setattribute(strvar,ititems.next()); return EVAL_BODY_INCLUDE; return SKIP_BODY; public int doafterbody() { if(ititems.hasnext()) { pagecontext.setattribute(strvar,ititems.next()); return EVAL_BODY_AGAIN; return SKIP_BODY;
40 2 Developing Custom Tag Libraries IterationTag Interface a simple <foreach> public class SimpleLoopTag extends TagSupport { public int dostarttag() throws JspException { Collection coll = (Collection) pagecontext.findattribute(stritems); if(coll == null) throw new JspException("No items found"); this.ititems = coll.iterator(); if(ititems.hasnext()) { pagecontext.setattribute(strvar,ititems.next()); return EVAL_BODY_INCLUDE; return SKIP_BODY; public int doafterbody() { if(ititems.hasnext()) { pagecontext.setattribute(strvar,ititems.next()); return EVAL_BODY_AGAIN; return SKIP_BODY;
41 2 Developing Custom Tag Libraries IterationTag Interface a simple <foreach> public class SimpleLoopTag extends TagSupport { public int dostarttag() throws JspException { Collection coll = (Collection) pagecontext.findattribute(stritems); if(coll == null) throw new JspException("No items found"); this.ititems = coll.iterator(); if(ititems.hasnext()) { pagecontext.setattribute(strvar,ititems.next()); return EVAL_BODY_INCLUDE; return SKIP_BODY; public int doafterbody() { if(ititems.hasnext()) { pagecontext.setattribute(strvar,ititems.next()); return EVAL_BODY_AGAIN; return SKIP_BODY;
42 2 Developing Custom Tag Libraries IterationTag Interface a simple <foreach> public class SimpleLoopTag extends TagSupport { public int dostarttag() throws JspException { Collection coll = (Collection) pagecontext.findattribute(stritems); if(coll == null) throw new JspException("No items found"); this.ititems = coll.iterator(); if(ititems.hasnext()) { pagecontext.setattribute(strvar,ititems.next()); return EVAL_BODY_INCLUDE; return SKIP_BODY; public int doafterbody() { if(ititems.hasnext()) { pagecontext.setattribute(strvar,ititems.next()); return EVAL_BODY_AGAIN; return SKIP_BODY;
43 2 Developing Custom Tag Libraries Custom Actions BodyTag Interface inherits IterationTag add methods that provide access to the body can read and process the element body! just using the body does not require a BodyTag BodyTagSupport Class default implementation for BodyTags own BodyTags extend BodyTagSupport
44 2 Developing Custom Tag Libraries Custom Actions BodyTag Interface <prefix:actionname attr1="value1" attr2="value2" > The body </prefix:actionname> setattr1("value1") setattr2("value2") dostarttag() setbodycontent() doinitbody() doafterbody() doendtag()
45 2 Developing Custom Tag Libraries BodyTagSupport Class dostarttag() returns EVAL_BODY_BUFFERED process the body and make the result available the body content is buffered in a BodyContent object! the JSP output is temporarily redirected to the BodyContent object! BodyContent is a subclass of JspWriter setbodycontent() sets bodycontent doinitbody() preparation before the first invocation of the action body can be here doafterbody() here the buffered body content can be accessed
46 2 Developing Custom Tag Libraries BodyTag Interface <menuitem> uri="my.mycompany.mytaglib" prefix="my"%>... <my:menuitem page="login.jsp"> Login first </my:menuitem> wraps the body with an HTML link element but only if page isn t the current page
47 2 Developing Custom Tag Libraries BodyTag Interface <menuitem>... public class MenuItemTag extends BodyTagSupport { private String strpage; public void setpage(string strpage) { this.strpage = strpage; public int doafterbody() { public int doendtag() throws JspException {
48 2 Developing Custom Tag Libraries BodyTag Interface <menuitem> public class MenuItemTag extends BodyTagSupport { public int doendtag() throws JspException { HttpServletRequest request = (HttpServletRequest) pagecontext.getrequest(); String requesturi = request.getcontextpath() + request.getservletpath(); String servletpath = pagecontext.getservletcontext().getrealpath(requesturi); String servletpathbase = servletpath; int lastpathseparator = servletpathbase.lastindexof(file.separatorchar); if(lastpathseparator > -1) servletpathbase = servletpathbase.substring(0,lastpathseparator); String pagepath = servletpathbase + File.separatorChar + this.strpage; StringBuffer text = null; String strbody = getbodycontent().getstring(); // not tostring()!!! if(servletpath.equals(pagepath)) { text = new StringBuffer(strBody);... getbodycontent() returns a reference to the BodyContent object
49 2 Developing Custom Tag Libraries BodyTag Interface <menuitem> public class MenuItemTag extends BodyTagSupport { public int doendtag() throws JspException {... if(servletpath.equals(pagepath)) { text = new StringBuffer(strBody); // if(servletpath.equals(pagepath)) else { String contextsenspath = requesturi; int lastsep = contextsenspath.lastindexof('/'); if(lastsep > -1) contextsenspath = contextsenspath.substring(0,lastsep); String uri = contextsenspath + '/' + this.strpage; HttpServletResponse response = (HttpServletResponse) pagecontext.getresponse(); text = new StringBuffer("<a href=\""); text.append(response.encodeurl(uri)); text.append("\">"); text.append(strbody); text.append("</a>"); // else[if(servletpath.equals(pagepath))]...
50 2 Developing Custom Tag Libraries BodyTag Interface <menuitem> public class MenuItemTag extends BodyTagSupport { public int doendtag() throws JspException {... if(servletpath.equals(pagepath)) { text = new StringBuffer(strBody); // if(servletpath.equals(pagepath)) else {... // else[if(servletpath.equals(pagepath))] try { JspWriter out = getpreviousout(); out.print(text); catch(ioexception ioe) { return EVAL_PAGE; returns the BodyContent object of the enclosing action (JspWriter at top level)
51 2 Developing Custom Tag Libraries Custom Actions BodyTag Interface <prefix:actionname attr1="value1" attr2="value2" > The body </prefix:actionname> setattr1("value1") setattr2("value2") dostarttag() setbodycontent() doinitbody() doafterbody() doendtag() not called in case of an empty body (keep in mind!)
52 Contents XML Processing With JSP
53 3 XML Processing With JSP Generating XML Response page contenttype="text/xml" %> JSTL Actions (xml library) XML HTML transformation digesting XML documents (parsing, accessing XML data) Java APIs JDOM SAX simple accessing, manipulating, and writing of XML documents particularly suited for large XML documents
54 3 XML Processing With JSP The XML Library uri=" prefix="x"%> x depends on Apache Xalan (XSLT processor) Xalan is included in JDK ! also included in JDK 1.5 but with different package name! new interfaces for XPath x might not find Xalan add xalan.jar to /WEB-INF/lib
55 3 XML Processing With JSP XML HTML with XSLT XSL: Extensible Stylesheet Language defines transformations to other types of documents (XSLT) defines formatting for display <? xml version="1.0" encoding="utf-8" /> uri=" prefix="c"%> uri=" prefix="x"%> <c:import url="htmltable.xsl" var="stylesheet" /> <x:transform xslt="${stylesheet" />... </x:transform>
56 3 XML Processing With JSP The XML Library transform XSLT transformation <x:transform xml="xmldoc.xml" xslt="xsltsheet.xsl" /> xml xslt var result scope xmlsystemid xsltsystemid XML file to transform (can also be specified in the body) XSLT stylesheet variable to hold the result as a Document object variable to hold the result as a Result object scope of var or result base URI for the XML source base URI for the XSLT stylesheet
57 3 XML Processing With JSP The XML Library param pass parameters to the XSLT stylesheet <? xml version="1.0" encoding="utf-8" /> <x:transform xml="xmldoc.xml" xslt="xsltsheet.xsl" > <x:param name="username" value="${param.name" />... some XML </x:transform> name value name of the dynamic parameter value to pass to the XSLT stylesheet
58 3 XML Processing With JSP Parsing XML Documents <c:import url="xmldoc.xml" varreader="xmlsource"> <x:parse var="xmldoc" xml="${xmlsource" scope="session" /> </c:import> <x:parse var="xmldoc" scope="application"> XML Document </x:parse> xml systemid var scope filter XML document to parse (String or Reader) base URI for the XML document name of the result variable (implementation specific) scope of var filter class that removes parts of the XML document
59 3 XML Processing With JSP Accessing XML Data XPath a syntax for defining parts of an XML document uses path expressions to navigate in XML documents contains a library of standard functions is a major element in XSLT is a W3C Standard XPath Expressions expressions to select nodes or node-sets in an XML document look very much like the expressions for file system access
60 3 XML Processing With JSP Accessing XML Data XPath Expressions XPath language (similar to EL) /news/march/d22 (first <d22> element in <march> in <news>) //news/march (all <march> elements in <news>) $variables can appear anywhere (must start with '$'!) relative to a specific context can be used in the 'select' attribute of JSTL xml actions <c:import url="xmldoc.xml" varreader="xmlsource"> <x:parse var="xmldoc" xml="${xmlsource" scope="session" /> </c:import> <x:out select="$xmldoc/news/march/d22" /> <x:out select="$param:username" />
61 3 XML Processing With JSP Accessing XML Data XPath Expressions <c:import url="xmldoc.xml" varreader="xmlsource"> <x:parse var="xmldoc" xml="${xmlsource" scope="session" /> </c:import> <c:usebean id="xmldoc.xml" varreader="xmlsource" /> <x:foreach select="$xmldoc/news/march/d22" /> <x:out select="$param:username" />
62 3 XML Processing With JSP XSLT and XPath provide tools for specialized tasks many applications are not covered Working with XML often requires parsing XML documents into XML trees navigating through XML trees constructing XML trees outputting XML trees as XML documents DOM and SAX: language independent APIs for working with XML JDOM: an API that is tailored to Java
63 3 XML Processing With JSP SAX Simple API for XML event based provides serial access to an XML document (stream) required to read large XML documents not designed for construction of XML documents not designed for manipulation of XML documents Using SAX write a SAX handler ( org.xml.sax.helpers.defaulthandler) implement methods for particular events startdocument(), enddocument(), startelement(), endelement() create a org.xml.sax.xmlreader and call its method parse()
64 3 XML Processing With JSP DOM Document Object Model standard API to access HTML and XML documents includes manipulation of HTML and XML documents programming language independent entire document must be parsed and stored in memory DOM if the document elements have to be randomly accessed... the document elements have to be manipulated SAX if the XML document is large... there are only a few elements of interest in the XML document
65 3 XML Processing With JSP JDOM (org.jdom) Java specific DOM representation only for XML documents not to confuse with standard DOM requires library (jdom.jar) from simpler than the org.w3c.dom DOM implementation
66 3 XML Processing With JSP JDOM (org.jdom) Creating XML Trees import org.jdom.*;... Document xmldoc = new Document(); Element root = new Element("root"); root.settext("some text"); xmldoc.setrootelement(root); or even shorter import org.jdom.*;... Document xmldoc = new Document(new Element("root").setText("Some text")); <root>some Text</root>
67 3 XML Processing With JSP JDOM (org.jdom) Creating XML Trees Document xmldoc = new Document(); Element root = new Element("numbers"); root.settext("some text"); root.setattribute(new Attribute("language","german"); xmldoc.setrootelement(root); Element node1 = new Element("one"); node1.settext("eins"); root.addcontent(node1); Element node2 = new Element("two"); node2.settext("zwei"); root.addcontent(node2);... <numbers language="german"> <one>eins</one> <two>zwei</two>... </numbers>
68 3 XML Processing With JSP JDOM (org.jdom) Structure DocType Document Namespace Element String/Text Attribute ProcessingInstruction Element
69 3 XML Processing With JSP JDOM Creating An XML Tree From a Source <%@page import="java.io.*,java.net.*,org.jdom.*,org.jdom.input.saxbuilder"%> <% %> URL fileurl = new URL(" + request.getservername() + ":" + request.getserverport() + request.getcontextpath() + "/xmldocs/testdocument.xml"); SAXBuilder docbuilder = new SAXBuilder(); docbuilder.setvalidation(false); try { Document xmldoc = docbuilder.build(fileurl); catch(ioexception ioe) { out.println(ioe.getmessage());! without XML validation catch(jdomexception jdome) { out.println(jdome.getmessage());! SAX to read in an XML document
70 3 XML Processing With JSP JDOM Creating An XML Tree From a Source <%@page import="java.io.*,java.net.*,org.jdom.*,org.jdom.input.saxbuilder"%> <% URL fileurl = new URL(" + request.getservername() + ":" + request.getserverport() + request.getcontextpath() + "/xmldocs/testdocument.xml"); SAXBuilder docbuilder = new SAXBuilder(); docbuilder.setvalidation(true); docbuilder.setignoringelementcontentwhitespace(true); try { Document xmldoc = docbuilder.build(fileurl);! with XML validation catch(ioexception ioe) { out.println(ioe.getmessage()); catch(jdomexception jdome) { out.println(jdome.getmessage()); %>
71 3 XML Processing With JSP JDOM Traversing XML Trees import="java.io.*,java.net.*,org.jdom.*,org.jdom.input.saxbuilder"%> <% %>... try { Document xmldoc = docbuilder.build(fileurl); Element root = xmldoc.getrootelement(); List children = root.getchildren(); Iterator iterator = children.iterator(); while(iterator.hasnext()) { Element child = (Element) iterator.next(); printnodecontent(child); catch(exception e) {! JDOM to manipulate the XML structure
72 3 XML Processing With JSP JDOM Traversing XML Trees // get root element Element node = xmldoc.getrootelement(); // get a sub element (child) of an Element Element children = node.getchild("name"); Element children = node.getchild("name","namespace"); // get sub elements (children) of an Element List children = node.getchildren(); List children = node.getchildren("name"); List children = node.getchildren("name","namespace"); // get the first Element in a List Element firstelement = (Element) children.get(0);
73 3 XML Processing With JSP JDOM Traversing XML Trees // check whether this Element is the root element if(node.isrootelement()) {... // get the parent Element Element parent = node.getparent();
74 3 XML Processing With JSP JDOM Accessing The Content Of XML Trees // get the content of an Element String text = node.gettext(); String text = node.gettexttrim(); String text = node.gettextnormalize(); // get attributes of an Element Attribute attr = node.getattribute("name"); Attribute attr = node.getattribute("name","namespc"); List attributes = node.getattributes(); // get the attribute values of an Element String attval = node.getattributevalue("name"); String attval = node.getattributevalue("name","namespc");
75 3 XML Processing With JSP JDOM Accessing The Content Of XML Trees // get the content of an Element String text = node.gettext(); String text = node.gettexttrim(); String text = node.gettextnormalize(); // get attributes of an Element Attribute attr = node.getattribute("name"); Attribute attr = node.getattribute("name","namespc"); List attributes = node.getattributes(); // get the attribute values of an Element String attval = node.getattributevalue("name"); String attval = sequences of whitespaces node.getattributevalue("name","namespc"); one whitespace ignores surrounding whitespaces
76 3 XML Processing With JSP JDOM Manipulating XML Trees // add a child Element to a parent Element parentnode.addcontent(childnode); // remove a child Element from a parent Element List children = parentnode.getchildren(); children.remove(0); // remove an attribute from an Element node.removeattribute(anattribute); node.removeattribute("name"); removes the first child element ( live List)
77 3 XML Processing With JSP JDOM Manipulating XML Trees, Example remove administrators Element root = xmldoc.getrootelement(); List users = root.getchildren("user"); Element curruser = null; Element username = null; for(int i = 0; i < users.size( ); i++) { curruser = (Element) users.get(i); username = curruser.getchild("name"); if(username.getattributevalue("admin").equals("true")) { root.removecontent(curruser); check for null pointers in real code <users> <user> <name admin="true">jpelle</name> <password>itsme</password> </user> <user> <name admin="false">par62</name> <password>god</password> </user> </users> <users> <user> <name admin="false">par62</name> <password>god</password> </user> </users>
78 3 XML Processing With JSP JDOM Storing XML Documents import="java.io.*,org.jdom.output.xmloutputter"%> <% Document xmldoc = new Document();... // create some content XMLOutputter xmlout = new XMLOutputter(); try { xmlout.output(xmldoc, out); // add response to the JSP page xmlout.output(xmldoc, System.out); // add response to the console File xmlfile = new File("C:\\my.xml"); xmlfile.createnewfile(); FileOutputStream xmlfileout = new FileOutputStream(xmlFile); xmlout.output(xmldoc, xmlfileout); // write response to a file catch(ioexception ioe) { %>
79 3 XML Processing With JSP JDOM Storing XML Documents, Formatting Output // using predefined formatting options xmlout.setformat(format.getcompactformat()); // default xmlout.setformat(format.getprettyformat()); xmlout.setformat(format.getrawformat()); // add self-defined settings xmlout.setformat( Format.getRawFormat().setIndent(" ")); xmlout.setformat( Format.getRawFormat().setOmitDeclaration(true)); xmlout.setformat( Format.getRawFormat().setOmitEncoding(true));
80 3 XML Processing With JSP JDOM An Example XML declaration must be in the first line! <?xml version="1.0" encoding="utf-8"?> contenttype="text/xml;charset=utf-8"%> import="org.jdom.*, org.jdom.input.*,org.jdom.output.*"%> <jsp:usebean id="person" class="mybeans.xmlperson" scope="page" /> <jsp:setproperty name="person" property="*" /> <% %> Document xmldoc = person.getasxml(); XMLOutputter xmlout = new XMLOutputter(); xmlout.setformat(format.getprettyformat() try {.setomitdeclaration(true).setomitencoding(true)); xmlout.output(xmldoc, out); // use the JspWriter out to write the XML stream catch(ioexception ioe) { do not repeat the XML declaration in the first line!
81 3 XML Processing With JSP JDOM Summary stream/file/url/string JDOM SAXBuilder SAXHandler DOMBuilder... org.jdom.input org.jdom Attribute Document Element NameSpace DocType... XMLOutputter SAXOutputter DOMOutputter... JDOMResult JDOMSource... JDOM stream/file org.jdom.output org.jdom.transform org.jdom.adapters org.jdom.filter org.jdom.xpath
82 Contents Session Tracking
83 4 Session Tracking Session Tracking required since HTTP is a stateless protocol Typical Session Tracking store the user state on the server send back an identifier (session ID) as a cookie or HTTP/ OK Set-cookie: JSESSIONID=AAA1A1D29C24264A08A6B31747B1F531 encoded into the URL (URL rewriting) <a href="nextpage.jsp; JSESSIONID=AAA1A1D29C24264A08A6B31747B1F531> GET /nextpage.jsp;jsessionid=aaa1a1d29c24264a08a6b31747b1f531 HTTP/1.0
84 4 Session Tracking URL Rewriting Support important if the user disables cookies, or if the client doesn t support cookies (PDA, cell phone, ) <c:url > Encode the URL When Needed <a href="<c:url value="next.jsp"/>">a Link</a> value context var scope path to encode (absolute, context-, or page-relative) context path (if resource is not part of this application) name of a variable that holds the encoded URL scope for var
85 4 Session Tracking <c:url > Encode the URL When Needed <c:url value="next.jsp"/> = /WDWJ2EE/next.jsp if the container received a cookie with the request = /WDWJ2EE/next.jsp;JSESSIONID=AAA1A1D29C2 if the container did not receive a cookie <c:url value="next.jsp"> <c:param name="user" value="hans Napf" /> </c:url> = /WDWJ2EE/next.jsp;JSESSIONID=AAA?name=Hans+Napf! path relative converted to a context relative path
86 4 Session Tracking Session Tracking and Multiple Browser Windows each different process is associated with a different session but usually one process controls multiple windows URL rewriting: each window is a separate session Cookies: all windows belong to one session cookies are shared by all windows in the same process
87 Contents Web Services
88 5 Web Services Web Services = a software for interoperable machine-to-machine interaction over a network... using XML based messages... that has an interface defined in an XML format (WSDL) WSDL = Web Services Description Language... that is identified by a unique URI! Web Services = Web Pages for Computers SOAP protocol for exchanging XML based messages used to make a call to a web service
89 5 Web Services SOAP Request (Google Web Services) <?xml version='1.0' encoding='utf-8'?> <SOAP-ENV:Envelope xmlns:soap-env=" xmlns:xsi=" xmlns:xsd=" <SOAP-ENV:Body> <ns1:dospellingsuggestion xmlns:ns1="urn:googlesearch" SOAP-ENV:encodingStyle=" <key xsi:type="xsd:string"> </key> <phrase xsi:type="xsd:string">britney speers</phrase> </ns1:dospellingsuggestion> </SOAP-ENV:Body> </SOAP-ENV:Envelope> messages are contained in an envelope no header in this example (date, authentication,...)
90 5 Web Services SOAP Response (Google Web Services) <?xml version='1.0' encoding='utf-8'?> <SOAP-ENV:Envelope xmlns:soap-env=" xmlns:xsi=" xmlns:xsd=" <SOAP-ENV:Body> <ns1:dospellingsuggestionresponse xmlns:ns1="urn:googlesearch" SOAP-ENV:encodingStyle=" <return xsi:type="xsd:string">britney spears</phrase> </ns1:dospellingsuggestionresponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
91 5 Web Services JSP and Web Services Server (googlesearch) Web Client MySearch.jsp forward XML [request] XML [response] Web Service SearchResult.jsp
92 Contents 1. Introduction to Custom Tags 2. Developing Custom Tag Libraries Tag, TagIteration, and BodyTag interface 3. XML Processing With JSP xml library (JSTL), XPath, JDOM 4. Session Tracking
93 Applied Autonomous Sensor Systems Web Development with JavaEE Developing Custom Tag Libraries and XML Processing with JSP Thank you!
S imilar to JavaBeans, custom tags provide a way for
CREATE THE TAG HANDLER S imilar to JavaBeans, custom tags provide a way for you to easily work with complex Java code in your JSP pages. You can create your own custom tags to suit your needs. Using custom
More informationWeb Development with Java EE Introduction to Custom Tags, JSTL and Deployment
Applied Autonomous Sensor Systems Web Development with Java EE Introduction to Custom Tags, JSTL and Deployment AASS Mobile Robotics Lab, Teknik Room T2222 fpa@aass.oru.se Contents Web Client Programming
More informationDatabase. Request Class. jdbc. Servlet. Result Bean. Response JSP. JSP and Servlets. A Comprehensive Study. Mahesh P. Matha
Database Request Class Servlet jdbc Result Bean Response py Ki ta b JSP Ko JSP and Servlets A Comprehensive Study Mahesh P. Matha JSP and Servlets A Comprehensive Study Mahesh P. Matha Assistant Professor
More informationIntroduction to JSP and Servlets Training 5-days
QWERTYUIOP{ Introduction to JSP and Servlets Training 5-days Introduction to JSP and Servlets training course develops skills in JavaServer Pages, or JSP, which is the standard means of authoring dynamic
More informationBEAWebLogic Server and WebLogic Express. Programming WebLogic JSP Tag Extensions
BEAWebLogic Server and WebLogic Express Programming WebLogic JSP Tag Extensions Version 10.0 Revised: March 30, 2007 Contents Introduction and Roadmap Document Scope and Audience.............................................
More informationAdvanced Web Systems 3- Portlet and JSP-JSTL. A. Venturini
Advanced Web Systems 3- Portlet and JSP-JSTL A. Venturini Contents Portlet: doview flow Handling Render phase Portlet: processaction flow Handling the action phase Portlet URL Generation JSP and JSTL Sample:
More informationSun Sun Certified Web Component Developer for J2EE 5 Version 4.0
Sun Sun Certified Web Component Developer for J2EE 5 Version 4.0 QUESTION NO: 1 To take advantage of the capabilities of modern browsers that use web standards, such as XHTML and CSS, your web application
More informationFast Track to Java EE 5 with Servlets, JSP & JDBC
Duration: 5 days Description Java Enterprise Edition (Java EE 5) is a powerful platform for building web applications. The Java EE platform offers all the advantages of developing in Java plus a comprehensive
More informationThis course is intended for Java programmers who wish to write programs using many of the advanced Java features.
COURSE DESCRIPTION: Advanced Java is a comprehensive study of many advanced Java topics. These include assertions, collection classes, searching and sorting, regular expressions, logging, bit manipulation,
More informationSession 18. JSP Access to an XML Document XPath. Reading
Session 18 JSP Access to an XML Document XPath 1 Reading Reading JSTL (XML Tags Section) java.sun.com/developer/technicalarticles/javaserverpages/f aster/ today.java.net/pub/a/today/2003/11/27/jstl2.html
More informationFast Track to Java EE
Java Enterprise Edition is a powerful platform for building web applications. This platform offers all the advantages of developing in Java plus a comprehensive suite of server-side technologies. This
More information1 CUSTOM TAG FUNDAMENTALS PREFACE... xiii. ACKNOWLEDGMENTS... xix. Using Custom Tags The JSP File 5. Defining Custom Tags The TLD 6
PREFACE........................... xiii ACKNOWLEDGMENTS................... xix 1 CUSTOM TAG FUNDAMENTALS.............. 2 Using Custom Tags The JSP File 5 Defining Custom Tags The TLD 6 Implementing Custom
More informationParsing XML documents. DOM, SAX, StAX
Parsing XML documents DOM, SAX, StAX XML-parsers XML-parsers are such programs, that are able to read XML documents, and provide access to the contents and structure of the document XML-parsers are controlled
More informationDeveloping your first tags
In this chapter JSP custom tags defined 3 Developing your first tags Setting up a development environment Hello World (the tag way) Compiling, deploying, and testing 58 What are JSP custom tags? 59 Thus
More informationsessionx Desarrollo de Aplicaciones en Red EL (2) EL (1) Implicit objects in EL Literals José Rafael Rojano Cáceres
sessionx Desarrollo de Aplicaciones en Red José Rafael Rojano Cáceres http://www.uv.mx/rrojano EL Expression Language Write the code in something else, just let EL call it. EL () EL stand for Expression
More informationUnit 5 JSP (Java Server Pages)
Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic, platform-independent method for building Web-based applications. It focuses more on presentation logic
More informationActual4Test. Actual4test - actual test exam dumps-pass for IT exams
Actual4Test http://www.actual4test.com Actual4test - actual test exam dumps-pass for IT exams Exam : 310-083 Title : Sun Certified Web Component Developer for J2EE 5 Vendors : SUN Version : DEMO Get Latest
More informationJavaServer Pages. What is JavaServer Pages?
JavaServer Pages SWE 642, Fall 2008 Nick Duan What is JavaServer Pages? JSP is a server-side scripting language in Java for constructing dynamic web pages based on Java Servlet, specifically it contains
More informationJSP 2.0 (in J2EE 1.4)
JSP 2.0 (in J2EE 1.4) 1 Disclaimer & Acknowledgments Even though Sang Shin is a full-time employees of Sun Microsystems, the contents here are created as his own personal endeavor and thus does not reflect
More informationAdvantage of JSP over Servlet
JSP technology is used to create web application just like Servlet technology. It can be thought of as an extension to servlet because it provides more functionality than servlet such as expression language,
More informationJava.. servlets and. murach's TRAINING & REFERENCE 2ND EDITION. Joel Murach Andrea Steelman. IlB MIKE MURACH & ASSOCIATES, INC.
TRAINING & REFERENCE murach's Java.. servlets and 2ND EDITION Joel Murach Andrea Steelman IlB MIKE MURACH & ASSOCIATES, INC. P 1-800-221-5528 (559) 440-9071 Fax: (559) 440-0963 murachbooks@murach.com www.murach.com
More informationJSP MOCK TEST JSP MOCK TEST IV
http://www.tutorialspoint.com JSP MOCK TEST Copyright tutorialspoint.com This section presents you various set of Mock Tests related to JSP Framework. You can download these sample mock tests at your local
More informationOracle EXAM - 1Z Java Enterprise Edition 5 Web Component Developer Certified Professional Exam. Buy Full Product
Oracle EXAM - 1Z0-858 Java Enterprise Edition 5 Web Component Developer Certified Professional Exam Buy Full Product http://www.examskey.com/1z0-858.html Examskey Oracle 1Z0-858 exam demo product is here
More informationA Gentle Introduction to Java Server Pages
A Gentle Introduction to Java Server Pages John Selmys Seneca College July 2010 What is JSP? Tool for developing dynamic web pages developed by SUN (now Oracle) High-level abstraction of Java Servlets
More informationPSD1B Advance Java Programming Unit : I-V. PSD1B- Advance Java Programming
PSD1B Advance Java Programming Unit : I-V PSD1B- Advance Java Programming 1 UNIT I - SYLLABUS Servlets Client Vs Server Types of Servlets Life Cycle of Servlets Architecture Session Tracking Cookies JDBC
More informationVendor: SUN. Exam Code: Exam Name: Sun Certified Web Component Developer for J2EE 5. Version: Demo
Vendor: SUN Exam Code: 310-083 Exam Name: Sun Certified Web Component Developer for J2EE 5 Version: Demo QUESTION NO: 1 You need to store a Java long primitive attribute, called customeroid, into the session
More informationOracle 1z Java Enterprise Edition 5 Web Component Developer Certified Professional Exam. Practice Test. Version:
Oracle 1z0-858 Java Enterprise Edition 5 Web Component Developer Certified Professional Exam Practice Test Version: 14.21 QUESTION NO: 1 To take advantage of the capabilities of modern browsers that use
More informationChapter 10 Servlets and Java Server Pages
Chapter 10 Servlets and Java Server Pages 10.1 Overview of Servlets A servlet is a Java class designed to be run in the context of a special servlet container An instance of the servlet class is instantiated
More informationWhat's New in the Servlet and JSP Specifications
What's New in the Servlet and JSP Specifications Bryan Basham Sun Microsystems, Inc bryan.basham@sun.com Page 1 Topics Covered History Servlet Spec Changes JSP Spec Changes: General JSP Spec Changes: Expression
More informationJSTL. JSTL (Java Standard Tag Library) is a collection of custom tags that are developed and maintained by the Jakarta project.
JSTL JSTL (Java Standard Tag Library) is a collection of custom tags that are developed and maintained by the Jakarta project. To use them you need to download the appropriate jar and tld files for the
More information01KPS BF Progettazione di applicazioni web
01KPS BF Progettazione di applicazioni web Introduction to Java Server Pages Fulvio Corno, Alessio Bosca Dipartimento di Automatica e Informatica Politecnico di Torino PAW - JSP intro 1 Introduction to
More informationJSP 1.2 Custom Tags 1
JSP 1.2 Custom Tags 1 Disclaimer & Acknowledgments Even though Sang Shin is a full-time employees of Sun Microsystems, the contents here are created as his own personal endeavor and thus does not reflect
More information1Z Java EE 6 Web Component Developer Certified Expert Exam Summary Syllabus Questions
1Z0-899 Java EE 6 Web Component Developer Certified Expert Exam Summary Syllabus Questions Table of Contents Introduction to 1Z0-899 Exam on Java EE 6 Web Component Developer Certified Expert... 2 Oracle
More informationWriting Servlets and JSPs p. 1 Writing a Servlet p. 1 Writing a JSP p. 7 Compiling a Servlet p. 10 Packaging Servlets and JSPs p.
Preface p. xiii Writing Servlets and JSPs p. 1 Writing a Servlet p. 1 Writing a JSP p. 7 Compiling a Servlet p. 10 Packaging Servlets and JSPs p. 11 Creating the Deployment Descriptor p. 14 Deploying Servlets
More informationCS506 Web Design & Development Final Term Solved MCQs with Reference
with Reference I am student in MCS (Virtual University of Pakistan). All the MCQs are solved by me. I followed the Moaaz pattern in Writing and Layout this document. Because many students are familiar
More informationIntroduction to the Cisco ANM Web Services API
1 CHAPTER This chapter describes the Cisco ANM Web Services application programming interface (API), which provides a programmable interface for system developers to integrate with customized or third-party
More informationCSc31800: Internet Programming, CS-CCNY, Spring 2004 Jinzhong Niu May 9, JSPs 1
CSc31800: Internet Programming, CS-CCNY, Spring 2004 Jinzhong Niu May 9, 2004 JSPs 1 As we know, servlets, replacing the traditional CGI technology, can do computation and generate dynamic contents during
More informationIntroduction to J2EE...xxvii. Chapter 1: Introducing J2EE... 1 Need for Enterprise Programming... 3 The J2EE Advantage... 5
Introduction to J2EE...xxvii Chapter 1: Introducing J2EE... 1 Need for Enterprise Programming... 3 The J2EE Advantage... 5 Platform Independence...5 Managed Objects...5 Reusability...5 Modularity...6 Enterprise
More informationJ2EE Development. Course Detail: Audience. Duration. Course Abstract. Course Objectives. Course Topics. Class Format.
J2EE Development Detail: Audience www.peaksolutions.com/ittraining Java developers, web page designers and other professionals that will be designing, developing and implementing web applications using
More informationJSP - SYNTAX. Any text, HTML tags, or JSP elements you write must be outside the scriptlet. Following is the simple and first example for JSP:
http://www.tutorialspoint.com/jsp/jsp_syntax.htm JSP - SYNTAX Copyright tutorialspoint.com This tutorial will give basic idea on simple syntax ie. elements involved with JSP development: The Scriptlet:
More informationCOMP9321 Web Application Engineering
COMP9321 Web Application Engineering Java Server Pages (JSP) Dr. Basem Suleiman Service Oriented Computing Group, CSE, UNSW Australia Semester 1, 2016, Week 3 http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2442
More informationCOMP9321 Web Application Engineering
COMP9321 Web Application Engineering Semester 2, 2017 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 3 http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2465 1 Review:
More informationCOMP9321 Web Application Engineering
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 3 http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2411 1 Review:
More informationJSTL ( )
JSTL JSTL JSTL (Java Standard Tag Library) is a collection of custom tags that are developed by the Jakarta project. Now it is part of the Java EE specication. To use them you need to download the appropriate
More informationSession 8. Reading and Reference. en.wikipedia.org/wiki/list_of_http_headers. en.wikipedia.org/wiki/http_status_codes
Session 8 Deployment Descriptor 1 Reading Reading and Reference en.wikipedia.org/wiki/http Reference http headers en.wikipedia.org/wiki/list_of_http_headers http status codes en.wikipedia.org/wiki/_status_codes
More informationdirective attribute1= value1 attribute2= value2... attributen= valuen %>
JSP Standard Syntax Besides HTML tag elements, JSP provides four basic categories of constructors (markup tags): directives, scripting elements, standard actions, and comments. You can author a JSP page
More informationDelivery Options: Attend face-to-face in the classroom or via remote-live attendance.
XML Programming Duration: 5 Days US Price: $2795 UK Price: 1,995 *Prices are subject to VAT CA Price: CDN$3,275 *Prices are subject to GST/HST Delivery Options: Attend face-to-face in the classroom or
More informationSession 12. JSP Tag Library (JSTL) Reading & Reference
Session 12 JSP Tag Library (JSTL) 1 Reading & Reference Reading Head First Chap 9, pages 439-474 Reference (skip internationalization and sql sections) Java EE 5 Tutorial (Chapter 7) - link on CSE336 Web
More informationJSP2.0 part II 23/01/54 1
JSP2.0 part II 1 Agenda Focus of JSP 2.0 technology Expression language Tag Library JSTL Core function, database EL function Standard Custom EL function Tag file Tag Handler 2 Custom Tag Libraries The
More informationJava- EE Web Application Development with Enterprise JavaBeans and Web Services
Java- EE Web Application Development with Enterprise JavaBeans and Web Services Duration:60 HOURS Price: INR 8000 SAVE NOW! INR 7000 until December 1, 2011 Students Will Learn How to write Session, Message-Driven
More informationweb.xml Deployment Descriptor Elements
APPENDIX A web.xml Deployment Descriptor s The following sections describe the deployment descriptor elements defined in the web.xml schema under the root element . With Java EE annotations, the
More informationADVANCED JAVA TRAINING IN BANGALORE
ADVANCED JAVA TRAINING IN BANGALORE TIB ACADEMY #5/3 BEML LAYOUT, VARATHUR MAIN ROAD KUNDALAHALLI GATE, BANGALORE 560066 PH: +91-9513332301/2302 www.traininginbangalore.com 2EE Training Syllabus Java EE
More informationModernizing Java Server Pages By Transformation. S h a n n o n X u T h o m a s D e a n Q u e e n s U n i v e r s i t y
Modernizing Java Server Pages By Transformation S h a n n o n X u T h o m a s D e a n Q u e e n s U n i v e r s i t y Background CSER - Consortium for Software Engineering Research Dynamic Web Pages Multiple
More informationXML and XSLT. XML and XSLT 10 February
XML and XSLT XML (Extensible Markup Language) has the following features. Not used to generate layout but to describe data. Uses tags to describe different items just as HTML, No predefined tags, just
More informationANTAL Margit. Sapientia - EMTE, Pannon Forrás,,Egységes erdélyi felnőttképzés a
Sapientia - EMTE, Pannon Forrás,,Egységes erdélyi felnőttképzés a Kárpát-medencei hálózatban 2010 JSP és JSTL A anatómiája JSTL Listázás szkriptlettel
More informationSession 9. Deployment Descriptor Http. Reading and Reference. en.wikipedia.org/wiki/http. en.wikipedia.org/wiki/list_of_http_headers
Session 9 Deployment Descriptor Http 1 Reading Reading and Reference en.wikipedia.org/wiki/http Reference http headers en.wikipedia.org/wiki/list_of_http_headers http status codes en.wikipedia.org/wiki/http_status_codes
More informationSAX & DOM. Announcements (Thu. Oct. 31) SAX & DOM. CompSci 316 Introduction to Database Systems
SAX & DOM CompSci 316 Introduction to Database Systems Announcements (Thu. Oct. 31) 2 Homework #3 non-gradiance deadline extended to next Thursday Gradiance deadline remains next Tuesday Project milestone
More informationDelivery Options: Attend face-to-face in the classroom or remote-live attendance.
XML Programming Duration: 5 Days Price: $2795 *California residents and government employees call for pricing. Discounts: We offer multiple discount options. Click here for more info. Delivery Options:
More informationJAVA COURSES. Empowering Innovation. DN InfoTech Pvt. Ltd. H-151, Sector 63, Noida, UP
2013 Empowering Innovation DN InfoTech Pvt. Ltd. H-151, Sector 63, Noida, UP contact@dninfotech.com www.dninfotech.com 1 JAVA 500: Core JAVA Java Programming Overview Applications Compiler Class Libraries
More informationXML Programming in Java
Mag. iur. Dr. techn. Michael Sonntag XML Programming in Java DOM, SAX XML Techniques for E-Commerce, Budapest 2005 E-Mail: sonntag@fim.uni-linz.ac.at http://www.fim.uni-linz.ac.at/staff/sonntag.htm Michael
More informationJava 2 Platform, Enterprise Edition: Platform and Component Specifications
Table of Contents Java 2 Platform, Enterprise Edition: Platform and Component Specifications By Bill Shannon, Mark Hapner, Vlada Matena, James Davidson, Eduardo Pelegri-Llopart, Larry Cable, Enterprise
More information112. Introduction to JSP
112. Introduction to JSP Version 2.0.2 This two-day module introduces JavaServer Pages, or JSP, which is the standard means of authoring dynamic content for Web applications under the Java Enterprise platform.
More informationJavaServer Pages (JSP)
JavaServer Pages (JSP) The Context The Presentation Layer of a Web App the graphical (web) user interface frequent design changes usually, dynamically generated HTML pages Should we use servlets? No difficult
More informationJava E-Commerce Martin Cooke,
Java E-Commerce Martin Cooke, 2002 1 Java technologies for presentation: JSP Today s lecture in the presentation tier Java Server Pages Tomcat examples Presentation How the web tier interacts with the
More informationJava Server Page (JSP)
Java Server Page (JSP) CS 4640 Programming Languages for Web Applications [Based in part on SWE432 and SWE632 materials by Jeff Offutt] [Robert W. Sebesta, Programming the World Wide Web] 1 Web Applications
More informationUNIT -5. Java Server Page
UNIT -5 Java Server Page INDEX Introduction Life cycle of JSP Relation of applet and servlet with JSP JSP Scripting Elements Difference between JSP and Servlet Simple JSP program List of Questions Few
More informationTable of Contents. Introduction... xxi
Introduction... xxi Chapter 1: Getting Started with Web Applications in Java... 1 Introduction to Web Applications... 2 Benefits of Web Applications... 5 Technologies used in Web Applications... 5 Describing
More informationAdv. Web Technology 3) Java Server Pages
Adv. Web Technology 3) Java Server Pages Emmanuel Benoist Fall Term 2016-17 Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 1 Presentation of the Course I Introduction
More informationADVANCED JAVA COURSE CURRICULUM
ADVANCED JAVA COURSE CURRICULUM Index of Advanced Java Course Content : 1. Basics of Servlet 2. ServletRequest 3. Servlet Collaboration 4. ServletConfig 5. ServletContext 6. Attribute 7. Session Tracking
More informationFINALTERM EXAMINATION Spring 2009 CS506- Web Design and Development Solved by Tahseen Anwar
FINALTERM EXAMINATION Spring 2009 CS506- Web Design and Development Solved by Tahseen Anwar www.vuhelp.pk Solved MCQs with reference. inshallah you will found it 100% correct solution. Time: 120 min Marks:
More informationJAVA 2 ENTERPRISE EDITION (J2EE)
COURSE TITLE DETAILED SYLLABUS SR.NO JAVA 2 ENTERPRISE EDITION (J2EE) ADVANCE JAVA NAME OF CHAPTERS & DETAILS HOURS ALLOTTED SECTION (A) BASIC OF J2EE 1 FILE HANDLING Stream Reading and Creating file FileOutputStream,
More information112-WL. Introduction to JSP with WebLogic
Version 10.3.0 This two-day module introduces JavaServer Pages, or JSP, which is the standard means of authoring dynamic content for Web applications under the Java Enterprise platform. The module begins
More informationive JAVA EE C u r r i c u l u m
C u r r i c u l u m ive chnoworld Development Training Consultancy Collection Framework - The Collection Interface(List,Set,Sorted Set). - The Collection Classes. (ArrayList,Linked List,HashSet,TreeSet)
More informationSpecialized - Mastering JEE 7 Web Application Development
Specialized - Mastering JEE 7 Web Application Development Code: Lengt h: URL: TT5100- JEE7 5 days View Online Mastering JEE 7 Web Application Development is a five-day hands-on JEE / Java EE training course
More informationJava J Course Outline
JAVA EE - J2SE - CORE JAVA After all having a lot number of programming languages. Why JAVA; yet another language!!! AND NOW WHY ONLY JAVA??? CHAPTER 1: INTRODUCTION What is Java? History Versioning The
More informationIT6503 WEB PROGRAMMING. Unit-I
Department of Information Technology Question Bank- Odd Semester 2015-2016 IT6503 WEB PROGRAMMING Unit-I SCRIPTING 1. What is HTML? Write the format of HTML program. 2. Differentiate HTML and XHTML. 3.
More informationHandling XML data with Java
Handling XML data with Java by Azza NAFTI The success of a project depends on several factors primarily, on the technical choices and the development language. Fortunately, Java software is highly portable
More informationSOAP Introduction Tutorial
SOAP Introduction Tutorial Herry Hamidjaja herryh@acm.org 1 Agenda Introduction What is SOAP? Why SOAP? SOAP Protocol Anatomy of SOAP Protocol SOAP description in term of Postal Service Helloworld Example
More informationProgramming Web Services in Java
Programming Web Services in Java Description Audience This course teaches students how to program Web Services in Java, including using SOAP, WSDL and UDDI. Developers and other people interested in learning
More informationData Exchange. Hyper-Text Markup Language. Contents: HTML Sample. HTML Motivation. Cascading Style Sheets (CSS) Problems w/html
Data Exchange Contents: Mariano Cilia / cilia@informatik.tu-darmstadt.de Origins (HTML) Schema DOM, SAX Semantic Data Exchange Integration Problems MIX Model 1 Hyper-Text Markup Language HTML Hypertext:
More informationIterating with tags. Iterating With Tags. In this chapter
In this chapter Iterating with tags 101 Universal iteration with tags (iterate anything!) Tag-only presentation of a shopping cart The JSP1.2 IterationTag Iterating With Tags 10 Iterating with tags 302
More informationIslamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM Advanced Internet Technology Lab.
Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 5049 Advanced Internet Technology Lab Lab # 10 JAVABEANS IN JSP El-masry May, 2014 Objectives Understanding JavaBeans.
More informationWhat's New in J2EE 1.4
What's New in J2EE 1.4 Dave Landers BEA Systems, Inc. dave.landers@4dv.net dave.landers@bea.com Page 1 Agenda Quick Overview of J2EE 1.4 New Kids on the Block New specs and those new to J2EE The Gory Details
More informationExperiment No: Group B_2
Experiment No: Group B_2 R (2) N (5) Oral (3) Total (10) Dated Sign Problem Definition: A Web application for Concurrent implementation of ODD-EVEN SORT is to be designed using Real time Object Oriented
More informationAdvanced Java Programming
Advanced Java Programming Length: 4 days Description: This course presents several advanced topics of the Java programming language, including Servlets, Object Serialization and Enterprise JavaBeans. In
More informationDeveloping Portlets for SAS Information Delivery Portal 4.4
Developing Portlets for SAS Information Delivery Portal 4.4 SAS Documentation The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2015. Developing Portlets for SAS Information
More informationXML for Java Developers G Session 8 - Main Theme XML Information Rendering (Part II) Dr. Jean-Claude Franchitti
XML for Java Developers G22.3033-002 Session 8 - Main Theme XML Information Rendering (Part II) Dr. Jean-Claude Franchitti New York University Computer Science Department Courant Institute of Mathematical
More informationAdvanced JavaServer Pages
David M. Geary Publisher: Prentice Hall PTR First Edition May 01, 2001 ISBN: 0-13-030704-1, 508 pages To fully exploit the power of JavaServer Pages technology in Web application development, based on
More informationCopyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 7 XML
Chapter 7 XML 7.1 Introduction extensible Markup Language Developed from SGML A meta-markup language Deficiencies of HTML and SGML Lax syntactical rules Many complex features that are rarely used HTML
More informationExercise SBPM Session-4 : Web Services
Arbeitsgruppe Exercise SBPM Session-4 : Web Services Kia Teymourian Corporate Semantic Web (AG-CSW) Institute for Computer Science, Freie Universität Berlin kia@inf.fu-berlin.de Agenda Presentation of
More informationSAS Web Infrastructure Kit 1.0. Developer s Guide
SAS Web Infrastructure Kit 1.0 Developer s Guide The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2004. SAS Web Infrastructure Kit 1.0: Developer s Guide. Cary, NC:
More informationAIM. 10 September
AIM These two courses are aimed at introducing you to the World of Web Programming. These courses does NOT make you Master all the skills of a Web Programmer. You must learn and work MORE in this area
More informationModule 3 Web Component
Module 3 Component Model Objectives Describe the role of web components in a Java EE application Define the HTTP request-response model Compare Java servlets and JSP components Describe the basic session
More informationXML: Extensible Markup Language
XML: Extensible Markup Language CSC 375, Fall 2015 XML is a classic political compromise: it balances the needs of man and machine by being equally unreadable to both. Matthew Might Slides slightly modified
More informationIntroduction to Java Server Pages. Enabling Technologies - Plug-ins Scripted Pages
Introduction to Java Server Pages Jeff Offutt & Ye Wu http://www.ise.gmu.edu/~offutt/ SWE 432 Design and Implementation of Software for the Web From servlets lecture. Enabling Technologies - Plug-ins Scripted
More informationA JavaBean is a class file that stores Java code for a JSP
CREATE A JAVABEAN A JavaBean is a class file that stores Java code for a JSP page. Although you can use a scriptlet to place Java code directly into a JSP page, it is considered better programming practice
More informationLTBP INDUSTRIAL TRAINING INSTITUTE
Java SE Introduction to Java JDK JRE Discussion of Java features and OOPS Concepts Installation of Netbeans IDE Datatypes primitive data types non-primitive data types Variable declaration Operators Control
More informationCSI 3140 WWW Structures, Techniques and Standards. Representing Web Data: XML
CSI 3140 WWW Structures, Techniques and Standards Representing Web Data: XML XML Example XML document: An XML document is one that follows certain syntax rules (most of which we followed for XHTML) Guy-Vincent
More informationDocument Parser Interfaces. Tasks of a Parser. 3. XML Processor APIs. Document Parser Interfaces. ESIS Example: Input document
3. XML Processor APIs How applications can manipulate structured documents? An overview of document parser interfaces 3.1 SAX: an event-based interface 3.2 DOM: an object-based interface Document Parser
More informationCourses For Event Java Advanced Summer Training 2018
Courses For Event Java Advanced Summer Training 2018 Java Fundamentals Oracle Java SE 8 Advanced Java Training Java Advanced Expert Edition Topics For Java Fundamentals Variables Data Types Operators Part
More information