package com.elseforif.servlet;
import com.elseforif.URLs;
import com.elseforif.servlet.utility.constraint.ServletParameters;
import com.elseforif.servlet.utility.ElseForIfHTMLWriter;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.elseforif.servlet.utility.constraint.JVCServletParameterConstraints;
/**
* This is the main Contact page, displaying some general information about
* Else For If and a form for emailing us.
*/
public class Contact extends ElseForIfServlet
{
/**
* Initialize this servlet for use.
*
* @param servletConfig an object containing this servlet's configuration
*/
public void init(ServletConfig servletConfig) throws ServletException
{
super.init(servletConfig);
m_title = "Else For If Contact Information";
m_menuMode = MENU_MODE_CONTACT;
m_parameterConstraints = new JVCServletParameterConstraints(
ATTRIBUTE_CONTACT_EMAIL_PARAMETERS, false);
m_parameterConstraints.addOptionalStringParameter(P_CATEGORY, null, false);
m_parameterConstraints.addOptionalBooleanParameter(P_CONFIRMED, false, true);
}
/**
* Display the contact page, including a multipurpose email form.
*
* @param request a servlet request
* @param response the response for that request
* @param session the user's session object
* @param out a custom HTML output writer
*/
protected void doBoth(HttpServletRequest request, HttpServletResponse response,
HttpSession session, ServletParameters in, ElseForIfHTMLWriter out) throws Exception
{
out.printPreContent(this);
if (in.b(P_CONFIRMED))
{
out.startBubble("Thanks!");
out.print("Your message has been sent. Thanks for communicating. We'll get back to you shortly.");
out.finishBubble();
}
out.startBubble("Contact");
out.printIMG("/img/me.jpg", "style=\"float: left; border-width: 2px; border-color: #2A4025; border-style: outset; margin-right: 10px; margin-bottom: 5px;\" alt=\"Jason Van Cleve\"", 110, 170);
<%
Else For If is operated by
<%= out.A("http://www.vancleve.com/JasonVanCleveResume", "Jason Van Cleve") %>,
currently living in Eugene, Oregon, USA. He works with a small band of merry
developers around the Pacific Northwest
to offer expertise in a variety of Web technologies. Contact us via
the email form below. Your thoughts on anything related to
the Internet and what we do are always welcome.
We are available to <%= out.A(URLs.SERVICES + "#websites", "build" ) %>
or <%= out.A(URLs.SERVICES + "#consulting", "help you build" ) %>
your Web site, and in some cases
<%= out.A(URLs.SERVICES + "#websites", "host" ) %> it as well.
If you need help with a project, have criticisms for the software showcased
here, or just want to talk shop, then don't deliberate. Bust us an email!
%>
out.finishBubble();
out.printA("emailForm");
out.startBubble("Email Form:");
out.print("Use this form to contact Else For If about anything.");
out.print(NL + BR + BR + NL);
out.printBeginFORM("form1", false, URLs.CONTACT_EMAILER);
if (!in.getHasError(P_SENDER))
out.print("Your email address:");
else
out.printSPAN("error", "You must enter a valid email address:");
out.print(BR + NL);
out.printBeginDIV("formField");
out.printTextINPUT(P_SENDER, 30, 255, in.S(P_SENDER));
out.print(END_DIV + BR + NL);
out.print("Choose from these categories:");
out.print(BR + NL);
out.printBeginDIV("formField");
out.printBeginSELECT(P_CATEGORY, null);
out.printOPTION("feedback", "General", in.S(P_CATEGORY));
out.printOPTION("suggestions", "Questions/Suggestions", in.S(P_CATEGORY));
out.printOPTION("contracts", "Services", in.S(P_CATEGORY));
out.printOPTION("development", "Development", in.S(P_CATEGORY));
out.printOPTION("bugs", "Bugs", in.S(P_CATEGORY));
out.print(END_SELECT + END_DIV);
out.print(BR + NL);
if (!in.getHasError(P_BODY))
out.print("Let 'er rip:");
else
out.printSPAN("error", "Please enter your message here:");
out.print(BR + NL);
out.printBeginDIV("formField");
out.printTEXTAREA(P_BODY, 10, 50, in.S(P_BODY));
out.print(END_DIV + BR + NL);
out.printSUBMIT("Send.");
out.print(END_FORM);
out.finishBubble();
out.printPostContent(this);
}
}