易截截图软件、单文件、免安装、纯绿色、仅160KB
热门标签: c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 最新文章 :

JSP中可能会碰到的问题解答

JSP中可能会碰到的问题解答
来源:不详 作者:佚名 更新时间: 2009年07月02日 点击:
JSP中可能会碰到的问题解答 
1、如何混合使用Jsp和SSI #include?
在JSP中可以使用如下方式包含纯HTML:
< !--#include file="data.inc"-- >
但是如果data.inc中包含JSP CODE ,我们可以使用:
< %@include file="data.inc"% >
2、如何执行一个线程安全的JSP?
只需增加如下指令
< %@ page isThreadSafe="false" % >
3、JSP如何处理HTML FORM中的数据?
通过内置的request对象即可,如下:
< %
String item = request.getParameter("item");
int howMany = new Integer(request.getParameter("units")).intvalue();
% >
4、在JSP如何包含一个静态文件?
静态包含如下:< %@ include file="copyright.html" % >
动态包含如下:< jsp:include page="copyright.html" flush="true"/ >
5、在JSP中如何使用注释?
主要有四中方法:
1。< %-- 与 --% >
2。//
3。/**与**/
4。< !--与-- >
6、在JSP中如何执行浏览重定向?
使用如下方式即可:response.sendRedirect("http://ybwen.home.chinare ......

仿百度ajax搜索提示(jsp)

<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>index</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
  <style type="text/css">
  body{
   font-size:0.75em;
   border:0;
   margin:250px 0 0 0;
   padding:0;
   }
  #content{
   width:450px;
   margin:auto;}
  
  #key{
   width:30 ......

仿百度ajax搜索提示(jsp)

<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>index</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
  <style type="text/css">
  body{
   font-size:0.75em;
   border:0;
   margin:250px 0 0 0;
   padding:0;
   }
  #content{
   width:450px;
   margin:auto;}
  
  #key{
   width:30 ......

JSP数据库连接疑问(Mysql)

package com.wxpn.tutorial.db;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.Statement;
import java.util.Date;
/**
 * 描述: 数据库连接池类
 * 
 * 
 * @version 1.0
 */
