`
floger
  • 浏览: 213823 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

struts2+spring发送mail

阅读更多

spring中有集成了javamail,在使用框架的时候用spring来发送mail也是很方便的。下面是一个spring mail的小例子。

  在这个例子中,除了需要struts和spring的框架外,还需要mail.jar,activation.jar.

  web.xml的代码:

  <?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
 xmlns="http://java.sun.com/xml/ns/j2ee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
 <context-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>classpath*:spring/*.xml</param-value>
 </context-param>

 <listener>
  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
 </listener>
    <!-- Spring refresh Introspector to prevent from out of memory  -->
 <listener>
  <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
 </listener>
 <!-- Support session scope, Spring bean -->
 <listener>                                                       
      <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
 </listener>
 <!-- Struts2 Action Mapping-->
 <filter>
        <filter-name>struts2</filter-name>
        <filter-class>
            org.apache.struts2.dispatcher.FilterDispatcher
        </filter-class>
    </filter>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
   <!-- session time out -->
 <session-config>
  <session-timeout>30</session-timeout>
 </session-config>
 <!-- default index -->
 <welcome-file-list>
  <welcome-file>send.jsp</welcome-file>
 </welcome-file-list>
</web-app>
Java类MailAction.java:

package action;

import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSenderImpl;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;
public class MailAction extends ActionSupport{
 private JavaMailSenderImpl mailSender;
 private SimpleMailMessage mailMessage;
  public String sendMail(){
  SimpleMailMessage msg = new SimpleMailMessage(mailMessage);
        msg.setText("Spring Mail Simple!");
        mailSender.send(msg);
        return Action.SUCCESS;
 }
  public void setMailMessage(SimpleMailMessage mailMessage) {
  this.mailMessage = mailMessage;
 }

 public void setMailSender(JavaMailSenderImpl mailSender) {
  this.mailSender = mailSender;
 }

}
spring配置文件applicationContext.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"
    default-autowire="byName" default-lazy-init="true">

 <bean id="mailAction" class="action.MailAction">
  <property name="mailSender" ref="mailSender"/>
  <property name="mailMessage" ref="mailMessage"/>
 </bean>
 
 <bean id="mailSender"
          class="org.springframework.mail.javamail.JavaMailSenderImpl">
        <property name="host" value="smtp.163.com"/>
            <!-- mail  account   -->
        <property name="username" value="shwwwx"/>
        <property name="password" value="wwx1226"/>
        <property name="javaMailProperties">
            <props>
                <prop key="mail.smtp.auth">true</prop>
            </props>
        </property>
    </bean>
      <!-- mail template -->
    <bean id="mailMessage" class="org.springframework.mail.SimpleMailMessage">
        <property name="to" value="shwwwx@163.com,nabelun@163.com"/>
        <property name="from" value="shwwwx@163.com"/>
        <property name="subject" value="Mail Simple"/>
    </bean>
</beans>

struts2的配置文件struts.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
    <constant name="struts.objectFactory" value="spring" />
    <constant name="struts.devMode" value="false" />
    <constant name="struts.i18n.encoding" value="utf-8" />
    <package name="springtimer"   extends="struts-default">
       <action name="mailsend" class="mailAction" method="sendMail">
        <result>sendok.jsp</result>
        <interceptor-ref name="defaultStack"/>
       </action>
    </package>
</struts>
页面send.jsp:

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<html>
  <head>
    <title>My JSP 'send.jsp' starting page</title>
  </head>
  <body>
 <form action="mailsend.action" method="post">
  <input type="submit" value="邮件发送">
 </form>
  </body>
</html>

页面sendok.jsp:

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'sendok.jsp' starting page</title>
  </head>
  <body>
    Send Mail Success! <br>
  </body>
</html>
运行send.jsp发送邮件,成功的话会跳转到sendok.jsp页面。spring中有集成了javamail,在使用框架的时候用spring来发送mail也是很方便的。下面是一个spring mail的小例子。

 

分享到:
评论
3 楼 liweixxxx1990 2012-04-25  
spring本版是3.0的(和版本也有关系吗?) 配置用到了spring.jar、mail.jar、activation.jar、struts2-spring-pligin-2.0.11.2.jar  这个配置有什么需要特别注意的吗   因为我没学过spring不太懂
2 楼 floger 2012-04-24  
liweixxxx1990 写道
我照着你这个写的出现了下面的错误,怎么解决啊??:

Messages:   The 'original' message argument cannot be null
File:     org/springframework/util/Assert.java
Line number: 112

Stacktraces

java.lang.IllegalArgumentException: The 'original' message argument cannot be null
    org.springframework.util.Assert.notNull(Assert.java:112)
    org.springframework.mail.SimpleMailMessage.(SimpleMailMessage.java:73)
    pianostudio.struts2.action.MailAction.sendMail(MailAction.java:16)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)
    com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)
    com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)
    org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
    org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)
    org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    java.lang.Thread.run(Thread.java:619)


你看看你的配置确定没有错误吗?有空值传递了,你用的spring是几呢?就是版本!
1 楼 liweixxxx1990 2012-04-24  
我照着你这个写的出现了下面的错误,怎么解决啊??:

Messages:   The 'original' message argument cannot be null
File:     org/springframework/util/Assert.java
Line number: 112

Stacktraces

java.lang.IllegalArgumentException: The 'original' message argument cannot be null
    org.springframework.util.Assert.notNull(Assert.java:112)
    org.springframework.mail.SimpleMailMessage.(SimpleMailMessage.java:73)
    pianostudio.struts2.action.MailAction.sendMail(MailAction.java:16)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)
    com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)
    com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)
    org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
    org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)
    org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    java.lang.Thread.run(Thread.java:619)

相关推荐

    struts2+spring+hibernate 做的图书管理系统

    内涵数据库设计模型 和数据库设计代码! 图书管理系统: ... 里面的发送e-mail我用的是一个我申请的邮箱在测试 可以用自己的! 代码功能基本都有注释.能看懂.. 才学完s2sh的入门笔记吧! 供学习使用........

    struts2+spring3.0+mybatis3.0.4集成的邮件发送实例(可上传附件)

    总之,这个实例结合了Struts2、Spring和Mybatis的强大功能,提供了一个完整的邮件发送系统,包括邮件的创建、附件上传和数据库操作。对这个实例的学习和实践,可以帮助开发者深入理解Java企业级应用的开发流程和技巧...

    基于Struts+Spring+Hibernate+MySQL+Tomcat的中小企业办公自动化系统(源程序+开题报告+论文)

    基于Struts+Spring+Hibernate+MySQL+Tomcat的中小企业办公自动化系统(源程序+开题报告+论文) 系统的主要功能概述如下: (1) 用户身份验证模块 本系统功能的开发与设计,是完全针对公司内部进行办公管理...

    基于spring+struts2+web的宠物管理系统源码

    其任务是查看用户订单,查看用户信息,并在根据查看了用户的信息和用户订单之后,将商品的发送到购买者的身边。 (4)宠物浏览 a). 宠物名 b).宠物类型 c). 价格 d). 订购号 通过分析,系统主要分为前台和后台两大...

    struts spring 实现简单的邮件发送

    通过学习和理解这个项目,开发者可以了解如何在实际项目中整合Struts2和Spring进行邮件发送,为自己的应用添加类似功能。由于没有具体的代码示例,这里只提供了实现思路和步骤,具体实现细节还需要参考项目中的源...

    struts2发送Email

    本篇文章将详细探讨如何在Struts2框架中实现自动发送电子邮件的功能。 首先,我们需要了解JavaMail API,这是Java中用于处理邮件的核心库。在Struts2项目中,我们需要引入JavaMail相关的依赖,如`javax.mail`和`...

    Struts2核心jar包(2)

    4. **mail.jar**:这是一个JavaMail API的实现,允许开发者在Java应用中发送电子邮件。虽然不是Struts2的直接部分,但在需要邮件通知的场景下,它是必不可少的。 5. **mysql-connector-java-3.1.10-bin.jar**:这是...

    spring发送邮件

    在描述中提到的`MailAction.java`中,你可以看到一个`MailAction`类,它是基于Struts2的Action,但是核心的邮件发送逻辑是基于Spring的。下面是一个简单的Spring邮件发送示例: ```java import org.springframework...

    struts,spring,hibernate.jar 包大全(五)

    - mail.jar:提供JavaMail API,用于发送和接收电子邮件。 - json-lib-2.2.3-jdk15.jar:一个JSON库,用于解析和生成JSON格式的数据。 - openamf.jar:可能是一个Flex或AMF(Action Message Format)相关的库,用于...

    spring整合其他框架

    7. Spring与Struts2整合:Struts2是一个MVC框架,Spring与Struts2的结合可以强化MVC设计模式的实现,通过Spring的IoC(控制反转)和AOP,可以简化Struts2的配置,提升可维护性。 8. Spring与Hibernate整合:...

    struts2框架的简单搭建

    - `com.springsource.javax.mail-1.4.0.jar`:JavaMail API,提供了邮件发送功能,虽然不是Struts2核心部分,但可以与Struts2集成进行邮件通知。 - `com.springsource.org.aopalliance-1.0.0.jar`:AOP Alliance库...

    dangdang-ssh.zip_Dangdang mail_ssh_ssh商城

    【标题】"dangdang-ssh.zip_Dangdang mail_ssh_ssh商城"指的是一个以SSH(Struts2 + Spring + Hibernate)技术栈开发的模仿当当网的邮件功能和SSH商城系统的压缩包文件。SSH是Java EE领域广泛应用的开源框架集合,...

    spring4.1核心包

    2. spring-aspects-4.1.1.RELEASE.jar 提供的对AspectJ框架的整合,也是A面向切面编程。 AspectJ可用于基于普通Java对象的模块化 注意:aop 和 aspects区别: ...

    java发送邮件实例(含mail包)

    实例一结合了SSH(Spring、Struts2、Hibernate)框架,Spring框架提供了便捷的邮件服务支持。在Spring配置文件中,我们需要定义一个`&lt;bean&gt;`来配置邮件服务器的相关属性,如主机名、端口、用户名、密码等。然后,...

    Struts模块化之邮件组件(发送)

    JavaMail API提供了一套完整的类库,如`javax.mail.Session`、`javax.mail.Transport`、`javax.mail.Message`等,用于构建和发送邮件。 首先,我们需要配置邮件服务器的相关参数,如SMTP服务器地址、端口、用户名和...

    开源框架 Spring Gossip

    RMI Hessian、 Burlap Http Invoker &lt;br&gt;邮件 对于邮件发送服务的支援是由Spring的 org.springframework.mail.MailSender介面所定义,它有两个实作类别, org.springframework.mail.cos....

    stuts2邮件附件代码

    Struts2支持Spring的依赖注入(DI),可以将JavaMail的相关服务通过注解或XML配置注入到Action类中。 4. **JavaMail API**:JavaMail API是Java平台用来处理邮件的标准API。使用`javax.mail`和`javax.mail.internet...

    SPRING各实用开发包用途及解释

    该库为第三方工具提供了支持,如缓存(ehcache)、连接管理(JCA)、监控管理(JMX)、邮件发送(JavaMail/COS Mail)、定时任务调度(Timer/Quartz)等。 ##### (11) spring-web.jar 此库提供了Spring Web的支持,...

    利用Java的Struts框架实现电子邮件发送功能

    在Java Web开发中,Struts框架是一个非常流行的MVC(Model-View-Controller)架构,它是SSH(Spring、Struts、Hibernate)三大框架之一,用于构建高效、可维护性强的企业级应用。在本教程中,我们将探讨如何利用...

    SSH框架实现发送电子邮件的两种方法

    本文将详细介绍如何在SSH(Spring+Struts+Hibernate)框架下实现发送电子邮件的两种常见方式——纯文本邮件和HTML格式邮件。 #### 二、发送纯文本邮件 ##### 2.1 配置JavaMailSender 首先,我们需要配置`...

Global site tag (gtag.js) - Google Analytics