主题:请问在jsp里面如何调用一个java类?
有这样一个java类,我想在jsp里面调用他,并且把T1和T2的值给他计算,请问在jsp里面怎么写?
java类:
package java1;
public class FirstApplet {
String a;
String b;
String c=a+b;
}
//
jsp代码:
<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<body>
<form name="formname" action="">
<p>数据1:<%=request.getParameter("T1")%></p>
<p>数据2:<%=request.getParameter("T2")%></p>
</form>
</body>
</html>
java类:
package java1;
public class FirstApplet {
String a;
String b;
String c=a+b;
}
//
jsp代码:
<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<body>
<form name="formname" action="">
<p>数据1:<%=request.getParameter("T1")%></p>
<p>数据2:<%=request.getParameter("T2")%></p>
</form>
</body>
</html>