Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

java.lang.NumberFormatException while retriving detail in jsp page

Status
Not open for further replies.

manishm95

Programmer
Feb 11, 2009
1
inside ActionClass(in struts i have )i am taking msgno as a input

ArrayList arry=new ArrayList();
Message msg=null;
Address[] from=null;
Date date=null;
Address[] recipients=null;
String subject=null;
String contType=null;
Object msgBody=null;
BodyBn bbn=null;
System.out.println("inside bussiness");
Properties props = new Properties( );
props.put("mail.debug","true");
final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
final String host = "pop.gmail.com";
final String port="995";
final String username = "XXXXXXXXXXXX@gmail.com";//my mail id
final String password = "######### "; //my password
String provider = "pop3";
props.put("mail.pop3.host",host);
props.put("mail.pop3.user",username);
props.put("mail.pop3.port",port);
props.setProperty( "mail.pop3.socketFactory.port", "995");
props.setProperty( "mail.pop3.socketFactory.class", SSL_FACTORY);
props.setProperty("mail.pop3.socketFactory.fallback", "false");
try {

Session session = Session.getInstance(props,new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username,password); }
});

Store store = session.getStore(provider);
store.connect(host, username, password);
boolean b=store.isConnected();
if(b==true) {
System.out.println("************conneted to pop server***********");
}
Folder inbox = store.getFolder("INBOX");
if (inbox == null) {
System.out.println("No INBOX");
System.exit(1);
}
inbox.open(Folder.READ_ONLY);
msg = inbox.getMessage(msgno);
from= msg.getFrom();
date=msg.getSentDate();
recipients=msg.getAllRecipients();
subject=msg.getSubject();
contType= msg.getContentType();
msgBody=msg.getContent();
System.out.println("msg is from "+from);
System.out.println("msg date "+date);
System.out.println("msg recipients "+recipients);
System.out.println("msg sub is "+subject);
System.out.println("msg conttype "+contType);
System.out.println("msg body is "+msgBody);
bbn=new BodyBn(from,date,recipients,subject,contType,msgBody);
System.out.println("----------adding to arry list--------------");
arry.add(bbn);
req.setAttribute("msgDetail",arry);
return mapping.findForward("success");

}catch(Exception e) {
System.out.println("Exception***********");
}

------------------------------in jsp page i m retriving all data--------------------------------
<body>
<logic:present name="msgDetail">

<table>
<tr>
<td>${msgDetail.from[0]}</td>
</tr>
<tr>
<td>${msgDetail.recipients[0]}</td>
</tr>
<tr>
<td>${msgDetail.subject}</td>
</tr>
<tr>
<td>${msgDetail.contType}</td>
</tr>
<tr>
<td>${msgDetail.msgBody}</td>
</tr>
</table>
</logic:present>

while printing these data in to console it is showing all data properly
but when i am trying to access these data from jsp page it is giving me
Following exception

java.lang.NumberFormatException: For input string: "from"
java.lang.NumberFormatException.forInputString(Unknown Source)
java.lang.Integer.parseInt(Unknown Source)
java.lang.Integer.parseInt(Unknown Source)
javax.el.ListELResolver.coerce(ListELResolver.java:166)
javax.el.ListELResolver.getValue(ListELResolver.java:51)
javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)

Plz help for this problem
 
Is that the complete stacktrace?

Appart from that, are you using a System.exit() in an Action class?

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top