|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.servlet.GenericServlet | +--javax.servlet.http.HttpServlet | +--javawebparts.servlet.FormSenderServlet
The FormSenderServlet allows you to accept the submission of a form and take
values from that form, insert them into a template, and send the resultant
text as an eMail message to a specified address or list of addresses.
Example configuration in web.xml:
<servlet>
<servlet-name>FormSenderServlet</servlet-name>
<servlet-class>javawebparts.servlet.FormSenderServlet
</servlet-class>
<init-param>
<param-name>smtpHost</param-name>
<param-value>????</param-value>
</init-param>
<init-param>
<param-name>smtpLogonRequired
</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>smtpUsername</param-name>
<param-value>????</param-value>
</init-param>
<init-param>
<param-name>smtpPassword</param-name>
<param-value>????</param-value>
</init-param>
<init-param>
<param-name>fromAddress</param-name>
<param-value>
;FormSenderServlet@javawebparts.sourceforge.net
</param-value>
</init-param>
<init-param>
<param-name>toAddresses</param-name>
<param-value>????</param-value>
</init-param>
<init-param>
<param-name>subject</param-name>
<param-value>This is a test
</param-value>
</init-param>
<init-param>
<param-name>staticTokens</param-name>
<param-value>ccList=Bill in Accounting,
Dana in Legal~~deskOf=Beelzebub</param-value>
</init-param>
<init-param>
<param-name>templateFile</param-name>
<param-value>/WEB-INF/eMailTemplate.txt
</param-value>
</init-param>
<init-param>
<param-name>pageAfter</param-name>
<param-value>
/packages_jsp/servlet/mailSent.jsp</param-value>
</init-param>
</servlet>
Init parameters explained:
Field Summary | |
private java.lang.String |
fromAddress
The from address used when sending the eMail. |
private static org.apache.commons.logging.Log |
log
Log instance. |
private java.lang.String |
pageAfter
The JSP to forward to after sending the message. |
private java.lang.String |
smtpHost
The SMTP host name to send the message through. |
private boolean |
smtpLogonRequired
Flag: Does the SMTP server require logon credentials or not? |
private java.lang.String |
smtpPassword
Password to log on to the SMTP server (if smtpRequiresLogin is "true"). |
private java.lang.String |
smtpUsername
Username to log on to the SMTP server (if smtpRequiresLogin is "true"). |
private java.util.HashMap |
staticTokens
The list of static tokens configured. |
private java.lang.String |
subject
The subject of the eMail to send. |
private java.lang.String |
template
The actual eMail template. |
private java.lang.String |
templateFile
The path and name of the context-relative eMail template file. |
private java.util.ArrayList |
toAddresses
The list of eMail addresses to send eMail to. |
Fields inherited from class javax.servlet.http.HttpServlet |
|
Fields inherited from class javax.servlet.GenericServlet |
|
Constructor Summary | |
FormSenderServlet()
|
Method Summary | |
void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
doGet. |
void |
doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
doPost. |
void |
init(javax.servlet.ServletConfig config)
init. |
void |
sendMessage(java.lang.String inText)
This method sends a message. |
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static org.apache.commons.logging.Log log
private java.lang.String smtpHost
private java.lang.String smtpUsername
private java.lang.String smtpPassword
private boolean smtpLogonRequired
private java.lang.String fromAddress
private java.util.ArrayList toAddresses
private java.lang.String subject
private java.lang.String templateFile
private java.lang.String template
private java.lang.String pageAfter
private java.util.HashMap staticTokens
Constructor Detail |
public FormSenderServlet()
Method Detail |
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException
init
in interface javax.servlet.Servlet
init
in class javax.servlet.GenericServlet
config
- ServletConfig.
javax.servlet.ServletException
- ServletException.public void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
doGet
in class javax.servlet.http.HttpServlet
request
- HTTPServletRequest.response
- HTTPServletResponse.
javax.servlet.ServletException
- ServletException.
java.io.IOException
- IOException.public void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
doPost
in class javax.servlet.http.HttpServlet
request
- HTTPServletRequestresponse
- HTTPServletResponse
javax.servlet.ServletException
- ServletException
java.io.IOException
- IOExceptionpublic void sendMessage(java.lang.String inText)
inText
- The text of the message.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |