forked from Coded/SIPRP
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							59 lines
						
					
					
						
							1.5 KiB
						
					
					
				
			
		
		
	
	
							59 lines
						
					
					
						
							1.5 KiB
						
					
					
				/*
 | 
						|
 * RequestServlet.java
 | 
						|
 *
 | 
						|
 * Created on 4 de Março de 2005, 18:19
 | 
						|
 */
 | 
						|
 | 
						|
package siprp.pagina;
 | 
						|
 | 
						|
import java.io.*;
 | 
						|
import java.util.*;
 | 
						|
 | 
						|
import javax.servlet.*;
 | 
						|
import javax.servlet.http.*;
 | 
						|
 | 
						|
/**
 | 
						|
 *
 | 
						|
 * @author  psantos
 | 
						|
 */
 | 
						|
public class RequestServlet extends MailerServlet
 | 
						|
{
 | 
						|
	private final static String REQUEST_NAME = "request_name";
 | 
						|
	private final static String REQUEST_PHONE = "request_phone";
 | 
						|
	private final static String REQUEST_EMAIL = "request_email";
 | 
						|
	private final static String REQUEST_DETAILS = "request_details";
 | 
						|
 | 
						|
	private final static String[] FORM_FIELDS = new String[]{
 | 
						|
								REQUEST_NAME, REQUEST_PHONE,
 | 
						|
								REQUEST_EMAIL, REQUEST_DETAILS
 | 
						|
							};
 | 
						|
 | 
						|
	public void doPost( HttpServletRequest req, HttpServletResponse res )
 | 
						|
	throws IOException
 | 
						|
	{
 | 
						|
		ServletOutputStream out = res.getOutputStream();
 | 
						|
		res.setContentType( "text/html" );
 | 
						|
 | 
						|
		/*
 | 
						|
		 parametros:
 | 
						|
		 request_name
 | 
						|
		 request_phone
 | 
						|
		 request_email
 | 
						|
		 request_details
 | 
						|
		 */
 | 
						|
		// recebe info de contacto
 | 
						|
		Hashtable parameters = parseParameters( new Hashtable( req.getParameterMap() ) );
 | 
						|
 | 
						|
		String content = createContent( parameters, FORM_FIELDS, "mail/pedido_informacao.txt" );
 | 
						|
 | 
						|
		String from = ( String ) parameters.get( REQUEST_EMAIL );
 | 
						|
		String destination = "psantos@evolute.pt";
 | 
						|
		String subject = "Pedido de informação através do site www.siprp.pt";
 | 
						|
		// manda mail
 | 
						|
		boolean success = sendMail( from, destination, subject, content, false );
 | 
						|
 | 
						|
		// mostra pagina correspondente
 | 
						|
		out.println( showResultPage( success, "mail/pedido_enviado.html", "mail/pedido_nao_enviado.html" ) );
 | 
						|
	}
 | 
						|
}
 |