jsp使用组件进行文件上传
WEB文件上传可能是网站建设中最常用的功能之一,我在项目开发中几乎都需要实现文件上传功能.前段时间自己搜集了一些上传组件.这篇文章中将介绍这些组件的使用方法,并且比较各自的优劣.
一,smartupload组件.
我想只要做个文件上传的朋友都知道这个组件,我认识的人中使用最多的也是它!我刚到公司的时候,公司也使用的smartupload,这个组件上传相对较小的文件时是个不错的选择.下面给出个使用的例子:
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<%@ page import="com.jspsmart.upload.*" %>
<%
//实例化上载bean
SmartUpload mySmartUpload=new SmartUpload();
//初始化
mySmartUpload.initialize(pageContext);
//设置上载的最大值,注意:如果这里设置过大会出现问题!
mySmartUpload.setMaxFileSize(500 * 1024*1024);
//上载文件
mySmartUpload.upload();
//循环取得所有上载的文件 ......
FCKeditor jsp 配置 使用
2009-04-07 16:57
FCKeditor是一款跨平台的在线编辑器,到我发布本文,FCKeditor的官方版本已经发展到了2.6.4
点击进入 官网
1、首先登陆www.fckeditor.net/download下载FCKeditor的最新版本,需要下载2个压缩包,一个是基本应用,另一个是在为在jsp下所准备的配置。
FCKeditor 2.6 Beta 下载地址:sourceforge.net/project/downloading.php
FCKeditor.Java 下载地址:http://sourceforge.net/project/showfiles.php?group_id=75348&package_id=129511&release_id=348486
下载之后分别为:FCKeditor_2.6b.zip 和 FCKeditor-2.3.zip 将它们分别解压。
2、首先在Tomcat下建立一个虚拟目录例如:test 即http://localhost:8080/test
将解压后的FCKeditor_2.6b文件夹下的fckeditor拷贝到test目录下,并重新命名为FCKeditor。
将解压后的FCKeditor-2.3文件夹下的web下的WEB-INF拷贝到test目录下。
将FCKeditor-2.3文件夹下src下的FCKeditor.tld拷贝到 ......
建立条件首先一定要确定自己的mysql,tomcat,eclipse连接是正确的。
index.jsp很简单,就一个跳转。
<%
response.sendRedirect("lg.jsp");
%>
lg.jsp 实现登录框架
<%@ page contentType="text/html; charset=utf-8" %>
<html>
<head>
<title>
login
</title>
</head>
<center>
Prease input UserName and Pssword!!
</center>
<body bgcolor="#ffffff">
<%String flag=request.getParameter("flag");
if(flag!=null&&flag.equals("0")){
out.println("Pls input valid username and password!<br><br>");
}
%>
<form name="form1" method="post" action="login.jsp">
<center>
<input name="UserName" type="text" ><br/>
<input name="Password" type="password"><br/>
<input name="submit" type="submit" value="submit">
<input name="reset" type="reset" value="reset">
</center>
</form>
</body>
</html>
login.jsp 文件
<%@ page contentType="tex ......
建立条件首先一定要确定自己的mysql,tomcat,eclipse连接是正确的。
index.jsp很简单,就一个跳转。
<%
response.sendRedirect("lg.jsp");
%>
lg.jsp 实现登录框架
<%@ page contentType="text/html; charset=utf-8" %>
<html>
<head>
<title>
login
</title>
</head>
<center>
Prease input UserName and Pssword!!
</center>
<body bgcolor="#ffffff">
<%String flag=request.getParameter("flag");
if(flag!=null&&flag.equals("0")){
out.println("Pls input valid username and password!<br><br>");
}
%>
<form name="form1" method="post" action="login.jsp">
<center>
<input name="UserName" type="text" ><br/>
<input name="Password" type="password"><br/>
<input name="submit" type="submit" value="submit">
<input name="reset" type="reset" value="reset">
</center>
</form>
</body>
</html>
login.jsp 文件
<%@ page contentType="tex ......
因为是跟着视频学习的,有很多用的东西不一样,但是还是慢慢的摸索出来啦!
1.Microsoft JDBC Driver 的下载安装
只要在网上找到资源一步步来就可以了。
2.配置环境变量
我用的是tomcat6.0首先配的是
classpath和path,这些都是在配jdk的时候就配过了,所以就不详细说明了,只要将lib和bin文件加入到相关的路径下就可以了。
另外的一个问题就是可能会出现Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program
一个这样的问题,这是因为现在的jdk版本不会自动的加载这两个东西了,解决办法:
只要在setclasspath中如下设置就可以了
rem ---------------------------------------------------------------------------
rem Set CLASSPATH and Java options
rem
rem $Id: setclasspath.bat 505241 2007-02-09 10:22:58Z jfclere $
rem ---------------------------------------------------------------------------
set JAVA_HOME=D:\Java\jdk1.6.0_11
set JRE_HOME=D:\Java\jre6
rem Make sure prerequisite environment variab ......
方法一、
login.html
<html>
<head>
<title>用户登录</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
</head>
<script language="javascript">
function check(){
if (document.all.userName.value == ""){
alert("对不起,登录帐号不能为空!");
return false;
}
if (document.all.userPWD.value == ""){
&nb ......
我的系统使用acegi登录认证,并且配置用户缓存
<!-- 缓存器,为userCacheBackend提供缓存管理。 -->
<bean id="cacheManager"
class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" />
<!-- EhCache一般用途如下:Hibernate缓存,DAO缓存,安全性凭证缓存(Acegi),Web缓存,应用持久化和分布式缓存。 -->
<bean id="userCacheBackend"
class="org.springframework.cache.ehcache.EhCacheFactoryBean">
<property name="cacheManager">
<ref local="cacheManager" />
</property>
<property name="cacheName">
<value>userCache</value>
</property>
</bean>
<!-- 用户缓存器,为daoAuthenticationProvider认证器提供缓存管理。 -->
<bean id="userCache"
class="org.springframework.security.providers.dao.cache.EhCacheBasedUserCache">
<property name="cache" ......