Master Rice

Greenhorn
+ Follow
since Aug 05, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Master Rice

I have developed my client-server application using Tomcat and now seek to deploy my work to a full web server, of which I am not the host. Is there a standard methodology to follow?
22 years ago
Hi all,
I'm trying to learn how to write a mail sending application. Got the following code, but it doesn't work.
The problem lies in the transport.connect() bit (I believe). I have tried numerous entries for the mail server input:
e.g. "mail.onetel.net.uk", "smtp.mail.onetel.net.uk", "mail.smtp.net.uk" but get the exceptions:
javax.mail.MessagingException: 501 Invalid domain name
or more frequently
javax.mail.MessagingException: Could not connect to the SMTP host: onetel.net.uk, port: 25;
I am making a mistake somewhere, can someone spot it? I would be eternally at your service if you could help me... In MSOffice, my outgoing mail (SMTP) is "mail.onetel.net.uk" ???
(Just read previous forum entries on this.. Do I need to install an smtp server on my PC? Can I not use my ISP to send mail through java? If so, where can I get a smtp server (for free)?)
Cheers,
// NEIL
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
class mailSender
{
public static void main(String[] args)
{
String[] mailTo = {"someone@someaddress"};
String sub = "javax mail";
String msg = "Hello Me";
String mailFrom = "myAddress@onetel.net.uk";
String hostName = "mail.onetel.net.uk";
postMail(mailTo, sub, msg, mailFrom, hostName);
}
static public void postMail( String recipients[ ], String subject, String message , String from, String SMTPhost)
{
try{
//Set the host smtp address
Properties props = new Properties();
props.put("mail.smtp.host", SMTPhost);
// create some properties and get the default Session
Session session = Session.getDefaultInstance(props, null);
// create a message
Message msg = new MimeMessage(session);
// set the from and to address
InternetAddress addressFrom = new InternetAddress(from);
msg.setFrom(addressFrom);
InternetAddress[] addressTo = new InternetAddress[recipients.length];
for (int i = 0; i < recipients.length; i++){
addressTo[i] = new InternetAddress(recipients[i]);
}
// Setting the Subject and Content Type
msg.setSubject(subject);
msg.setContent(message, "text/plain");
// Send newMessage
Transport transport = session.getTransport("smtp");
transport.connect(SMTPhost, "myAddress@onetel.net.uk", "**myPassword**");
transport.sendMessage(msg, addressTo);
System.out.println("Message sent successfully");
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
[This message has been edited by Master Rice (edited September 13, 2001).]
22 years ago
Hi,
I have a program which reads in a web page and parses the HTML... I need the program to send an email to myself upon finding a specific string in the HTML..
Can anybody tell me how to do this please, or point me in the right direction at least...
Thanks,
Neil
I have a JTable with row selection listener handled by the following code.
Say I select row 2 of the table: After selecting the row, the method getSelectedTeam() goes off and does its thing okay,
but upon then returning to the original table, row 2 remains selected and therefore I cannot select it again... I can't figure out how to enable reselection of a row.
I have tried the clearSelection() method as commented out in the code, which appears to work but throws an arrayIndexOutOfBoundsException.
Can somebody help please?

table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // Choose only 1 team at a time
ListSelectionModel cellSelectionModel = table.getSelectionModel();
cellSelectionModel.addListSelectionListener(new ListSelectionListener()
{
public void valueChanged(ListSelectionEvent e)
{
if(!e.getValueIsAdjusting()){
ListSelectionModel lsm = (ListSelectionModel)e.getSource();
selectedRow = lsm.getMinSelectionIndex();
System.out.println("Row " + selectedRow + " is now selected.");
getSelectedTeam();
// lsm.clearSelection();
}
}
});
22 years ago
I have a JTable in a JScrollPane (in an applet). It all looks beautiful until I start scrolling using the the vertical scroller. This action makes the data in the rows of the table fuzzy. Is this a problem that anyone has come across before. Is there a fix. This problem occurs when I drag the scroller or click the top and bottom arrows. If however I click in the spaces above/below the scroller bar (ie. instead of dragging) to scroll up/down the table, the problem is not so evident.
Cheers,
Neil.
22 years ago
I am a relatively new programmer who is trying to write an application that parses/retrieves information from an HTML page, and extracts relevant parts of the HTML (usually from tables) into Java Strings.
I have heard of javax.swing.text.html.parser. Would this do the job, and if so, can somebody give me some pointers on how to use it. Some simple sample code would be useful, just so that I can work out how to use it.
Thanks, Neil.
I am a relatively new programmer who is trying to write an application that parses/retrieves information from an HTML page, and extracts relevant parts of the HTML (usually from tables) into Java Strings.
I have heard of javax.swing.text.html.parser. Would this do the job, and if so, can somebody give me some pointers on how to use it. Some simple sample code would be useful, just so that I can work out how to use it.
Thanks, Neil.
I am a relatively new programmer who is trying to write an application that parses/retrieves information from an HTML page, and extracts relevant parts of the HTML (usually from tables) into Java Strings.
I have heard of javax.swing.text.html.parser. Would this do the job, and if so, can somebody give me some pointers on how to use it. Some simple sample code would be useful, just so that I can work out how to use it.
Thanks, Neil.
22 years ago