ireportÔÚjspÖеĵ÷ÓÃÀý×Ó
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%@ page import="java.io.*,java.sql.*,net.sf.jasperreports.engine.*" %>
<%@ page import="com.microsoft.sqlserver.jdbc.SQLServerDriver" %>
<%@ include file="/common/header.jsp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>±¨±í´òÓ¡</title>
<link rel="stylesheet" type="text/css" href="<s:property value="%{default_css}"/>" />
</head>
<body id="Body">
<%
String reportName = request.getParameter("reportName");
//±¨±í±àÒëÖ®ºóµÄ.jasperÎļþµÄ´æ·ÅλÖÃ
File reportFile = new File(application.getRealPath("/report/resource/jasper/"+reportName+".jasper"));
String url = "jdbc:sqlserver://liubin:1433;DatabaseName=db_forest_police";
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();
//´«µÝ±¨±íÖÐÓõ½µÄ²ÎÊýÖµ£¬ÕâÀïÊÇ¿ÕÖµ
Map parameters = new HashMap();
System.out.println("-----------conn---------");
//Á¬½Óµ½Êý¾Ý¿â
Connection conn = DriverManager.getConnection(url,"sa","time0442");
System.out.println("----------jasper begin-----------");
//ÔÚ¿ØÖÆ̨´òÓ¡±¨±íÎļþµÄÎïÀí·¾¶
System.out.println("****ÎïÀí·¾¶ ***"+reportFile.getPath());
&nb
Ïà¹ØÎĵµ£º
ÅäÖóÌÐòµÄÔËÐÐĿ¼ÓëJDBCÊý¾ÝÔ´:
<Context path="/test" docBase="F:\JSPLesson\test" reloadable="true">
<Resource name="jdbc/bookstore" auth="Container" type="javax.sql.DataSource"
maxActive="1 ......
ºÍJavaÒ»Ñù£¬JSPÊÇÄ¿Ç°±È½ÏÈÈÃŵÄÒ»¸ö»°Ìâ¡£ËüÊÇÒ»ÖÖÔÚ·þÎñÆ÷¶Ë±àÒëÖ´ÐеÄWebÉè¼ÆÓïÑÔ£¬ÒòΪ½Å±¾ÓïÑÔ²ÉÓÃÁËJava£¬ËùÒÔJSP¼Ì³ÐÁËJavaµÄËùÓÐÓŵ㡣¿ÉÊÇÔÚʹÓÃJSP³ÌÐòµÄ¹ý³ÌÖУ¬³£Óöµ½ÖÐÎÄÂÒÂëÎÊÌ⣬ºÜ¶àÈËΪ´ËÍ·ÌÛ²»ÒÑ£¬±ÊÕß¾ÍÉîÊÜÆ亦£¬¶øÇÒʹÓÃƽ̨²»Í¬£¬ÖÐÎÄÂÒÂëÎÊÌâµÄ½â¾ö·½·¨Ò²²»Í¬£¬ÎÞÐÎÖÐÔö¼ÓÁËѧϰJSPµÄÄѶȡ£Æäʵ£¬Ô ......
ÔÀí²»ËµÁË,ÍøÉÏÓкܶà,¶¼¿ÉÒÔ×Ô¼º²éµ½,ÖÁÓÚΪʲô»á³öÏÖÂÒÂë,ÊÇÒòΪJAVAÓÐʹÓùú¼Ê»¯,Óöµ½ÖÐÎÄʱ.....
ÏÂÃæ¸ø³öһЩ¼òµ¥µÄʵÓôúÂë,Ö»¹©²Î¿¼:
public class ChangeUtf8 {
public static String getS(String Str){
try{
......
Jsp ELÓï·¨
Àý£º
${sessionScope.user.sex}
ËùÓÐEL¶¼ÊÇÒÔ ${ ΪÆðʼ¡¢ÒÔ} Ϊ½áβµÄ¡£
ÉÏÊöEL·¶ÀýµÄÒâ˼ÊÇ£º´ÓSessionÈ¡µÃÓû§µÄÐÔ±ð¡£Èç¹ûʹÓÃ֮ǰJSP´úÂëµÄд·¨ÈçÏ£º
<%
User user = (User)session.getAttribute(”user”);
String sex = user.getSex( );
%>
Á½ÕßÏà±È½Ï֮ϣ¬¿ÉÒÔ·¢ÏÖELµÄÓï·¨± ......
JSP ÈçºÎʵÏÖÍøÒ³¶¨Ê±Ìøת:
<script language="javascript">
<!--
setTimeout("document.location.href='http://www.163.com'",3000);
//-->
</script>
ˢУº
<meta http-equiv="Refresh" content ......