Simple JSP output : Basics « JSP « Java






Simple JSP output

Simple JSP output
//ch01_01.jsp
<HTML>
  <HEAD>
    <TITLE>A JSP Example</TITLE>
  </HEAD>

  <BODY>
    <H1>Using JSP</H1>
    <% out.println("No worries."); %>
  </BODY>
</HTML>


//ch01_02.html
<HTML>
    <HEAD>
        <TITLE>Reading Text Fields</TITLE>
    </HEAD>
 
    <BODY>
        <H1>Reading Text Fields</H1>
        <FORM ACTION="ch01_03.jsp" METHOD="POST">
            Enter your name:
            <INPUT TYPE="TEXT" NAME="text1">
            <BR>
            <INPUT TYPE="SUBMIT" value="Submit">
        </FORM>
    </BODY>
</HTML>

//ch01_03.jsp
<HTML>
  <HEAD>
    <TITLE>Reading Data From Text Fields</TITLE>
  </HEAD>

    <BODY>
        <H1>Reading Data From Text Fields</H1>
        Your name is 
        <% out.println(request.getParameter("text1")); %>
   </BODY>
</HTML>

//ch01_07.jsp
<HTML>
    <HEAD>
        <TITLE>Using a Bean</TITLE>
    </HEAD>

    <BODY>
        <H1>Using a Bean</H1>

    <% beans.ch01_04 messenger = new beans.ch01_04(); %>
    The bean says: <%= messenger.message() %> 

    </BODY>
</HTML>

//ch01_07.jsp
<HTML>
    <HEAD>
        <TITLE>Using Bean Properties</TITLE>
    </HEAD>

    <BODY>
        <H1>Using Bean Properties</H1>

        <jsp:useBean id="bean1" class="beans.ch01_06" />

        The bean says: <jsp:getProperty name="bean1" property="message" /> 
        <BR>
        <jsp:setProperty name="bean1" property="message" value="No Problem." />

        Now the beans says: <jsp:getProperty name="bean1" property="message" />
    </BODY>
</HTML>


           
       








Struts-Essential-Skills-ch01.zip( 5 k)

Related examples in the same category

1.JSP Passing Parameters
2.Simplest Jsp page: A Web Page
3.Output: Creating a Greeting
4.Simple JSP page to display the random number
5.Comments in JSP page
6.Declaration Tag Example
7.Declaration Tag - Methods
8.Expression Language Examples
9.Passing parameters
10.JSP Initialization
11.Welcome page and top level URL
12.JSP Expression Language
13.JSP without beans
14.Request header display in a JSP
15.Multiple Declaration
16.Embedding Code
17.pwd -- print working directory
18.JSP post
19.JSP Post Data Viewer
20.JSP in J2EE
21.JSP Performance
22.JSP Best Practices and Tools
23.JSP Model 2JSP Model 2
24.JSP: expression language 2JSP: expression language 2
25.JSP Basics: Dynamic Page Creation for Data Presentation 2JSP Basics: Dynamic Page Creation for Data Presentation 2
26.JSP Directives: your page
27.JSP Directives
28.JSP Basics ch02 JSP Basics ch02
29.JSP Basics: Generalized Templating and Server Scripting 1JSP Basics: Generalized Templating and Server Scripting 1
30.JSP Basics: Generalized Templating and Server Scripting 2JSP Basics: Generalized Templating and Server Scripting 2
31.JSP Basics: Generalized Templating and Server Scripting 3JSP Basics: Generalized Templating and Server Scripting 3
32.CSS, JavaScript, VBScript, and JSP 1CSS, JavaScript, VBScript, and JSP 1
33.CSS, JavaScript, VBScript, and JSP 2CSS, JavaScript, VBScript, and JSP 2
34.Advanced Dynamic Web Content Generation. 1Advanced Dynamic Web Content Generation. 1