<
scripttype
=
"
text/javascript
"
src
=
"
../dojojs/dojo.js
"
></
script
>
< scripttype = " text/javascript " >
dojo.require( " dojo.widget.* " );
</ script >
< script >
function helloPressed()
... {
dojo.io.bind(...{
url:'server.jsp',
method:'POST',
handler:helloCallback,
content:...{name:dojo.byId('tId').value}
});
}
function helloCallback(type,data,evt)
... {
if(type=='error')
...{
alert('读取服务器数据时出错');
}
else
...{
dojo.byId("show").innerHTML=data;
}
}
</ script >
< scripttype = " text/javascript " >
dojo.require( " dojo.widget.* " );
</ script >
< script >
function helloPressed()
... {
dojo.io.bind(...{
url:'server.jsp',
method:'POST',
handler:helloCallback,
content:...{name:dojo.byId('tId').value}
});
}
function helloCallback(type,data,evt)
... {
if(type=='error')
...{
alert('读取服务器数据时出错');
}
else
...{
dojo.byId("show").innerHTML=data;
}
}
</ script >
serve.jsp
<%
@pagecontentType
=
"
text/html;charset=GB2312
"
%>
<% @pageimport = " java.sql.*,com.teacher.*,com.pool.*; " %>
<%
request.setCharacterEncoding( " GB2312 " );
%>
<%! Stringr1 = "" ,r2 = "" ,r3 = "" ,r4 = "" ,r5 = "" ,r6 = "" ,r7 = "" ; %>
<%
Stringname = null ,r7 = new String( "" );
name = request.getParameter( " name " );
if (name.length() != 0 &&! name.equals( "" ))
... {
Connectionconn=null;
Statementstmt=null;
ResultSetrs=null;
Stringsql="select*fromteacherwheretId="+name+";";
try...{
conn=ConnDB.getConnection();
stmt=conn.createStatement();
rs=stmt.executeQuery(sql);
if(rs.next())
...{
r1=rs.getString(1);
r2=rs.getString(2);
r3=rs.getString(3);
r4=rs.getString(4);
r5=rs.getString(5);
r6=rs.getString(6);
}else
...{
r7="没有这个老师!请查询清楚!";
}
}catch(Exceptionex)
...{
ex.printStackTrace();
}
}
if (r7.length() == 0 && r7.equals( "" ))
... {
%><table><tr><td><%=r1%></td><td><%=r2%></td><td><%=r3%></td><td><%=r4%></td><td><%=r5%></td><td><%=r6%></td></tr></table>
<table>
<%} else
... {
%>
<tr><td><%=r7%></td></tr>
<%} %>
</ table >
<% @pageimport = " java.sql.*,com.teacher.*,com.pool.*; " %>
<%
request.setCharacterEncoding( " GB2312 " );
%>
<%! Stringr1 = "" ,r2 = "" ,r3 = "" ,r4 = "" ,r5 = "" ,r6 = "" ,r7 = "" ; %>
<%
Stringname = null ,r7 = new String( "" );
name = request.getParameter( " name " );
if (name.length() != 0 &&! name.equals( "" ))
... {
Connectionconn=null;
Statementstmt=null;
ResultSetrs=null;
Stringsql="select*fromteacherwheretId="+name+";";
try...{
conn=ConnDB.getConnection();
stmt=conn.createStatement();
rs=stmt.executeQuery(sql);
if(rs.next())
...{
r1=rs.getString(1);
r2=rs.getString(2);
r3=rs.getString(3);
r4=rs.getString(4);
r5=rs.getString(5);
r6=rs.getString(6);
}else
...{
r7="没有这个老师!请查询清楚!";
}
}catch(Exceptionex)
...{
ex.printStackTrace();
}
}
if (r7.length() == 0 && r7.equals( "" ))
... {
%><table><tr><td><%=r1%></td><td><%=r2%></td><td><%=r3%></td><td><%=r4%></td><td><%=r5%></td><td><%=r6%></td></tr></table>
<table>
<%} else
... {
%>
<tr><td><%=r7%></td></tr>
<%} %>
</ table >