core j2ee patterns core j2ee patterns©


core j2ee patterns java.net member

Core J2EE Pattern Catalog

© CoreJ2EEPatterns
All Rights Reserved.

Last Updated:
January 29, 2006 9:02 PM

 

In Association with Amazon.com


core j2ee patterns powered

Powered By Core J2EE Patterns

Request Submission Form

<%! private boolean checkValues=false; private String submitted=null; private String title=null; private String fullname=null; private String company=null; private String jobtitle=null; private String websiteurl = null; private String emailaddress=null; private String description = null; private String comments = null; private boolean missingField=false; private boolean debug=false; private boolean wantcopy = false; %> <% missingField=false; submitted=request.getParameter("submitted"); title=request.getParameter("title"); fullname=request.getParameter("fullname"); company=request.getParameter("company"); jobtitle=request.getParameter("jobtitle"); websiteurl=request.getParameter("websiteurl"); emailaddress=request.getParameter("emailaddress"); description=request.getParameter("description"); comments=request.getParameter("comments"); if (request.getParameter("wantcopy") != null) wantcopy = true; if (debug) { out.println("submitted=" + submitted); out.println("checkValues=" + checkValues); out.println("title=" + title); out.println("fullname=" + fullname); out.println("company=" + company); out.println("emailaddress=" + emailaddress); out.println("jobtitle=" + jobtitle); out.println("description=" + description); out.println("comments=" + comments); out.println("Wantcopy=" + wantcopy); } if (submitted==null) { if (debug) out.println("Not Submitted"); out.println(""); checkValues=false; } else { out.println(""); checkValues=true; } %> <% if (checkValues) { if ((fullname==null) || (fullname.trim().length() ==0)) { out.println("

  • Your Name required"); missingField=true; } if ((company==null) || (company.trim().length() ==0)) { out.println("
  • Company Name required"); missingField=true; } if ((jobtitle==null) || (jobtitle.trim().length() ==0)) { out.println("
  • Your Job Title required"); missingField=true; } if ((emailaddress==null) || (emailaddress.trim().length() ==0)) { out.println("
  • Your Email Address required"); missingField=true; } /*else { try { out.println("Parsing internet address:"+ emailaddress); InternetAddress.parse(emailaddress); } catch (Throwable e) { out.println("Invalid Email Address"); out.println("
  • Your Email Address is invalid"); missingField=true; } finally { } }*/ if ((websiteurl==null) || (websiteurl.trim().length() ==0)) { out.println("
  • Your Website URL required"); missingField=true; } if (!missingField) { String host = "localhost"; //"smtp.webappcaberet.net"; String from = emailaddress; String to = "support@corej2eepatterns.com"; Properties props = new Properties(); props.put("mail.smtp.host", host); javax.mail.Session mailsession = javax.mail.Session.getDefaultInstance(props, null); MimeMessage message = new MimeMessage(mailsession); //message.setFrom(new InternetAddress(from)); message.addRecipient(Message.RecipientType.BCC, new InternetAddress(to)); if (wantcopy) { message.addRecipient(Message.RecipientType.BCC, new InternetAddress(from)); } message.setSubject("Submission: Powered By Core J2EE Patterns"); StringBuffer sbuf = new StringBuffer(); sbuf.append("Name: " + title + " " + fullname); sbuf.append("\nCompany: " + company); sbuf.append("\nEmail: " + emailaddress); sbuf.append("\nWebSite URL: " + websiteurl); sbuf.append("\nDescription: " + description); sbuf.append("\nComments : " + comments ); message.setText(sbuf.toString()); // Send message if (debug) out.println("Sending message: " + sbuf.toString()); Transport.send(message); /*out.clear(); out.clearBuffer(); RequestDispatcher dispatcher= application.getRequestDispatcher("/cjpthanks.htm"); out.println("Dispatcher = " + dispatcher); dispatcher.forward(request, response); */ response.sendRedirect("/cjpthanks.htm"); } else { } } %>

    Note: * - indicates required field

    Title *
    Your Name * <% if (fullname != null) { out.println(""); } else { out.println(""); } %>
    Your Company's Name * <% if (company != null) { out.println(""); } else { out.println(""); } %>
    Your Job Title * <% if (jobtitle != null) { out.println(""); } else { out.println(""); } %>
    WebSite URL that is Powered By Core J2EE Patterns * <% if (websiteurl != null) { out.println(""); } else { out.println(""); } %>
    Your Email Address * <% if (emailaddress != null) { out.println(""); } else { out.println(""); } %>
    Describe briefly how you are using Core J2EE Patterns in your site/application (optional) <% if (description != null) { out.println(""); } else { out.println(""); } %>
    Comments (optional) <% if (comments != null) { out.println(""); } else { out.println(""); } %>
    <% /*if (wantcopy) { out.println(""); } else { out.println(""); }*/ %>
  • Contact Us © CoreJ2EEPatterns.com. All Rights Reserved. Terms of use