[JBoss Seam] - Enums - Useage
by tony.herstell@gmail.com
Given:
| <ice:menuItem id="bookingIndoorArenaMenuOption"
| value="#{messages.menu_item_book_indoor_arena}"
| action="#{availabilityController.showAvailability(Resource.instance.ResourceKind.INDOOR_ARENA)}">
| <s:conversationPropagation type="none" />
| </ice:menuItem>
|
| <ice:menuItem id="bookingMenageIntArenaOption"
| value="#{messages.menu_item_book_int_arena}"
| action="#{availabilityController.showAvailability('INT_ARENA')}">
| <s:conversationPropagation type="none" />
| </ice:menuItem>
|
You can see above what I would LIKE to do (pass an Enum to the Controller as a parameter) and you can see what I have to do (and then do some coversion in teh code).
Is there a way to do this in Seam?
| @SuppressWarnings("serial")
| @Entity // Defines this as an Entity that is a class mapped to the Datastore.
| @Name("resource") // Name used within SEAM for an instance of this class.
| public class Resource implements Serializable {
|
| public enum ResourceKind {
| INDOOR_ARENA ("resource_indoor_arena"),
| INT_ARENA ("resource_int_arena"),
| SJ_ARENA ("resource_sj_arena"),
| CONF_ROOM ("resource_conf_room"),
| CAFE ("resource_cafe");
| private final String inlLabel;
| ResourceKind(String inlLabel) {
| this.inlLabel = inlLabel;
| }
| public String getInlLabel() { return inlLabel; }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048526#4048526
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4048526
18 years, 11 months
[JBoss Seam] - Error in trying to injecting the bean
by cormet
Hi All,
I am quite new to jboss and Currently, i am using hibernate 3.2.1, seam 1.2.1 GA. my problem is that i would like to inject the bean called "generalJournal" when it is submited. However I got error saying that:
javax.faces.el.EvaluationException: Exception while invoking expression #{accountAction.recordJournal}
at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:156)
at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:58)
at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:75)
at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:148)
at org.jboss.seam.pages.Page.enter(Page.java:229)
at org.jboss.seam.core.Pages.enterPage(Pages.java:276)
at org.jboss.seam.jsf.AbstractSeamPhaseListener.enterPage(AbstractSeamPhaseListener.java:276)
at org.jboss.seam.jsf.AbstractSeamPhaseListener.beforeRender(AbstractSeamPhaseListener.java:214)
at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:56)
at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersBefore(PhaseListenerManager.java:73)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:126)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:140)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:183)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.jboss.seam.RequiredException: In attribute requires non-null value: accountAction.generalJournal
at org.jboss.seam.Component.getValueToInject(Component.java:1919)
at org.jboss.seam.Component.injectAttributes(Component.java:1368)
at org.jboss.seam.Component.inject(Component.java:1195)
at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:151)
at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:87)
at com.medansoft.accountingsystem.controller.AccountAction_$$_javassist_1.recordJournal(AccountAction_$$_javassist_1.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:132)
... 42 more
It complaint that the "generalJournal" is null, but i do put "create=true" which asking seam to create when it is null. iam quite confuse with the documentation provided :(. Can anyone give me some guideline about it?
Cheers,
here are my code:
home.xhtml
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
| <html xmlns="http://www.w3.org/1999/xhtml"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:c="http://java.sun.com/jsp/jstl/core"
| xmlns:rich="http://richfaces.ajax4jsf.org/rich"
| xmlns:a4j="https://ajax4jsf.dev.java.net/ajax">
| <body>
| <ui:composition template="/WEB-INF/pages/templates/master.xhtml">
| <ui:define name="body">
| <s:link value="Account List" view="/pages/account/home.xhtml"/>
| <s:link value="Record Journal" view="/pages/account/journal/record.xhtml"/>
| </ui:define>
| </ui:composition>
| </body>
| </html>
|
record.xhtml:
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
| <html xmlns="http://www.w3.org/1999/xhtml"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:c="http://java.sun.com/jsp/jstl/core"
| xmlns:rich="http://richfaces.ajax4jsf.org/rich"
| xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
| xmlns:jp="http://www.jenia.org/jsf/popup">
| <body>
| <ui:composition template="/WEB-INF/pages/templates/master.xhtml">
| <ui:define name="body">
| <h:form>
| <s:decorate id="journalDecorate" template="edit.xhtml">
| <ui:define name="label">General Journal #:</ui:define>
| <h:inputText id="journal" value="#{generalJournal.number}" required="true">
|
| </h:inputText>
| </s:decorate>
| <s:decorate id="dateDecorate" template="edit.xhtml">
| <ui:define name="label">Date:</ui:define>
| <h:inputText id="date" value="#{generalJournal.date}" required="true" readonly="true">
|
| </h:inputText>
| <jp:popupCalendar for="date" format="dd/MM/yyyy">
| <h:outputText value="Popup calendar" />
| </jp:popupCalendar>
| </s:decorate>
| <s:decorate id="memoDecorate" template="edit.xhtml">
| <ui:define name="label">Memo:</ui:define>
| <h:inputText id="menu" value="#{generalJournal.memo}" required="true">
|
| </h:inputText>
| </s:decorate>
|
| <div class="buttonBox">
| <h:commandButton id="create" type="submit" value="Create" action="#{accountAction.createGeneralJournal}"/>
|
| <s:button id="cancel" value="Cancel" view="/pages/home/home.xhtml"/>
| </div>
|
| </h:form>
| </ui:define>
| </ui:composition>
| </body>
| </html>
|
pages.xml
| <!DOCTYPE pages PUBLIC
| "-//JBoss/Seam Exceptions Configuration DTD 1.2//EN"
| "http://jboss.com/products/seam/pages-1.2.dtd">
|
| <pages login-view-id="/login.xhtml">
| <page view-id="/pages/account/home.xhtml" action="#{accountAction.accountHome}"/>
| <page view-id="/pages/account/journal/record.xhtml" action="#{accountAction.recordJournal}"/>
|
|
| <page view-id="/pages/*" login-required="true"/>
|
| <exception class="org.jboss.seam.security.NotLoggedInException">
| <redirect view-id="/login.xhtml">
| <message>You must be logged in to perform this action</message>
| </redirect>
| </exception>
|
| <exception class="org.jboss.seam.security.AuthorizationException">
| <end-conversation/>
| <redirect view-id="/security_error.xhtml">
| <message>You do not have the necessary security privileges to perform this action.</message>
| </redirect>
| </exception>
| </pages>
|
AccountAction.java
| @Name("accountAction")
| @Scope(EVENT)
| public class AccountAction implements Serializable{
| private static final long serialVersionUID = 5884510664142728026L;
|
| @Logger
| private Log log;
|
| @In("#{accountDao}")
| AccountDao accountDao;
|
| @In("#{me}")
| User me;
|
| @Out(value="accountTreeList", required=false)
| private AccountTreeDisplay parentAccountDisplay;
|
| @DataModel(value="accountList")
| private List<AccountTreeDisplay> accountList;
|
| @In(create=true)
| private GeneralJournal generalJournal;
|
| public void recordJournal() throws Exception {
| if(journalId == null || journalId.equals("")) {
| // recording new journal
| } else {
| // reload existing journal
| }
| }
|
| public String createGeneralJournal() throws Exception {
| log.debug("createGeneralJournal :: # :: " + generalJournal.getNumber());
| return null;
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048520#4048520
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4048520
18 years, 11 months
[JBoss Seam] - Authentication using database accounts
by sztank
Hello,
I'm trying to use Seam to build the application with the following requirement:
PostgreSQL database with a set of defined user accounts (username, password and some privileges granted). The application has to use this accounts to authenticate application users.
For example:
Database has a user "Tom" defined (name, password, privileges ).
When "Tom" login to the application the application should reconnect to the database with username and and password that "Tom" entered.
I wrote that application should reconect but I'm not sure when the Seam application actually connect to the database. I reckon that when it is deployed (is that right?).
Is it possible to implement this scenario with Seam?
This requirement is set by my customer. The reason why to do it that way is to utilize the database build-in users activity reporting. Do you think it is good reason?
ps.
I'm new to Seam and hibarnate.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048519#4048519
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4048519
18 years, 11 months
[EJB 3.0] - how to deploy ejb3 session bean on jboss4.0.5
by khizz
Hi all,
I am new to j2ee and ejb3, i followed a tutorial and tried to deploy a simple entity bean it worked fine .
but i could not deploy a simple session bean with a simple client
searched a lot in internet coud not find a tutorial to deploy ejb 3 session beans with a client. there are some but not with jboss, if with jboss then no ejb3. if it is with jboss and ejb3 no help on deployment. also tried jboss.org trailbraizers its very hard to understand...
I have following queries....please help...
what shall be directory stucture to deploy a ejb3 session bean(businessbean and a remote or local business interface) with a simple cilent to communicate with the session bean.
i used presistance.xml and jndi.properties while deploying entity bean.. is there a need of application.xml or ejb-jar.xml or any other .xml to deploy an ejb3 session bean, if yes what shall be their contents.
which .xml files will be needed if the ejbs are deployed as .jar ?.. and .ear?
Im using MyEclipse 5.1, jboss-4.0.5.liferay bundle
thank you.
khizz
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048516#4048516
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4048516
18 years, 11 months
[JBoss Seam] - is xhtml a good choice for Facelets templates?
by dan.j.allen
There is a chance that this question is going to be perceived as heretical, but I feel that I either need to speak now or hold my peace.
Is XHTML really a good choice for the file extension and doctype for Facelets templates?
Consider my argument. When we use xhtml as a file extension and include the xhtml doctype, we are saying, "This file validates as XHTML." Well, with all those Facelets tags in there, it sure doesn't. If you use the "jsfc" attribute of Facelets to augment a file that really is XHTML, then maybe that small violation is not so bad. But when the root tag of the file is ui:composition, you are beginning to stray pretty far from the path.
Let me make a suggestion. We can all agree that Facelets templates must be valid XML. JSPX is a valid XML syntax that we can use. But it is sort of verbose and again, we are mixing meanings. How about a new file extension, one that won't confuse the IDEs. How about (f)acelet (c)omposition (t)emplate (FCT)? But then again, should we tie ourselves to Facelets or have a "generic" page extension?
I swear, I am not trying to stir the pot for no good reason. It just seems that calling files XHTML when they aren't isn't such a good idea.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048515#4048515
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4048515
18 years, 11 months