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;
}

No comments: