Web Page In JSP

Introduction

 
The web page is rendered in the browser by interpreting the page syntax and communicate with the server where the page content is stored and includes plig ins and access to facilities needed to process all components of the webpage.
 

Host and Paths

 
The hostname is case insensitive and the path is case sensitive. For domain and host space is not allowed. The below code shows the JSP module that echo back the HTTP request parameters.   
  1. <%@ page import = " java.io.", java.util.*"%>    
  2. <%    
  3.      out.println ("Method : "+ request.getMethod() + "</br>");    
  4.     Enumeration pars = request.getParmeterNames ();    
  5.     While (pars.hasMoreElements ())    
  6.    {    
  7.        String parName = (String) pars.nextElement ();    
  8.        String [] parValues = request.getParameterValues (parName);    
  9.        out.print (parName + " = ");    
  10.     for ( int k = 0; k< parValues.length(); k++)    
  11.    {    
  12.        out.println ("</br>");    
  13.    }    
  14. %>    

HTML Elements and Tags

 
HTML documents consist of content enclosed between a pair of start and end tags. The start tag includes element attributes, and some elements are empty. The end tag consists of slash before the closing bracket of the start tag. Elements can be nested.
 

Content

 
An HTML document consists of text, images, audio, and video content such as script and executables. The brower intercepts and render the component in order and without inserting any empty space between them. The browser render every component to series of default specified in html standard. The object element is used to insert any component and the below code is used to play video content in flash type.
  1. < object type = "appication/x-shockwave-flash" >  
  2.   data = " myclip.swf " width = "400" height = "300" >  
  3.   <param name = "movie" value = "myClip.swf">  
  4.   <p> Video is playing in the web page . . . </P>  
  5. </object>  

Tables

 
Table element is used to display tabular data. tr and td are the table row and table data element iwithin the rows. The below code show the table which shows the content in the table with the table row, table column, and table heading.
  1. < table border = "1" >  
  2.    < tr style = "background-color: #cococo">  
  3.       < th> name </th>  
  4.       < th align = "center" colspan = "2"> marks </th>  
  5.    < /tr>  
  6.    < tr>  
  7.       < td> ram </td>  
  8.       < td> 50 </td>  
  9.       < td> 60 </td>  
  10.    </tr>  
  11. </table>  

Forms

 
The form element is used to the type specification, upload specification, and choice specification. It accepts data from the user and sends the data to the server. The control elements are defined inside the form element. The input element is used to enter the text, passwords, checkbox, radio button, uploading a document. The text area is used to enter the text content with many lines and the fieldset is used to group several input fields. 
 
Style Syntax
 
The selector is html element and property is the element attribute, value is the attribute value. The several attributes are defined for same element. To define more than one style for same element, can associate a class name to separate style.
  1. < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict .dtd" >  
  2. " http://www.w.org/TR/xhtml1/strict.dtd" >  
  3. < html >  
  4.    < head >  
  5.     < title > Styled paragraphs </title >  
  6.       <style type = "text/CSS" >  
  7.          P { font-size : 130% }  
  8.          p.bold { font-weight : bold }  
  9.          p.italic { font-style : italic }  
  10.          p.p123 { font-size : 100%; font-weight : normal; font-style :normal   
  11.          }  
  12.       </style>  
  13.    </head>  
  14. <body>  
  15.    <p> This is a small paragraph </p>  
  16.    <p class ="bold"> Bold the paragraph </p>  
  17.    <p class = "bold italic" > Italic paragraph </p>  
  18. </body>  
  19. </html>  

Javascript Inside a Web Page

 
The script is included in the web pages in two ways, by writing the script inside or placing the script inside the head or body. When the script is placed inside the body tag, the browser will execute it on the loading page.
  1. <script type = "text/javascript " >  
  2.    // other script  
  3. </script>