Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2011
    Posts
    4
    Rep Power
    0

    Default How to execute jsp

    <%--
    Document : Geo
    Created on : May 6, 2011, 10:28:03 AM
    Author : Administrator
    --%>

    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>:: GEO Silicon Contact Us ::</title>
    <script language="javascript">
    function validateForm(feedback)
    {
    if(document.forms.feedback.name.value=="")
    {
    alert("Please Enter your name");
    feedback.name.focus();
    return false;

    }


    if(document.forms.feedback.email.value=="")
    {
    alert("Please enter your Email ");
    feedback.email.focus();
    return false;
    }
    if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.feedback.email.value))
    {
    alert("Please enter valid Email only");
    feedback.email.focus();
    return false;
    }

    if(document.forms.feedback.phone.value=="")
    {
    alert("Please enter your phone number ");
    feedback.phone.focus();
    return false
    }

    if(isNaN(document.forms.feedback.phone.value))
    {
    alert("Please phone number in Numaric Only" );
    feedback.phone.focus();
    return false
    }

    if(document.forms.feedback.desc.value=="")
    {
    alert("Please Enter Your Feedback");
    feedback.desc.focus();
    return false;
    }

    }
    </script>
    </head>

    <body>


    <form enctype="multipart/form-data" action="" method="post" name="feedback" onSubmit="return validateForm(feedback);">
    <table width="357" border="0" cellpadding="0" cellspacing="5">
    <tbody>
    <tr>
    <td colspan=2 style="color:#FF0000;font-size:13px;font-weight:bold;padding:10px;"> </td>

    </tr>

    <tr>
    <td width="85"><span class="requiredAsterisk style1">*</span><span class="style1">&nbsp;Name:</span></td>
    <td width="180" align="left"><input name="name" size="30" maxlengtd="30" value="" /> </td>
    </tr>

    <tr>
    <td><span class="requiredAsterisk">*</span>&nbsp;Email :</td>

    <td align="left"><input name="email" size="30" maxlengtd="150" value="" /></td>
    </tr>


    <tr>
    <td><span class="requiredAsterisk">*</span>&nbsp;Phone :</td>
    <td align="left"><input name="phone" size="30" maxlengtd="15" value="" />
    <br /></td>
    </tr>



    <tr>

    <td><span class="requiredAsterisk" >*</span>&nbsp;Feed Back:</td>
    <td align="left"><textarea name="desc" rows="5" cols="23"></textarea> </td>
    </tr>
    <tr>
    <td colspan="2" align="center"><input class="actionButton" value="Submit!" type="submit" name="submit"/></td>
    </tr>
    <tr>
    <td colspan="2" align="center"></td>
    </tr>
    </tbody>
    </table>

    </form>
    </body>
    </html>

  2. #2
    Join Date
    Apr 2011
    Posts
    4
    Rep Power
    0

    Default First run belowProgam

    /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */

    package Mail;

    /**
    *
    * @author Administrator
    */


    import java.util.Properties;

    import javax.mail.Message;
    import javax.mail.MessagingException;
    import javax.mail.Session;
    import javax.mail.Transport;
    import javax.mail.Message.RecipientType;
    import javax.mail.internet.AddressException;
    import javax.mail.internet.InternetAddress;
    import javax.mail.internet.MimeMessage;

    public class SendMail {

    private String from;
    private String to;
    private String subject;
    private String text;

    public SendMail(String from, String to, String subject, String text){
    this.from = from;
    this.to = to;
    this.subject = subject;
    this.text = text;
    }

    public void send(){

    Properties props = new Properties();
    props.put("mail.smtp.host", "smtp.gmail.com");
    props.put("mail.smtp.port", "465");

    Session mailSession = Session.getDefaultInstance(props);
    Message simpleMessage = new MimeMessage(mailSession);

    InternetAddress fromAddress = null;
    InternetAddress toAddress = null;
    try {
    fromAddress = new InternetAddress(from);
    toAddress = new InternetAddress(to);
    } catch (AddressException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }

    try {
    simpleMessage.setFrom(fromAddress);
    simpleMessage.setRecipient(RecipientType.TO, toAddress);
    simpleMessage.setSubject(subject);
    simpleMessage.setText(text);
    System.out.println("sdfsf");
    Transport.send(simpleMessage);
    System.out.println("sdfsddddddddddddddf");
    } catch (MessagingException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    }
    }

    /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */

    package Mail;

    /**
    *
    * @author Administrator
    */
    public class SendMailTest {

    public static void main(String[] args) {

    String from = "abc@gmail.com";
    //String to = "kalyankotagiri1@gmail.com";
    String to = "ravikumar_dasineni@medwrite.info";
    String subject = "Hai kalyan";
    String message = "Hai this is for testing message";
    SendMail sendMail = new SendMail(from, to, subject, message);
    sendMail.send();
    }
    }

  3. #3
    Join Date
    Apr 2011
    Posts
    4
    Rep Power
    0

    Default try this

    /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */

    package Mail;

    /**
    *
    * @author Administrator
    */
    import java.util.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;

    public class SendEmail
    {
    public static void main(String [] args)
    {

    // Recipient's email ID needs to be mentioned.
    // String to = "kalyankotagiri1@gmail.com";
    String to = "ravikumar_dasineni@medwrite.info";

    // Sender's email ID needs to be mentioned
    String from = "web@gmail.com";

    // Assuming you are sending email from localhost
    String host = "medjava04:1433";

    // Get system properties
    Properties properties = System.getProperties();

    // Setup mail server
    properties.setProperty("mail.smtp.host", host);

    // Get the default Session object.
    Session session = Session.getDefaultInstance(properties);

    try{
    // Create a default MimeMessage object.
    MimeMessage message = new MimeMessage(session);

    // Set From: header field of the header.
    message.setFrom(new InternetAddress(from));

    // Set To: header field of the header.
    message.addRecipient(Message.RecipientType.TO,
    new InternetAddress(to));

    // Set Subject: header field
    message.setSubject("This is the Subject Line!");

    // Now set the actual message
    message.setText("This is actual message");

    // Send message
    Transport.send(message);
    System.out.println("Sent message successfully....");
    }catch (MessagingException mex) {
    mex.printStackTrace();
    }
    }
    }

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,775
    Blog Entries
    7
    Rep Power
    21

    Default

    Are you enjoying yourself, dumping all that code in the Announcements section of the forums?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. how to execute a jar file
    By renu in forum New To Java
    Replies: 2
    Last Post: 02-03-2011, 05:09 PM
  2. why does this program not execute
    By eLancaster in forum New To Java
    Replies: 3
    Last Post: 01-13-2011, 04:32 PM
  3. cannot execute EJB application.
    By JavaEmpires in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 07-17-2008, 10:53 AM
  4. Execute Jar file
    By barney in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 08:13 AM
  5. why does not execute this?
    By aleplgr in forum New To Java
    Replies: 6
    Last Post: 08-01-2007, 12:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •