« | August 2025 | » | 日 | 一 | 二 | 三 | 四 | 五 | 六 | | | | | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | | | | | | | |
| 公告 |
戒除浮躁,读好书,交益友 |
Blog信息 |
blog名称:邢红瑞的blog 日志总数:523 评论数量:1142 留言数量:0 访问次数:9691522 建立时间:2004年12月20日 |

| |
[j2ee]使用spring的mail发送带有图片的html的邮件 原创空间, 软件技术
邢红瑞 发表于 2005/10/1 15:36:20 |
有的朋友问我如何发送带有图片的html的邮件,其实这很简单,只要加入contentID就行 下面是实现类 package com.educast.mail;
import org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.context.ApplicationContext; import org.springframework.context.support.FileSystemXmlApplicationContext; import org.springframework.core.io.FileSystemResource;
import javax.mail.internet.MimeMessage; import javax.mail.MessagingException; import java.io.File;
public class ImageMailSender |
|
[j2ee]spring的mail如何发送html格式的邮件 原创空间, 软件技术
邢红瑞 发表于 2005/9/30 19:40:41 |
发送html格式邮件很简单,下面给出个例子 先是一个抽象的基类 package com.educast.mail;
import org.springframework.mail.javamail.JavaMailSender;
/** * @author mfc42d * */ public abstract class BaseMailSender {
protected String to; protected String from; protected String subject; protected JavaMailSender sender;
public void setTo(String to) { this.to = to; }
public voi |
|
[j2ee]解决spring中文件上传的问题 原创空间, 软件技术
邢红瑞 发表于 2005/9/13 19:19:50 |
唉,又要加班,这种加班没有加班费,不计入倒休,连晚餐补助都没有.主要是解决spring上传文件的问题,因为使用了apache的commons fileupload包,以前用的时候就发现这个问题,他没有文件重名的处理(no FileRenamePolicy),所以不得不使用cos.
spring使用cos包后问题接踵而至,先是ClassCastException,这个好解决,以后又是Corrupt form data: premature ending,终于不知道如何解决了,google半天,没有找到一个可用的例子. 只好问ben alex这位高手,ben也发现这个问题,so you are uploading two files with the same name?or do you mean on the server-side, if someone uploads a file which is the same name as an existing file on the server?
|
|
[j2ee]spring如何在一个jsp中使用两个command对象 原创空间, 软件技术
邢红瑞 发表于 2005/9/12 9:06:48 |
有个巴西的网友,提出了这个问题,如何在一个jsp中使用两个command对象,并提交到两个不同的controller, 我给个例子,这个例子是别人的,我进行了修改 -servlet.xml文件 <bean name="inputaform " class="ee.bug.InputaFormController"> <property name="commandClass"><value>ee.bug.Input3Bean</value></property> <property name="formView"><value>inputa</value></property> <property name="successView"><value>resulta</value></property&g |
|
[j2ee]pebble从tomcat移植到resin 原创空间, 软件技术
邢红瑞 发表于 2005/9/4 15:33:42 |
说实话,pebble是个不错的blog,比我原来的那个好多了.好不容易找到一个免费的resin服务器,当然是蹭的. 移植遇到了不少麻烦,先说tomcat下的安装 1.下载pebble,这是废话 2.从pebble-weblog目录中copy pebble.war到$TOMCAT_HOME/webapps 3.在$TOMCAT_HOME/conf/tomcat-users.xml 文件中加入以下文字 <user username="someuser" password="password" roles="blog-owner,blog-contributor"/> 4.重起tomcat,输入http://localhost:8080/pebble/就可以访问,点击右下角login就可以登录. resin麻烦一些,找了半天资料,才知道resin中servlet容器role的写法,
|
|
[j2ee]Struts加载spring的问题 原创空间, 软件技术
邢红瑞 发表于 2005/8/5 8:41:29 |
前几天不是一个同事使用OpenSessionInView pattern时,遇到Hibernate 3的mappinglazy="true"的问题,也不会想到它 struts启动spring的WebApplicationContext spring有三种启动方式,使用ContextLoaderServlet,ContextLoaderListener和ContextLoaderPlugIn. 看一下ContextLoaderListener的源码,这是一个ServletContextListener /** * Initialize the root web application context. */ public void contextInitialized(ServletContextEvent event) { this.contextLoader = createContextLoader(); this.contextL |
|
[j2ee]sqlserver的jdbc驱动的SelectMethod=Cursor打开了服务器游标 原创空间, 软件技术
邢红瑞 发表于 2005/8/4 10:41:03 |
这是个老话题,2002年在使用ejb的bmp就遇到了这个问题 连接数据库成功之后,想在一个事务中初始化多个预处理句柄时报错 dbConn.setAutoCommit(false) for (int i = 0; i < 5; i++) { pstmt[i] = dbConn.prepareStatement(strPreSQL[i]); 错误提示: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Can't start manual transaction mode because there are cloned connections
怀疑MS SQL不能在一个事务中建多个预处理句柄 Resolution: You have to add a property to the pool definition, something to do with selectMode=cursor or selectMe |
|
[j2ee]捕获上一页面或调用页面的方法 原创空间, 软件技术
邢红瑞 发表于 2005/7/28 17:06:10 |
在JSP中获取上一页面或调用页面,一共3种情况
1. 从href过来的,那么从request.getHeader("Referer")就可以得知从哪个地址打开的这个页面,这个应该是最常见的
2. 使用window.open方法的,需要使用JavaScript来获取window.parent.document.URL 3. 使用window.showM
(下面还有290字) |
|
|