jsp如何引入import进来JAVA的类:
1. 直接import
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page import="java.text.SimpleDateFormat,java.util.Date" %> <% Date dNow = new Date( ); SimpleDateFormat ft = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); out.print( "<h2 align=\"center\">" + ft.format(dNow) + "</h2>"); %> <h2><%=ft.format(dNow) %></h2> <h2><%=new SimpleDateFormat("yy-MM-dd HH:mm:ss E").format(new Date()) %></h2>
2. 将类写成符合javaBean规范的类,然后通过java<jsp:Usebean></jsp:Usebean>
参见: javaBean应用说明实例