Home | | Internet & World Wide Web HOW TO PROGRAM | | Internet Programming | | Web Programming | Examining the XHTML Generated by a Java Web Application

Chapter: Internet & World Wide Web HOW TO PROGRAM - Rich Internet Application Server Technologies - JavaServer™ Faces Web Applications

Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail

Examining the XHTML Generated by a Java Web Application

To view this XHTML, select View > Source in Internet Explorer or View > Page Source in Firefox.

Examining the XHTML Generated by a Java Web Application

 

Figure 26.4 shows the XHTML generated when Time.jsp (Fig. 26.1) is requested by a cli-ent web browser. To view this XHTML, select View > Source in Internet Explorer or View > Page Source in Firefox. [Note: We reformatted the XHTML to conform to our coding conventions.]

 

66 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

 

67       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

68<html xmlns = "http://www.w3.org/1999/xhtml"

 

69       xmlns:wairole = "http://www.w3.org/2005/01/wai-rdf/GUIRoleTaxonomy#"

 

70       xmlns:waistate = "http://www.w3.org/2005/07/aaa">

 

71       <head>

 

72             <meta content = "no-cache" http-equiv = "Pragma" />

 

73             <meta content = "no-cache" http-equiv = "Cache-Control" />

 

74             <meta content = "no-store" http-equiv = "Cache-Control" />

 

75                <meta content = "max-age=0" http-equiv = "Cache-Control" />

 

76                <meta content = "1" http-equiv = "Expires" />

 

77                <title>Web Time: A Simple Example</title>

 

78                <link rel = "stylesheet" type = "text/css" href = "/WebTime/theme/

 

79                      com/sun/webui/jsf/suntheme/css/css_master.css" />

 

80                <link rel = "stylesheet" type = "text/css" href = "/WebTime/theme/

 

81                      com/sun/webui/jsf/suntheme/css/ie7.css" />

 

82                <script type = "text/javascript">

djConfig = {

19   "isDebug": false,

20   "parseWidgets": false,

21   "debugAtAllCosts": false

73 };

 

74                </script>

 

75                <script type = "text/javascript"

 

76                      src = "/WebTime/theme/META-INF/dojo/dojo.js"></script>

 

77                <script type = "text/javascript"

 

78                      src = "/WebTime/theme/META-INF/json/json.js"></script>

 

79                <script type = "text/javascript"

 

80                      src = "/WebTime/theme/META-INF/prototype/prototype.js"></script>

 

81                <script type = "text/javascript"

 

src = "/WebTime/theme/META-INF/com_sun_faces_ajax.js"></script>

76                <script type = "text/javascript">

 

77                      dojo.hostenv.setModulePrefix( "webui.suntheme",

80                            "/WebTime/theme/com/sun/webui/jsf/suntheme/javascript" );

 

81                      dojo.require( 'webui.suntheme.*' );

 

82                </script>

 

83                <link id = "link1" rel = "stylesheet" type = "text/css"

 

84                      href = "/WebTime/resources/stylesheet.css" />

 

85                <meta id = "j_id_id7" http-equiv = "refresh" content = "60" />

 

86         </head>

 

87         <body id = "body1" style = "-rave-layout:grid" onload="" onunload="">

 

88                <form id = "form1" class = "form" method = "post"

 

89                      action = "/WebTime/faces/Time.jsp"

 

90                      enctype = "application/x-www-form-urlencoded">

 

91                <span id = "form1:timeHeader" style = "font-size: 18px; left: 24px;

 

92                      top: 24px; position: absolute">Current time on the web server:

 

93                </span>

 

94                <span id = "form1:clockText" style = "background-color: black;

 

95                      color: yellow; font-size: 18px; left: 24px; top: 48px;

 

96                      position: absolute">12:30:49 PM EDT</span>

 

97                <input id = "form1_hidden" name = "form1_hidden"

 

98                      value = "form1_hidden" type = "hidden" />

 

99                <input type = "hidden" name = "javax.faces.ViewState"

 

100                  id = "javax.faces.ViewState" value = "j_id173:j_id174" />

 

101            </form>

 

102            <script type = "text/javascript">

 

103                  webui.suntheme.common.body = new webui.suntheme.body(

58            '/Time.jsp', '/WebTime/faces/Time.jsp', null, null,

 

87                            'com_sun_webui_util_FocusManager_focusElementId');</script>

 

88         </body>

 

89   </html>

 

Fig. 26.4 | XHTML response generated when the browser requests Time.jsp. (Part 2 of 2.)

 

 

 

The XHTML document in Fig. 26.4 is similar in structure to the JSP file of Fig. 26.1. Lines 1–2 are the document type declaration, which declares this document to be an XHTML 1.0 Transitional document. The XHTML meta tags in lines 7–11 are equivalent to HTTP headers and are used to control browser behavior.

Lines 41–60 define the body of the document. Lines 42–55 define an XHTML form. In this particular program, the user does not submit data to the web server for processing. We demonstrate how to submit data to the server in later examples. Attribute method of the form element (line 42) specifies the method by which the web browser submits the form to the server. By default, JSPs use the post method. The form’s action attribute (line 43) identifies the resource that will be requested when this form is submitted—in this case,

/WebTime/faces/Time.jsp.

 

Note that the two Static Text components (i.e., timeHeader and clockText) are rep-resented by two span elements in the XHTML document (lines 45–47, 48–50) as previ-ously discussed. The formatting options that were specified as properties of timeHeader and clockText, such as the font size and text color in the components, are now specified in each span element’s style attribute.


Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail


Copyright © 2018-2020 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.