public class ConnectionPool implements Runnable {
 private boolean _debug = false;
 private Thread runner;
 private Connection[] connPool;
 private int[] connStatus; // (0) available; (1) locked by the client; (2)
 // locked by the housekeeping thread
 private long[] connLockTime;
 private long[] connCreateTime;
 private String[] connID;
 private String dbdriver, dbserver, dbuser, dbpassword;
 private int currConnections, connLast, minconns, maxconns, maxconnMSec;
 // available: set to false on destroy, checked by getConnection()
 private boolean available = true;
 private SQLWarning c ......

JSP数据库连接疑问(Mysql)

package com.wxpn.tutorial.db;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.Statement;
import java.util.Date;
/**
 * 描述: 数据库连接池类
 * 
 * 
 * @version 1.0
 */
public class ConnectionPool implements Runnable {
 private boolean _debug = false;
 private Thread runner;
 private Connection[] connPool;
 private int[] connStatus; // (0) available; (1) locked by the client; (2)
 // locked by the housekeeping thread
 private long[] connLockTime;
 private long[] connCreateTime;
 private String[] connID;
 private String dbdriver, dbserver, dbuser, dbpassword;
 private int currConnections, connLast, minconns, maxconns, maxconnMSec;
 // available: set to false on destroy, checked by getConnection()
 private boolean available = true;
 private SQLWarning c ......

jsp生成html静态页面代码

<%@ page contentType="text/html;charset=GBK"%>
<%@page import="java.util.*"%>
<%@page import="java.io.*" %>
<%
//在这里如果写成“WEB-INF\templates\template.htm”程序会报错
 String filePath = request.getRealPath("/")+"WEB-INF/templates/template.htm";    
 out.print(filePath);
 String templateContent="";
 FileInputStream fileinputstream = new FileInputStream(filePath);//读取模块文件
 //int lenght = fileinputstream.available();
 byte bytes[] = new byte[1024];
 fileinputstream.read(bytes);
 fileinputstream.close();
 templateContent = new String(bytes);
 out.print("以下是模板内容:<br>"+templateContent+"<br> 以下是置换以后的html内容<br><hr>");
 templateContent=templateContent.replaceAll("#title#","文章标题");
 templateContent=templateContent.replaceAll("#author#","作者是谁");//替换掉模块中相应的地方
 templateContent=templateContent.rep ......

jsp生成html静态页面代码

<%@ page contentType="text/html;charset=GBK"%>
<%@page import="java.util.*"%>
<%@page import="java.io.*" %>
<%
//在这里如果写成“WEB-INF\templates\template.htm”程序会报错
 String filePath = request.getRealPath("/")+"WEB-INF/templates/template.htm";    
 out.print(filePath);
 String templateContent="";
 FileInputStream fileinputstream = new FileInputStream(filePath);//读取模块文件
 //int lenght = fileinputstream.available();
 byte bytes[] = new byte[1024];
 fileinputstream.read(bytes);
 fileinputstream.close();
 templateContent = new String(bytes);
 out.print("以下是模板内容:<br>"+templateContent+"<br> 以下是置换以后的html内容<br><hr>");
 templateContent=templateContent.replaceAll("#title#","文章标题");
 templateContent=templateContent.replaceAll("#author#","作者是谁");//替换掉模块中相应的地方
 templateContent=templateContent.rep ......

JAVA学习计划3


第一阶段:JAVA基础增强/Oracle+MySql数据库+JDBC开发技术+DAO封装
核心技术课程
java基础加强:增强for循环、可变参数、枚举、反射、内省、beanutils工具、注解、泛型、类加载、代理、装箱/拆箱、静态引用等Java新技术和高级技术。
Oracle和MySql数据库:Oracle和MySql数据库基础管理、SQL 语言、PL/SQL语言、数据库设计范式;数据备份与移植;触发器、存储过程;数据检索技巧,视图,触发器,函数,存储过程,游标等技术的使用。大对象的读写技巧,数据优化技巧,分区与索引。MySql数据库,常见问题分析与设计。
JDBC开发技术:JDBC Connection、Statement、PreparedStatement、CallableStatement、ResultSet、Scrollable RS、Updatable RS、RowSet and DataSource、数据库连接池、JDBC Template、ORM思想与DAO封装等。
第二阶段:JavaWEB+JavaMail开发技术+项目案例
核心技术课程
JavaWEB开发核心基础:XML的概念与基本作用、XML的基本语法、XML的约束模式、DTD、XML Schema、名称空间。WEB服务器的工作原理、Tomcat的安装与启动运行、Tomcat的体系结构、在Tomcat中配置WEB虚拟目录与发布WEB应用程序的各种方式、设置目录的默认网页、使用Tomcat配置虚拟主机。 H ......

Java String 字符串处理疑点再解

华仔在网上阅过诸多关于String的文章,仍是有疑在心中不解,遂寻Jack求惑。
Jack道:何惑不解?拿与我面前便可。
华仔手于心,却拿不出String这玩意...Jack貌如大师一叹,将String呈于他面前。
“String中文名为'字符串',如此而已;身之血液,能量之载体。”
1、简述String与StringBuffer的异同。
     一个是非可变对象,另一个是可变对象,StringBuffer于内存堆,并由来自常量池的String任意拼装,无论何时何地。
2、String与char[]、byte[]的联系,如何转换。
    String testStr = "test中";
    char[] c = testStr.toCharArray();        //注:char为16位‘中’可以存放,此转换是安全的.
    byte[] b=testStr.getBytes();              //注:byte位8位,此转换存在潜在威胁.
    String是为char组成的串,byte则为该串的ASCII码.
3、详细说明以下语句在JVM中的处理过程。
    1.StringBuffer str=new StringBuffer(“TES ......
总记录数:40319; 总页数:6720; 每页6 条; 首页 上一页 [282] [283] [284] [285] 286 [287] [288] [289] [290] [291]  下一页 尾页
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号