[JBoss Seam] - Re: Hibernate SessionFactory in Seam App?
by PatrickMadden
Hi, I'm getting a exception as follows when trying to do as you described. I must have something else wrong unfortunately.
anonymous wrote : javax.naming.NameNotFoundException: EntityManagerFactory not bound
I've wrapped my servlet with SeamServletFilter as follows in web.xml
| <!-- propogate seam context to servlets (pvm) addition -->
| <filter>
| <filter-name>Seam Servlet Filter</filter-name>
| <filter-class>org.jboss.seam.servlet.SeamServletFilter</filter-class>
| </filter>
| <filter-mapping>
| <filter-name>Seam Servlet Filter</filter-name>
| <url-pattern>/servlet/*</url-pattern>
| </filter-mapping>
| <!-- end seam context to servlets -->
|
And for my verify user servlet mapping I have the following
| <servlet>
| <servlet-name>VerifyUser</servlet-name>
| <servlet-class>
| com.clooster.web.servlet.VerifyUser
| </servlet-class>
| </servlet>
|
| <servlet-mapping>
| <servlet-name>VerifyUser</servlet-name>
| <url-pattern>/servlet/VerifyUser</url-pattern>
| </servlet-mapping>
|
Inside my servlet I have an API to get the EntityManager as follows:
| protected EntityManager getEntityManager() throws NamingException
| {
| EntityManagerFactory factory = (EntityManagerFactory)
| Naming.getInitialContext().lookup("java:/EntityManagerFactory");
|
| EntityManager em = factory.createEntityManager();
|
| return em;
| }
|
Calling the above method results in the NameNotFoundException.
One another note, once I have the above problem solved - what is the prescribed way to redirect a user to a property seam page. I'm going to attempt to do the following - will it work?
| EntityManager em = this.getEntityManager();
|
| ClUsers user = em.find(ClUsers.class, greeter.getName());
|
| if (user != null)
| {
| // ok we have verified that this user's email address is valid
| // and he/she is whom they say they are - set the status
| // in the db and commit for this user.
|
| user.setStatus((short) 1);
|
| em.persist(user);
|
| // now login the user
| LoginAction loginAction = (LoginAction) Component.getInstance(LoginAction.class);
| Contexts.getSessionContext().set("greeter", greeter);
| loginAction.login();
| }
| else
| {
| response.getOutputStream().println(
| "Invalid User");
| }
|
Or should I be using the HttpServletResponse.enodeRedirectURL API?
Again, thank you for your great work!
PVM
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3995623#3995623
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3995623
19 years, 4 months
[JBoss Seam] - problem using the pages.xml to call action method?
by FredF
Hello all.
I am having problem using the action attribute in the page element in the file pages.xml.
I have a view-file which has a form and a datatable element.
I want to populate this datatable with data from a seam component when the user loads the page, not in the response of the form submit.
I have defined a method initAllMessages that populates my list (my list has @Out @DataModel) with data
and I use that list in the datatable
<h:dataTable value="#{allMessages}" var="message">
| <h:column>
| <h:outputText value="#{message.text}" />
| </h:column>
| </h:dataTable>
I instruct seam to call the initAllData with the action parameter
in a page element in pages.xml like this:
<pages>
| <page view-id="/input.jsp" action="#{post.initAllMessages}" />
| </pages>
The problem is that I get an exception:
2006-12-21 10:42:39,640 ERROR [org.jboss.portal.portlet.container.org_apache_myfaces_portlet_MyFacesGenericPortlet] The portlet threw an exception
javax.faces.el.EvaluationException: Exception while invoking expression #{post.initAllMessages}
The class in where I define my method to call implements an interface, has conversation scope and the Name annotation. The method it self has the @Create annotation
The seam view-file is loaded in a portlet contained in JBoss Portal.
Why am I getting this exception when seam tries to call the method?
Is there better/another way to populate data in a datatable on a non-faces get request?
thank you.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3995620#3995620
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3995620
19 years, 4 months
[JBoss Seam] - Design question
by enesterov
Hi everyone,
First of all I love Seam. So far we've built one application of the medium complexity and experience is very positive.
We have pretty large legacy application which needs to be brought to the new technology with certain improvements. I can see how most of it could be implemented using Seam. There is though one module which is completely meta data driven. We have a set of dynamic forms which have variable number of controls. Controls' name get there names assigned at runtime based on a couple of factors: user role, product category, etc.
The question is how one can capture the data from like this in non ugly way? Is there a way to implement this is Seam?
I appreciate your attention and ideas.
Thanks,
Ed
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3995612#3995612
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3995612
19 years, 4 months