易截截图软件、单文件、免安装、纯绿色、仅160KB

5月19日 JSP基础

1.ession内的存放的是对象的引用,所以修改内置对象后,不需要重新放置到session中
2.配置Context初始化参数
<Context-param>
<param-name></paran-name>
<param-value></param-value>
<Context-param>
this.getServletContext().getInitParameter(arg0);
-----------------------------------------------------------------------------------------------------------------
3.配置servlet初始化参数
<init-param>
   <param-name></param-name>
   <param-value></param-value>
</inti-param>
ServletConfig config=this.getServletConfig();
config.getParameter(""); 
-----------------------------------------------------------------------------------------------------------------
4配置文件 properties
格式: key=value  其中key不变 value是变化的
例如: #其中"#"为注释
   文件 db.properties
    username=秦焰培
    password=peiaihua 
最好放置到/WEB-INF/db.properties  
 读取属性文件的信息:
 /在web应用中,getServletContext().getRealPath表示的
 是web工程的根路径,
 如:"C:\Program Files\apache-tomcat-6.0.18\webapps\TestURL"
 
 String path=this.getServletContext().getRealPath("");
 FileImputSream fi=new FileInputStream(path);
 Properties pro=new Properties();
 pro.load(fi);
 pro.getProperty("key");
 
 String realPath=this.getServletContext().getResourceAsStream("/WEB-INF/db.properties")
 表示的也是从根路径开始加载文件:
 -----------------------------------------------------------------------------------------------------------------
 <!--  该标签表示服务器启动时,自动创建servlet对象,而且数字越先优先级越高-->
 <Load-on-startup>0,1,2,3,....</Load-on-srartup>
 -----------------------------------------------------------------------------------------------------------------
 servlet通信(communicate):
  路径设置:
&n


相关文档:

JSP中输出CSV文件

<%@page import="com.opensymphony.xwork2.util.ValueStack"%><%
    ValueStack vs = (ValueStack)request.getAttribute("struts.valueStack");  
    String aa = (String)vs.findValue("downloadContent");
    response. ......

JSP 绝对路径 终极解决方案

context.xml 文件夹中
<Context path="/wap"
docBase="D:\IDE\MyEclipse\wap\WebRoot" reloadable="false" >
request.getContextPath(); -==> /wap
this.getServletContext().getRealPath("") ;// D:\IDE\MyEclipse\wap\WebRoot
......

jsp中以服务器时间作为起始,显示时钟的小程序

一般的网页都有这种功能:在页面上动态显示当前时间,这个的实现也很简单,基本上一行代码就实现了
<span id="curTime"></span>
<script type="text/javascript"><!--
setInterval("curTime.innerHTML=new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay());",1000 ......

一段可以运行的xhtml的jsp代码

<?xml version="1.0" encoding="UTF-8"?>
<%@ page contentType="text/html; charset=UTF-8" language="java" import="java.sql.*" errorPage="" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+pat ......

Jsp WEB系统登录与域控

面的上便会弹出域控验证的
各位,上次在群中问到关于Jsp WEB系统登录与域控结合做用户验证的问题,现在已经解决,将解决办法与各位分享下:
解决方案:使用samba组织的开源项目jCIFS
项目首页:http://jcifs.samba.org/
参考资料:
使用jcifs.jar可以非常好实现,下载一个最新的jcifs.jar,放到WEB-INFlib下面,然后修改 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号