struts2多图片上传实例



struts2多图片上传实例.

描述:
通过struts2实现多图片上传。
我使用的版本是2.2.1,使用的包有如下几个:

具体实现:
1. 创建上传图片的页面
fileUpload.jsp

[java] view plaincopy
<%@ page language=”java” import=”java.util.*” pageEncoding=”UTF-8″%>

<%@ taglib prefix=”s” uri=”/struts-tags” %>

<%

String path = request.getCon[......]

Read more

struts2+hibernate+poi导出Excel实例



struts2+hibernate+poi导出Excel实例.

实例通过struts2+hibernate+poi实现导出数据导入到Excel的功能

 

用到的jar包:

 

 

 

poi 下载地址:http://poi.apache.org/

根据查询条件的选择显示相应数据到页面,并把数据可导入到Excel表中
首先根据查询条件显示数据
选择导出Excel将根据查询条件返回数据并通过流写入Excel文件中,核心代码如下:

[java] view plaincopy
<%@ page l[......]

Read more

Struts2自定义拦截器实例判断登陆权限验证

Struts2自定义拦截器实例判断登陆权限验证.

版本:struts2.1.6

此实例实现功能:用户需要指定用户名登陆,登陆成功进入相应页面执行操作,否则返回到登陆页面进行登陆,当直接访问操作页面(登陆后才能访问的页面)时则不允许,须返回登陆页面。

代码如下:

一、页面

login.jsp

[xhtml] view plaincopy
<%@ page language=”java” import=”java.util.*” pageEncoding=”UTF-8″%>

<!DOCTYPE HTML PUBLIC “-//W3C//[......]

Read more

配置hibernate根据实体类自动建表功能

配置hibernate根据实体类自动建表功能.

Hibernate支持自动建表,在开发阶段很方便,可以保证hbm与数据库表结构的自动同步。

如何使用呢?很简单,只要在hibernate.cfg.xml里加上如下代码

Xml代码<property name=”hbm2ddl.auto”>update</property>  

 

update:表示自动根据model对象来更新表结构,启动hibernate时会自动检查数据库,如果缺少表,则自动建表;如果表里缺少列,则自动添加列。

还有其他的参数:
create:启动hibernate时[......]

Read more

Hibernate 4不能自动建表解决办法

Hibernate不能自动建表解决办法.

最近开始学Hibernate,看的是李刚的那本《轻量级java ee企业应用实战》。头一个hibernate程序,我原原本本的按照书上例子写下来,同时只是改动了些mysql的连接参数,并且在mysql中新建了一个hibernate数据库,仅此而已。然而预想不到的事情发生了……程序写好之后,运行,报错

Hibernate: insert into news_table (title, content) values (?, ?)
Exception in thread “main” org.hibernate.exception.SQLGr[......]

Read more

tomcat部署项目时出错(Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardC)

tomcat部署项目时出错(Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardC)

构建了一个maven项目,tomcat发布的时候报错:

 

SEVERE: ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].St[......]

Read more

sun.misc.BASE64Encoder找不到jar包的解决方法

sun.misc.BASE64Encoder找不到jar包的解决方法

1.右键项目-》属性-》java bulid path-》jre System Library-》access rules-》resolution选择accessible,下面填上** 点击确定即可!!!

2.

在MyEclipse中编写Java代码时,用到了BASE64Decoder,import sun.misc.BASE64Decoder;可是Eclipse提示:
Access restriction: The type BASE64Decoder is not accessible due to re[......]

Read more

Struts2.3.1.2+Spring3.3.1+Hibernate4.1.1_配置步骤教程

Struts2.3.1.2+Spring3.3.1+Hibernate4.1.1_配置步骤.

一. 搭建struts-2.3.1.2

1.Jar包:

Struts2.3.1.2+Spring3.3.1+Hibernate4.1.1_配置步骤

2.配置struts2.3的过滤器,web.xml位置

Struts2.3.1.2+Spring3.3.1+Hibernate4.1.1_配置步骤

3.web.xml

<?xml version=“1.0″ encoding=“UTF-8″?>

<web-app id=“WebApp_ID” version=“3.0″

xmlns=“http://java.sun.com/xml/ns/javaee”

xmlns:xsi=“http://www.w3.org/2001/X[......]

Read more

Server Report was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor.

错误 Server Tomcat v6.0 Server at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor. 修改 workspace\.metadata\.plugins\org.eclipse.wst.server.core\servers.xml文件。 <servers> <server hostname=”localhost” id=”JBoss v5.[......]

Read more