[JBoss Seam] - Re: Seam mail ...
by minamti
This is what I have...
The email page (regemail.xhtml)
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:f="http://java.sun.com/jsf/core"
| template="mailtemplate.xhtml">
|
| <ui:param name="subject" value="foo registration" />
|
| <ui:define name="body">
| <p>Thank you for registering with foo.</p>
| <p>Click on this link to confirm your registration <a href="http://www.foo.com"> foo </a></p>
| <p>Happy foo</p>
| </ui:define>
|
| </ui:composition>
The template (mailtemplate.xhtml)
| <ui:composition xmlns="http://www.w3.org/1999/xhtml"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:m="http://jboss.com/products/seam/mail"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:f="http://java.sun.com/jsf/core">
|
| <m:message>
| <m:from name="foo" address="do-not-reply(a)foo.com" />
| <m:to name="#{user.firstname} #{user.lastname}">#{user.email}</m:to>
| <m:subject>#{subject}</m:subject>
| <m:body>
| <html>
| <body>
| <ui:insert name="body">
| This is the default body, specified by the template.
| </ui:insert>
| </body>
| </html>
| <f:facet name="alternative">
| <ui:insert name="alternative">
| <h:outputText>Sorry, your mail reader doesn't support html.</h:outputText>
| </ui:insert>
| </f:facet>
| </m:body>
| </m:message>
|
| <ui:insert name="successMessage">
| <html>
| <body>
| <p>An email has been sent to you. Please click on the link in the email to confirm your registration.</p>
| </body>
| </html>
| </ui:insert>
| </ui:composition>
|
If I perform a renderer.render("/regemail.xhtml") it works fine. However, if I have a NotificationBean class defined and try to perform renderer.render in a method pf the NotificationBean, nothing happens. I do not see anything on the screen. The reason why I want a bean is because I need to send this email asynchronously.
Notification.java
package com.foo.session;
|
| import org.jboss.annotation.ejb.Local;
| import org.jboss.seam.annotations.async.Asynchronous;
|
| @Local
| public interface Notification {
|
| // I tried with the @Asynchronous annotation also
|
| public void notifyByEmail(String emailAddress, String firstName, String lastName) throws NotificationException;
|
|
| }
|
NotificationBean.java
package com.foo.session;
|
| import javax.ejb.Remove;
| import javax.ejb.Stateless;
|
| import org.jboss.seam.annotations.In;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Out;
| import org.jboss.seam.annotations.async.Asynchronous;
| import org.jboss.seam.faces.Renderer;
|
| @Stateless
| @Name("notification")
| public class NotificationBean implements Notification {
|
| @In(create=true)
| private Renderer renderer;
|
| public void notifyByEmail(String email, String fName, String lName) throws NotificationException {
|
| try {
| System.out.println("*************************** Before Rendered ******************************");
| String result = renderer.render("/regemail.xhtml");
| System.out.println("*********************" + result + "*****************");
| System.out.println("*************************** Rendered ******************************");
| }
| catch (Exception e) {
| throw new NotificationException(e.getMessage());
| }
| }
|
|
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4080678#4080678
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4080678
18 years, 7 months
[JBoss Portal] - JBoss Portal 2.6.1 bundled - null pointer exception
by vhortal
Hello,
I am an absolute beginner in this field. I could not find any report on a similar problem so here I go.
I deploy and run the bundled version of the JBoss Portal 2.6.1 GA (without any changes) on Windows XP Professional (spanish language), and everything mentioned in the quickstart guide seems to work as expected, with the exception that when I click on Project Information / JBoss Portal Project (in the content area, pointing to http://localhost:8080/portal/content/default/project.html) I get the following stacktrace:
java.lang.NullPointerException
| at org.jboss.portal.core.cms.ui.CMSPortlet.doView(CMSPortlet.java:235)
| at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:133)
| at org.jboss.portal.core.cms.ui.CMSPortlet.doDispatch(CMSPortlet.java:313)
| at javax.portlet.GenericPortlet.render(GenericPortlet.java:306)
| at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.invokeRender(PortletContainerImpl.java:483)
| at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.dispatch(PortletContainerImpl.java:405)
| at org.jboss.portal.portlet.container.PortletContainerInvoker$1.invoke(PortletContainerInvoker.java:86)
| ...
This happens only the first time in the session, when hitting the back button and clicking again on the link the right content is shown. The same happens when I upload and link to the quickstart.zip as explained in the guide (first click null pointer exception, then the link works).
This sounds to me like a problem with the cache, and I can see indeed in the log the following entry (previous to the stack trace):
WARN [org.jboss.web.tomcat.service.jasper.TagLibCache] Internal error: File /WEB-INF/web.xml not found
I'll be grateful for any hints on what the problem is. Thanks in advance.
V. Hortal
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4080676#4080676
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4080676
18 years, 7 months