Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Java mailer programming code problem

  1. #1
    Junior Member
    Join Date
    Apr 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool Java mailer programming code problem

    i have three separate codes for simple,multipart and attachment email in java..i have designed a GUI using netbeans in which i have a textpane for the body of the email and then couple of textfields which take the filename of the attachment(jTextField5) and the multipart email(jTextField6)..so what i basically am tryin to do is to get either one of my methods to go..i am using the specific if,else if structure to achieve my goal. But somehow the email doesnt go as specified. as far as i can guess is that it is not taking any 'xyz==null' values but taking xyz!=null values..could some please explain whats happening here??
    sample code is below.in the code below..it is taking only the else if part no matter what.

    if(jTextField5.getText()==null && jTextField6.getText()==null)
    {
    setTextContent(msg);
    }
    else if(jTextField5.getText()!=null){
    setFileAsAttachment(msg, jTextField5.getText());
    }
    else if(jTextField6.getText()!=null){
    setMultipartContent(msg);}


    msg.saveChanges();
    bus.sendMessage(msg, msg.getAllRecipients());


  2. #2
    Junior Member
    Join Date
    Apr 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java mailer programming code problem

    You might wanna change !=null to !Equals(null), since you're working with Strings, and String are objects.

Similar Threads

  1. Re: Java Newbie Code Problem
    By erinbasim in forum What's Wrong With My Code?
    Replies: 1
    Last Post: January 17th, 2010, 02:05 AM
  2. [SOLVED] Java Newbie Code Problem
    By lee in forum What's Wrong With My Code?
    Replies: 6
    Last Post: January 16th, 2010, 03:05 PM
  3. Robo Code - The funny Java Programming Game
    By Freaky Chris in forum The Cafe
    Replies: 20
    Last Post: October 8th, 2009, 04:42 PM
  4. Replies: 5
    Last Post: September 6th, 2009, 05:39 AM
  5. How to change html data into excel in java?
    By rgupta31 in forum File I/O & Other I/O Streams
    Replies: 14
    Last Post: May 29th, 2009, 11:43 AM

Tags for this Thread