?!
You can't have Spring Beans or resources on the client-side and you can't
just simple execute a sever side function by calling it on the client side.
You have to use RPC, RequestFactory or RequestBuilder to generate a request
for the backend and then call the server-side function (in your case
sending an email).
I would strongly recommend to read the GWT docs and how to client-server
communication works.
On Friday, April 12, 2013 5:39:49 PM UTC+2, vinu raju wrote:
>
>
> can anybody help me , how to send the mail using gwt and spring.
>
> i tried but getting error as : no source code is available for type
> org.springframework.core.io.Resource,did you forget the inherit a required
> module?
>
> my code is this:
>
> *Client side:*
> Resource res = new
> ClassPathResource("classpath:context/applicationContext.xml");
> BeanFactory factory = new XmlBeanFactory(res);
>
> Object o = factory.getBean("id2");
> GreetingServiceImpl mail = (GreetingServiceImpl)o;
> //String password =result.getPassword();
>
> try {
> mail.sendMail("fromvinu1","fromvinu1","forgotpassword",password);
> } catch (Exception e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
>
> *Server side*:
>
> private MailSender mail;
> public void setMail(MailSender mail)
> {
> this.mail = mail;
> }
> public String sendMail(String from, String to,String subject,String msg) {
> SimpleMailMessage message = new SimpleMailMessage();
>
> message.setFrom(from);
> message.setTo(to);
> message.setSubject(subject);
> message.setText(msg);
>
> mail.send(message);
> System.out.println("Mail Sent Successfully...!");
> // return UserInfo;
> return msg;
>
> *XML file:*
> <bean id="id1"
> class="org.springframework.mail.javamail.JavaMailSenderImpl">
> <property name="host" value="smtp.gmail.com" />
> <property name="port" value="465" />
> <property name="username" value="fromvinu1" />
> <property name="password" value="********" />
>
> <property name="javaMailProperties">
> <props>
> <prop key="mail.smtp.auth">true</prop>
> <prop
> key="mail.smtp.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop>
> <prop key="mail.smtp.socketFactory.port">465</prop>
> <prop key="mail.debug">true</prop>
> <prop key="mail.smtp.starttls.enable">true</prop>
> </props>
> </property>
> </bean>
>
> <bean id="id2" class="package.GreetingServiceImpl">
> <property name="mail" ref="id1" />
> </bean>
> *
> *
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.