Please if it know the solution replay to me
this is my context.html
<bean id="Connectmail" class="com.nanna.ConnectMail">
<property name="sessionForm"><value>true</value></property>
<property name="commandName"><value>formbean</value></property>
<property name="commandClass"><value>com.nanna.FormBean</value></property>
<property name="mailSender"><ref bean="mailSender"/></property>
<property name="message"><ref bean="mailMessage"/></property>
<property name="formView"><value>Home</value></property>
</bean>
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="64.79.170.116"/>
</bean>
<bean id="mailMessage" class="org.springframework.mail.SimpleMailMessage">
<property name="from" value="support@easyuploader.com"/>
</bean>
ConnectMail.java
public class ConnectMail extends SimpleFormController{
private MailSender mailSender;
private SimpleMailMessage message;
String to_user="";
String content="";
public ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors)
throws ServletException,Exception {
to_user=((FormBean)command).getUserid();
content=((FormBean)command).getContent();
System.out.println("to_user"+to_user);
System.out.println("content"+content);
//to_user ="user";
//content = "content";
Map myModel = new HashMap();
myModel.put("to_user", to_user);
myModel.put("content", content);
boolean temp=sendMail(to_user,content);
System.out.println(temp);
return new ModelAndView("show");
}
public boolean sendMail(final String to_user,final String content) throws MessagingException {
MimeMessagePreparator preparator = new MimeMessagePreparator() {
public void prepare(MimeMessage mimeMessage) throws MessagingException {
mimeMessage.setRecipient(Message.RecipientType.TO,
new InternetAddress(to_user));
mimeMessage.setFrom(new InternetAddress("support@easyuploader.com"));
mimeMessage.setText(content);
}
};
try{
mailSender.send((SimpleMailMessage) preparator);
}
catch(MailException ex) {
//log it and go on
System.err.println(ex.getMessage());
}
return true;
}
public MailSender getMailSender() {
return mailSender;
}
public void setMailSender(MailSender mailSender) {
this.mailSender = mailSender;
}
public SimpleMailMessage getMessage() {
return message;
}
public void setMessage(SimpleMailMessage message) {
this.message = message;
}
}
at the time of running am getting java.lang.ClassCastException
if it know how can it solve
from
madhuri