[jboss-user] [JBoss Seam] - Re: What to do to make @Factory method working?
amorfis
do-not-reply at jboss.com
Mon Dec 3 17:01:36 EST 2007
"Andy Gibson" wrote : Do you have your bean setup as a seam component with a @Name annotation? It should be like :
|
|
| | @Name("articleManager")
| | @Scope(ScopeType.Conversation)
| | public class ArticlesManagerBean ....... {
| |
| | @Factory("article")
| | public Article getArticle() {
| | <init code if necessary>
| | return article
| | }
| | }
| |
|
Yes, I have something exactly like this.
anonymous wrote :
| Can you reference your bean from the page?
|
| Try putting in something like :
|
|
| | <h:outputText value="#{articlesManager}"/>
| |
|
| to see if it can pick up your articles manager bean.
|
I just tried, and it doesn't work. Looks like my app doesn't see this bean.
anonymous wrote :
| Also, is your getArticles() method defined in your interface that the bean implements?
|
Yes, it is.
anonymous wrote :
| Other than that, if you post some code, it should be easy to spot. Did you create the app with Seam Gen, and if not, do you have anything working that would indicate whether the app is set up properly?
|
The code is exaclty like in your examples. I am using eclipse and this project is downloaded from CVS of my friend, so I didn't generate it with Seam Gen. My task is to add web module. Application seems to be working, I can access jsp, just expressions like #{articlesManager} evaluate to empty string. If I put some gibberish there (like #{asefbadfe}) there is also empty string, so it behaves like this variables are not existing.
I have components.xml like this:
| <components xmlns="http://jboss.com/products/seam/components"
| xmlns:core="http://jboss.com/products/seam/core">
| <core:init jndi-pattern="@jndiPattern@"/>
| </components>
|
in WEB-INF. There is also faces-config.xml:
| <?xml version="1.0" encoding="UTF-8"?>
| <faces-config version="1.2"
| xmlns="http://java.sun.com/xml/ns/javaee"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
|
| <!-- Facelets support -->
| <application>
| <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
| </application>
|
| </faces-config>
|
and of course web.xml:
| <?xml version="1.0" encoding="UTF-8"?>
| <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
| <display-name>inka-web</display-name>
| <welcome-file-list>
| <welcome-file>index.html</welcome-file>
| <welcome-file>index.htm</welcome-file>
| <welcome-file>index.jsp</welcome-file>
| <welcome-file>default.html</welcome-file>
| <welcome-file>default.htm</welcome-file>
| <welcome-file>default.jsp</welcome-file>
| </welcome-file-list>
| <listener>
| <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
| </listener>
| <context-param>
| <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
| <param-value>client</param-value>
| </context-param>
| <servlet>
| <servlet-name>Faces Servlet</servlet-name>
| <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
| <load-on-startup>1</load-on-startup>
| </servlet>
| <servlet-mapping>
| <servlet-name>Faces Servlet</servlet-name>
| <url-pattern>*.jsp</url-pattern>
| </servlet-mapping>
| </web-app>
|
If you need any other data I can put it here. I just don't know what is wrong.
Best regards
Pawel Stawicki
Cheers,
Andy
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4110022#4110022
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4110022
More information about the jboss-user
mailing list