mih ira

Greenhorn
+ Follow
since Sep 30, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by mih ira

String fileName=null;
com.sun.webui.jsf.model.UploadedFile uploadedFile = fuAttachment.getUploadedFile();
try {
if (uploadedFile == null) {
}
String uploadedFileName = uploadedFile.getOriginalName();
int index = uploadedFileName.lastIndexOf('/');

if (index >= 0) {
fileName = uploadedFileName.substring(index + 1);
} else {
index = uploadedFileName.lastIndexOf('\\');
if (index >= 0) {
fileName = uploadedFileName.substring(index + 1);
} else {
fileName = uploadedFileName;
}
}

} catch (Exception ex) {
ex.printStackTrace();
//Logger.getLogger(AddIssue.class.getName()).log(Level.SEVERE, null, ex);
}

try {
FacesContext fcontext = FacesContext.getCurrentInstance();
ServletContext scontext = (ServletContext) fcontext.getExternalContext().getContext();
String rootPath = scontext.getRealPath("/");
rootPath = rootPath + "resources\\uploaded";
File dir = new File(rootPath);

if (!dir.exists()) {
dir.mkdirs();
}
File file = new File(dir.getCanonicalPath() + File.separatorChar + fileName);

//if (file.length()/1024*1024 <= 1024)
long fileSize = file.length();
uploadedFile.write(file);

}catch(Exception ex){
ex.printStackTrace();
}
15 years ago
JSF
15 years ago
It is the mail server IP.
You have to give the mail server IP address and open the ports for email send.
15 years ago
This is the sample code for your request


Use this for sending your emails automatically

try {
SendEmail sendEmail = new SendEmail();
String[] sendEmails = this.getUsersEmails();

String subject = "This is email subject";
String description = "email body message";
String userMail = getLoggedInUser();

sendEmail.postMail(
sendEmails,
subject,
description,
userMail);


} catch (MessagingException ex) {
ex.printStackTrace();
}



//SendEmail.java class method

public void postMail( String recipients[ ], String subject, String message , String from) throws MessagingException
{
boolean debug = false;

//Set the host smtp address
Properties props = new Properties();
props.put("mail.smtp.host", "email server ip address");

// create some properties and get the default Session
Session session = Session.getDefaultInstance(props, null);
session.setDebug(debug);

// 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]);
}
msg.setRecipients(Message.RecipientType.TO, addressTo);


// Optional : You can also set your custom headers in the Email if you Want
msg.addHeader("MyHeaderName", "Write here the email header");


// Setting the Subject and Content Type
msg.setSubject(subject);
/*msg.setContent(message, "text/plain");*/




// Create a message part to represent the body text
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setText(message);

Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart);
msg.setContent(multipart);
//msg.setContent(message, "text/plain");


Transport.send(msg);
}
15 years ago
I got this error when creating web service client to my mobile application.
The web service created by using dot net.
15 years ago
Eclipse is better
15 years ago
I am trying to connect dot net web service to my symbian mobile.
mobile application is developing by java
use eclipse version 3.4.2.
i got some wsdl error when creating web service clientin NetBeans
15 years ago
hi all,

Any one know about a "PA BX Call Billing System" please let me know.
I have to develop it by using java and it should be a real time office call billing system.
[email protected] is my mail address
thanks