完成JSP+JavaBean的基本实验

Receiver.JSP代码:

<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>

"mystudent" scope="page"  class="com.xjx.www.Student">

"mystudent" property="*"/>

"username" name="mystudent" param="username1"/>

"password" name="mystudent" param="password1"/>

<%

String path = request.getContextPath();

String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>

 

    "<%=basePath%>">

    

    My JSP 'receiver.jsp' starting page

    

"pragma" content="no-cache">

"cache-control" content="no-cache">

"expires" content="0">    

"keywords" content="keyword1,keyword2,keyword3">

"description" content="This is my page">

 

 

  

 

    This is my JSP page.

    <%=mystudent.getUsername() %>

    <%=mystudent.getPassword() %>

 

 

Send.JSP代码:

<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>

"http://www.w3.org/1999/xhtml">

"Content-Type" content="text/html; charset=utf-8" />

SEND

"form1" name="form1" method="get" action="receiver.jsp">

 

姓名:

   

      "text" name="username1" id="textfield" />

   

 

 

密码:

   

      "text" name="password1" id="textfield2" />

   

 

 

   

      "submit" name="button" id="button" value="提交" />

   

 

 

Student.JAVA代码:

package com.xjx.www;

 

public class Student {

  public String getUsername() {

return username;

}

public void setUsername(String username) {

this.username = username;

}

public String getPassword() {

return password;

}

public void setPassword(String password) {

this.password = password;

}

private String username;

  private String password;

  

}

完成JSP+JavaBean的基本实验_第1张图片完成JSP+JavaBean的基本实验_第2张图片完成JSP+JavaBean的基本实验_第3张图片完成JSP+JavaBean的基本实验_第4张图片

 

你可能感兴趣的:(完成JSP+JavaBean的基本实验)