人们一般都是会放到jsp里就会用,其它地方不会用,你怎么是这样呀,哈哈
解决方案 »
- CXF的测试
- hibernate 同一数据库 不同用户下的表
- 传递参数
- Hibernate3.1 打印sql 语句到控制台 参数显示''?" 问题 困惑中
- Session值更新的问题,急急急
- Struts+eclipse开发的WEB应用脱机浏览时TOMCAT发生java.net.unknownhostException
- 什么时候用assert?
- 严重问题,Tomcat服务在Windows Advanced Server起不来
- 。net在长角(longhorn)操作系统下,开发方式会不会有很大的变化,要不要学习很多的东西?
- 十万火急,请高手帮忙!!!
- 救命啦!jsp+tomcat+sql server运行问题!
- STRUTS新问题
<%@ page import=" javax.mail.*, javax.mail.internet.*, javax.activation.*,java.util.*" %>
<%@ page import="javamail.SmtpAuthenticator"%>
<html>
<head>
<TITLE>JSP meets JavaMail, what a sweet combo.</TITLE>
</HEAD>
<BODY>
<%
try{
Properties props = new Properties();
Session sendMailSession;
Store store;
Transport transport;
//sendMailSession = Session.getInstance(props, null);
props.put("mail.smtp.host", "smtp.tom.com");
props.put("mail.smtp.auth", "true");
SmtpAuthenticator sa = new SmtpAuthenticator("[email protected]","password");
sendMailSession = Session.getInstance(props, sa);
Message newMessage = new MimeMessage(sendMailSession);
newMessage.setFrom(new InternetAddress(request.getParameter("from")));
newMessage.setRecipient(Message.RecipientType.TO, new InternetAddress(request.getParameter("to")));
newMessage.setSubject(request.getParameter("subject"));
newMessage.setSentDate(new Date());
newMessage.setText(request.getParameter("text"));
transport = sendMailSession.getTransport("smtp");
transport.send(newMessage);
%>
<P>Your mail has been sent.</P>
<%
}
catch(MessagingException m)
{
out.println(m.toString());
}
%>
</BODY>
</HTML>
import javamail.SmtpAuthenticator;
^
F:\Tomcat\Tomcat 4.1\work\Standalone\localhost\800\deal_jsp.java:63: cannot resolve symbol
symbol : class SmtpAuthenticator
location: class org.apache.jsp.deal_jsp
SmtpAuthenticator sa = new SmtpAuthenticator("timehours","801114");好象是找不到 SmtpAuthenticator 这个类,因为是 <%@ page import="javamail.SmtpAuthenticator"%> 这怎么办啊?
import javax.mail.*;public class SmtpAuthenticator extends Authenticator {
String userName;
String userPassword; public SmtpAuthenticator(String userName, String userPassword) {
this.userName = userName;
this.userPassword = userPassword;
} protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication
(userName, userPassword);
}
}
记得给我分呀,哈哈,我缺分呀,哈