当前位置: 技术问答>java相关
请大家帮我看一下下面的servlet,有何问题,为什么总是发不出去呢?急急急!!
来源: 互联网 发布时间:2015-04-11
本文导语: 问题好像是出在message上面,因为mama.txt文件里只有三项message信息:from、to、subject。但同样的代码我放在jbuilder4中却能发送出去,为什么呀? package tdkn.pro; import javax.servlet.*; import javax.servlet.http.*; import javax.mail.*; i...
问题好像是出在message上面,因为mama.txt文件里只有三项message信息:from、to、subject。但同样的代码我放在jbuilder4中却能发送出去,为什么呀?
package tdkn.pro;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
import java.net.*;
import java.io.*;
import java.util.*;
public class senmail extends HttpServlet {
private static final String CONTENT_TYPE = "text/html";
/**Initialize global variables*/
public void init(ServletConfig config) throws ServletException {
super.init(config);
}
/**Process the HTTP Get request*/
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
Enumeration e = request.getParameterNames() ;
String s_server = "";
String s_from = "";
String s_to = "";
String s_subject = "";
String s_con = "";
String key = "";
String s_value = "";
String[] values ;
while (e.hasMoreElements())
{
key = (String)e.nextElement();
values = request.getParameterValues(key);
for(int i = 0; i
package tdkn.pro;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
import java.net.*;
import java.io.*;
import java.util.*;
public class senmail extends HttpServlet {
private static final String CONTENT_TYPE = "text/html";
/**Initialize global variables*/
public void init(ServletConfig config) throws ServletException {
super.init(config);
}
/**Process the HTTP Get request*/
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
Enumeration e = request.getParameterNames() ;
String s_server = "";
String s_from = "";
String s_to = "";
String s_subject = "";
String s_con = "";
String key = "";
String s_value = "";
String[] values ;
while (e.hasMoreElements())
{
key = (String)e.nextElement();
values = request.getParameterValues(key);
for(int i = 0; i