Here’s the example of JSP syntax


< html >
< body >
< %! String name = new String(“Growel”); % >
< %! public String getName() { return name;} % >
Hello < B >
< jsp:expression > getName() < /jsp:expression >
< /B >
< /body >
< /html >

• This example contains HTML tags.

• A string object, name contains the value “Growel”

• A function getName() returns a String.

• The String is printed using JSP expression.

To run this example…

• Save this file SimpleJSP.jsp in
– J2EE_HOME%\public_html\JSPExamples\

• Start the J2EE server by invoking j2ee –verbose command in command prompt.
– C:\j2sdkee1.3.1\bin>j2ee –verbose

• Now open a browser and navigate to

http://localhost:8000/JSPExamples/SampleJSP.jsp

• The output is similar to: