Thursday, February 14, 2008

JSP pages

(1)index.jsp.............


< html>
< head>
< meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
< title>JSP Page< /title>
< /head>
< body>
< h2>Entry Form..< /h2>< form name=" Name Input Form" action="response.jsp">
Enter your name:
< input type="text" name="name" value="" />
< input type="submit" value="OK" />
< /form>
< /body>
< /html>


(2)responsing JSP file(response.jsp)

< html>
< head>
< meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
< title>JSP Page< /title>
< /head>
< body>
< jsp:useBean id="mybean" scope="session" class="org.me.hello.NameHandler" />
< jsp:setProperty name="mybean" property="name" />
< h2>Hello, !< /h2>
< /body>
< /html>



(3)

package org.me.hello;


public class NameHandler {

private String name;
public NameHandler(){
name = null;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

***(1)Setting Up the Project

Start NetBeans IDE.
In the IDE, choose File > New Project
In the New Project wizard, select Java Application
Then click Next.
In the Name and Location page of the wizard, do the following
In the Project Name field, type HelloWorldApp.
In the Create Main Class field, type helloworldapp.HelloWorldApp
Leave the Set as Main Project checkbox selected.


// TODO code application logic here


* Save the change by choosing File > Save.

* Compiling the Source File--F11
To compile your source file, choose Build > Build Main Project from the IDE's main menu.

* Running the Program--F6
From the IDE's menu bar, choose Run > Run Main Project.