java发送Email
/**
发送邮件的方法
@param mailStr - 发送的邮件体
**/
public void sendMail(String mailStr){
try {
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
// Get a Properties object
Properties props = System.getProperties();
props.setProperty("mail.smtp.host", getHost());
props.setProperty("mail.smtp.socketFactory.class", SSL_FACTORY);
props.setProperty("mail.smtp.socketFactory.fallback", "false");
props.setProperty("mail.smtp.starttls.enable", "true");
props.setProperty("mail.smtp.startssl.enable", "true");
props.setProperty("mail.smtp.port", this.getPort());
props.put("mail.smtp.auth", "true");
Session session = Session.getDefaultInstance(props, new Authenticator(){
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(userName,password);
}
 
相关文档:
List的用法
List包括List接口以及List接口的所有实现类。因为List接口实现了Collection接口,所以List接口拥有Collection接口提供的所有常用方法,又因为List是列表类型,所以List接口还提供了一些适合于自身的常用方法,如表1所示。
表1 List接口定义的常用方法及功能
从表1可以看出,List接口提供的适合于自身的 ......
1.解释
因为jsp用到了SiteData类,而SiteData继承BasePage类,
所以BasePage构造函数
BasePage构造函数
initializeByCityCode函数main
key的值main.UpImages
v的值main.UpImages
2.执行完 BasePage.java
中的initCommon()后,
跳到SiteData.java 中的 process();方法,
public SiteData(HttpServletR ......
package com.citycollege.stw;
public class testreplace {
public static final String replace( String line, String oldString, String newString )
{
if (line == null)
{
return null ......
作为Java程序员来说,最痛苦的事情莫过于可以选择的范围太广,可以读的书太多,往往容易无所适从。我想就我自己读过的技术书籍中挑选出来一些,按照学习的先后顺序,推荐给大家,特别是那些想不断提高自己技术水平的Java程序员们。
一、Java编程入门类
对于没有Java编程经验的程序员要入门,随便读什么入门书籍都一样,这 ......
写入时,先做encode:
public static String encode(String src) {
String result = null;
try {
result = new String(src.getBytes("gbk"), "ISO-8859-1");
} catch (UnsupportedEncodingException uee) {
System.err.println(uee);
}
return result;
}
读出时,再做decode:
public static String deco ......