[JBoss Seam] - Re: commandLink not initially executing action when clicked
by sjmenden
Below is the showUsers.jsp.
What I want to use is allow the user to click on the R or the S and for that to bind to the userFinder.findFirstPage which will look for the start variable which is set to R or S and find all users that start with and R or S and return the list.
As I said before, when going to the page for the first time, the link will just refresh the page and do nothing and no output, however, if I first search for a user, then I click on the R or the S links, then it all works.
showUsers.jsp:
| <h:form>
| <table>
| <tr >
| <td><h2>Users</h2></td>
| </tr>
| <div>
| <table>
| <tr>
| <td align="left">
| ...
| ...
| ...
| <h:commandLink value="R" action="#{userFinder.findFirstPage}">
| <f:param name="start" value="R"/>
| </h:commandLink>
| <h:commandLink value="S" action="#{userFinder.findFirstPage}">
| <f:param name="start" value="S"/>
| </h:commandLink>
| ...
| ...
| ...
| </td>
| </tr>
| </table>
| </div>
| <table>
| <tr>
| <td colspan="5">
| <div>
| <div>
| <div>
| <div>
| <span>User:</span>
| <h:inputText value="#{userFinder.example.username}" size="15" required="true"/>
| <h:commandButton type="submit" value="Search" action="#{userFinder.findFirstPage}"/>
| </div>
| <br />
| <h:selectManyCheckbox
| value="#{userFinder.searchColumns}"
| layout="lineDirection"
| required="true">
| <f:selectItems value="#{userFinder.searchColumnItems}" />
| </h:selectManyCheckbox>
| <br />
| <span>(for wildcard search use %)</span>
| </div>
| </div>
| </div>
| </td>
| </tr>
| </table>
|
| <h:dataTable value="#{userList}" var="user" rendered="#{userList.rowCount > 0}">
| <h:column>
| <f:facet name="header">
| <h:commandLink value="Username" action="#{userFinder.reorder}">
| <f:param name="orderBy" value="username"/>
| </h:commandLink>
| </f:facet>
| <h:outputText value="#{user.username}"/>
| </h:column>
|
| <h:column>
| <f:facet name="header">
| <h:commandLink value="Company" action="#{userFinder.reorder}">
| <f:param name="orderBy" value="company"/>
| </h:commandLink>
| </f:facet>
| <h:outputText value="#{user.company}"/>
| </h:column>
|
| <h:column>
| <f:facet name="header">
| <h:outputText value="Name"/>
| </f:facet>
| <h:outputText value="#{user.firstName} #{user.lastName}"/>
| </h:column>
|
| <h:column>
| <f:facet name="header">
| <h:commandLink value="Email Address" action="#{userFinder.reorder}">
| <f:param name="orderBy" value="email"/>
| </h:commandLink>
| </f:facet>
| <h:outputText value="#{user.email}"/>
| </h:column>
|
| <h:column>
| <f:facet name="header">
| <h:commandLink value="Active" action="#{userFinder.reorder}">
| <f:param name="orderBy" value="active"/>
| </h:commandLink>
| </f:facet>
| <h:outputText value="#{user.active}"/>
| </h:column>
| </h:dataTable>
|
| <h:commandButton action="#{userFinder.findPreviousPage}" value="Previous Page" disabled="#{!userFinder.previousPage}" />
| <h:commandButton action="#{userFinder.findNextPage}" value="Next Page" disabled="#{!userFinder.nextPage}" />
| </h:form>
|
Here is my UserFinderBean with only the relevant information to this question. If you want to see the full code, see my previous post.
| @Name("userFinder")
| @Stateful
| @Scope(ScopeType.SESSION)
| public class UserFinderBean implements UserFinder {
|
| @DataModel
| private List<User> userList;
|
| @DataModelSelection
| private User selectedUser;
|
| @PersistenceContext
| private EntityManager entityManager;
|
| private void executeQuery() {
| Map<String, Object> parameters = new HashMap<String, Object>();
| StringBuffer queryString = new StringBuffer();
|
| if(start != null && !start.equals("")) {
| queryString.append(" or user.username" + " like :value or user.username like :valuetwo ");
| parameters.put("value", start + "%");
| parameters.put("valuetwo", start.toLowerCase() + "%");
| }
|
| Query query = entityManager.createQuery(queryString.toString());
| for (Entry <String, Object> param : parameters.entrySet()) {
| query.setParameter( param.getKey(), param.getValue() );
| }
| userList = (List<User>) query.setMaxResults(pageSize)
| .setFirstResult(pageSize*pageNumber)
| .getResultList();
| }
|
| public String findFirstPage() {
| executeQuery();
| return null;
| }
|
| @Destroy @Remove
| public void destroy() {}
|
|
| @RequestParameter
| private String start;
|
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3963028#3963028
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3963028
19 years, 9 months
[JBoss jBPM] - Re: async actions never starting
by hosierdm
Yeah, I started seeing this same problem. Once you get the SQL error, async stops working completely. I believe somewhere in the chain of errors you will see a message saying that the command executor thread has stopped. I didn't really connect the dots on that until after reading this though. The problem I believe I was having is that if an error occurs in a delegation class, jbpm wants to stick the stack trace into the jbpm_message table. Well, most stack traces are pretty large, and it was causing the SQL error for me every time. Furthermore, the jbpm_message table entry would never get removed. So when I would restart the server, the process would run again and cause the same SQL error. I kind of fixed the problem by commenting out the part in the jbpm code where it sets the error stack trace into the jbpm_message entry. That prevented it at least from breaking async for good when an error occurs.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3963026#3963026
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3963026
19 years, 9 months
[JBoss Seam] - Component Not getting Initialized by Seam
by klsateesh
Hi All,
I have a Stateless SessionBean which is not getting initialized by Seam when i depoly the .ear File..
The SesionBean is
|
| @Name("dpaSliderListener")
| @Stateless
| @Interceptors(SeamInterceptor.class)
|
| public class SliderListener implements ISliderListenerLocal {
|
| public String setValue(String selectedVal){
| return "You selected "+selectedVal;
| }
|
| }
|
My components.xml is
| <components>
| <component name="org.jboss.seam.core.init">
| <property name="debug">true</property>
| <property name="myFacesLifecycleBug">true</property>
| <property name="jndiPattern">DPA/#{ejbName}/local</property>
| </component>
| <component name="org.jboss.seam.core.manager">
| <property name="conversationTimeout">120000</property>
| </component>
| <component class="org.jboss.seam.core.Ejb" installed="false"/>
| </components>
|
In my .xhtml file i have the java script as listed below
| <script type="text/javascript" src="seam/remoting/resource/remote.js">
| </script>
| <script type="text/javascript" src="seam/remoting/interface.js?dpaSliderListener">
| </script>
| <script type="text/javascript">
| //<![CDATA[
| function sendData(document.currentSlider.valueX) {
| Seam.Component.getInstance("dpaSliderListener").setValue(document.currentSlider.valueX, setValueForSlider);
| }
| function setValueForSlider(result) {
| alert(result);
| }
|
| // ]]>
| </script>
|
Here is the Console log
|
| 16:37:17,688 INFO [EARDeployer] Init J2EE application: file:/D:/MyServers/JBoss4.0.4P1/server/default/deploy/DPA.ear
| 16:37:23,767 WARN [MainDeployer] Found non-jar deployer for jboss-seam.jar: MBeanProxyExt[jboss.ejb3:service=EJB3Deploy
| er]
| 16:38:47,039 INFO [Ejb3DescriptorHandler] adding class annotation org.jboss.annotation.internal.DefaultInterceptorMarke
| r to com.lmco.dpa.SliderListener org.jboss.annotation.internal.DefaultInterceptorMarkerImpl@1fc6dc6
| 16:38:47,211 INFO [Ejb3Deployment] EJB3 deployment time took: 1031
| 16:38:47,289 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=DPA.ear,jar=DPA-ejb.jar,name=SliderListener,s
| ervice=EJB3 with dependencies:
| 16:38:47,461 INFO [EJBContainer] STARTED EJB: com.lmco.dpa.SliderListener ejbName: SliderListener
| 16:38:47,523 INFO [EJB3Deployer] Deployed: file:/D:/MyServers/JBoss4.0.4P1/server/default/tmp/deploy/tmp46165DPA.ear-co
| ntents/DPA-ejb.jar
| 16:38:47,742 INFO [TomcatDeployer] deploy, ctxPath=/DPA-war, warUrl=.../tmp/deploy/tmp46165DPA.ear-contents/DPA-war-exp
| .war/
| 16:38:49,242 INFO [FacesConfigurator] Reading standard config org/apache/myfaces/resource/standard-faces-config.xml
| 16:38:49,461 INFO [FacesConfigurator] Reading config jar:file:/D:/MyServers/JBoss4.0.4P1/server/default/tmp/deploy/tmp4
| 6165DPA.ear-contents/jboss-seam.jar!/META-INF/faces-config.xml
| 16:38:49,461 INFO [FacesConfigurator] Reading config jar:file:/D:/MyServers/JBoss4.0.4P1/server/default/tmp/deploy/tmp4
| 6165DPA.ear-contents/jboss-seam-ui.jar!/META-INF/faces-config.xml
| 16:38:49,477 INFO [FacesConfigurator] Reading config jar:file:/D:/MyServers/JBoss4.0.4P1/server/default/tmp/deploy/tmp4
| 6165DPA.ear-contents/jboss-seam-debug.jar!/META-INF/faces-config.xml
| 16:38:49,492 INFO [FacesConfigurator] Reading config jar:file:/D:/MyServers/JBoss4.0.4P1/server/default/tmp/deploy/tmp4
| 6165DPA.ear-contents/jsf-facelets.jar!/META-INF/faces-config.xml
| 16:38:49,492 INFO [FacesConfigurator] Reading config jar:file:/D:/MyServers/JBoss4.0.4P1/server/default/tmp/deploy/tmp4
| 6165DPA.ear-contents/DPA-war-exp.war/WEB-INF/lib/jboss-seam-ui.jar!/META-INF/faces-config.xml
| 16:38:49,508 INFO [FacesConfigurator] Reading config jar:file:/D:/MyServers/JBoss4.0.4P1/server/default/tmp/deploy/tmp4
| 6165DPA.ear-contents/DPA-war-exp.war/WEB-INF/lib/jboss-seam.jar!/META-INF/faces-config.xml
| 16:38:49,524 INFO [FacesConfigurator] Reading config /WEB-INF/faces-config.xml
| 16:38:49,758 WARN [LocaleUtils] Locale name in faces-config.xml null or empty, setting locale to default locale : en_US
|
| 16:38:50,180 INFO [StartupServletContextListener] ServletContext 'D:\MyServers\JBoss4.0.4P1\server\default\.\tmp\deploy
| \tmp46165DPA.ear-contents\DPA-war-exp.war\' initialized.
| 16:38:50,180 INFO [ServletContextListener] Welcome to Seam 1.0.1.GA
| 16:38:50,242 INFO [Initialization] no components.xml file found
| 16:38:50,242 INFO [Initialization] reading properties from: /jndi.properties
| 16:38:50,258 INFO [Initialization] initializing Seam
| 16:38:50,399 INFO [Component] Component: org.jboss.seam.core.init, scope: APPLICATION, type: JAVA_BEAN, class: org.jbos
| s.seam.core.Init
| 16:38:50,539 INFO [Component] component =Component(org.jboss.seam.core.init) and hashCode =3723432 BeanClass =class org
| .jboss.seam.core.Init getClass =class org.jboss.seam.Component
| 16:38:50,539 INFO [Component] result =org.jboss.seam.core.Init@adb3f getClass=org.jboss.seam.core.Init@adb3f hashCod
| e =711487
| 16:38:50,539 INFO [Component] Component: org.jboss.seam.core.pages, scope: APPLICATION, type: JAVA_BEAN, class: org.jbo
| ss.seam.core.Pages
| 16:38:50,555 INFO [Component] Component: events, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.Events
|
| 16:38:50,571 INFO [Component] Component: org.jboss.seam.core.manager, scope: EVENT, type: JAVA_BEAN, class: org.jboss.s
| eam.core.Manager
| 16:38:50,602 INFO [Component] Component: switcher, scope: PAGE, type: JAVA_BEAN, class: org.jboss.seam.core.Switcher
| 16:38:50,617 INFO [Component] Component: redirect, scope: CONVERSATION, type: JAVA_BEAN, class: org.jboss.seam.core.Red
| irect
| 16:38:50,617 INFO [Component] Component: httpError, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.Htt
| pError
| 16:38:50,633 INFO [Component] Component: userPrincipal, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core
| .UserPrincipal
| 16:38:50,649 INFO [Component] Component: isUserInRole, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.
| IsUserInRole
| 16:38:50,664 INFO [Component] Component: conversation, scope: CONVERSATION, type: JAVA_BEAN, class: org.jboss.seam.core
| .Conversation
| 16:38:50,680 INFO [Component] Component: conversationList, scope: PAGE, type: JAVA_BEAN, class: org.jboss.seam.core.Con
| versationList
| 16:38:50,680 INFO [Component] Component: conversationStack, scope: PAGE, type: JAVA_BEAN, class: org.jboss.seam.core.Co
| nversationStack
| 16:38:50,696 INFO [Component] Component: facesContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.
| FacesContext
| 16:38:50,696 INFO [Component] Component: pageContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.P
| ageContext
| 16:38:50,711 INFO [Component] Component: eventContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.
| EventContext
| 16:38:50,711 INFO [Component] Component: sessionContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.cor
| e.SessionContext
| 16:38:50,727 INFO [Component] Component: statelessContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.c
| ore.StatelessContext
| 16:38:50,727 INFO [Component] Component: applicationContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam
| .core.ApplicationContext
| 16:38:50,742 INFO [Component] Component: conversationContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.sea
| m.core.ConversationContext
| 16:38:50,742 INFO [Component] Component: businessProcessContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.
| seam.core.BusinessProcessContext
| 16:38:50,805 INFO [Component] Component: locale, scope: STATELESS, type: JAVA_BEAN, class: org.jboss.seam.core.Locale
| 16:38:50,805 INFO [Component] Component: messages, scope: SESSION, type: JAVA_BEAN, class: org.jboss.seam.core.Messages
|
| 16:38:50,821 INFO [Component] Component: interpolator, scope: STATELESS, type: JAVA_BEAN, class: org.jboss.seam.core.In
| terpolator
| 16:38:50,821 INFO [Component] Component: facesMessages, scope: CONVERSATION, type: JAVA_BEAN, class: org.jboss.seam.cor
| e.FacesMessages
| 16:38:50,836 INFO [Component] Component: resourceBundle, scope: SESSION, type: JAVA_BEAN, class: org.jboss.seam.core.Re
| sourceBundle
| 16:38:50,867 INFO [Component] Component: localeSelector, scope: SESSION, type: JAVA_BEAN, class: org.jboss.seam.core.Lo
| caleSelector
| 16:38:50,883 INFO [Component] Component: uiComponent, scope: STATELESS, type: JAVA_BEAN, class: org.jboss.seam.core.UiC
| omponent
| 16:38:50,899 INFO [Component] Component: org.jboss.seam.remoting.messaging.subscriptionRegistry, scope: APPLICATION, ty
| pe: JAVA_BEAN, class: org.jboss.seam.remoting.messaging.SubscriptionRegistry
| 16:38:50,914 INFO [Component] Component: pojoCache, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.Poj
| oCache
| 16:38:51,102 INFO [Component] component =Component(applicationContext) and hashCode =4990595 BeanClass =class org.jboss
| .seam.core.ApplicationContext getClass =class org.jboss.seam.Component
| 16:38:51,102 INFO [Component] result =org.jboss.seam.core.ApplicationContext@1748ba4 getClass=org.jboss.seam.core.Ap
| plicationContext@1748ba4 hashCode =24415140
| 16:38:51,102 INFO [Component] component =Component(isUserInRole) and hashCode =8116333 BeanClass =class org.jboss.seam.
| core.IsUserInRole getClass =class org.jboss.seam.Component
| 16:38:51,102 INFO [Component] result =org.jboss.seam.core.IsUserInRole@bdff3b getClass=org.jboss.seam.core.IsUserInR
| ole@bdff3b hashCode =12451643
| 16:38:51,102 INFO [Component] component =Component(statelessContext) and hashCode =907329 BeanClass =class org.jboss.se
| am.core.StatelessContext getClass =class org.jboss.seam.Component
| 16:38:51,102 INFO [Component] result =org.jboss.seam.core.StatelessContext@f09995 getClass=org.jboss.seam.core.State
| lessContext@f09995 hashCode =15767957
| 16:38:51,102 INFO [Component] component =Component(userPrincipal) and hashCode =10135900 BeanClass =class org.jboss.sea
| m.core.UserPrincipal getClass =class org.jboss.seam.Component
| 16:38:51,102 INFO [Component] result =org.jboss.seam.core.UserPrincipal@1e4d960 getClass=org.jboss.seam.core.UserPri
| ncipal@1e4d960 hashCode =31775072
| 16:38:51,102 INFO [Component] component =Component(sessionContext) and hashCode =24859001 BeanClass =class org.jboss.se
| am.core.SessionContext getClass =class org.jboss.seam.Component
| 16:38:51,102 INFO [Component] result =org.jboss.seam.core.SessionContext@121f956 getClass=org.jboss.seam.core.Sessio
| nContext@121f956 hashCode =19003734
| 16:38:51,102 INFO [Component] component =Component(facesContext) and hashCode =24686841 BeanClass =class org.jboss.seam
| .core.FacesContext getClass =class org.jboss.seam.Component
| 16:38:51,102 INFO [Component] result =org.jboss.seam.core.FacesContext@aab87f getClass=org.jboss.seam.core.FacesCont
| ext@aab87f hashCode =11188351
| 16:38:51,102 INFO [Component] component =Component(businessProcessContext) and hashCode =3587082 BeanClass =class org.j
| boss.seam.core.BusinessProcessContext getClass =class org.jboss.seam.Component
| 16:38:51,102 INFO [Component] result =org.jboss.seam.core.BusinessProcessContext@17360be getClass=org.jboss.seam.cor
| e.BusinessProcessContext@17360be hashCode =24338622
| 16:38:51,102 INFO [Component] component =Component(eventContext) and hashCode =30698528 BeanClass =class org.jboss.seam
| .core.EventContext getClass =class org.jboss.seam.Component
| 16:38:51,102 INFO [Component] result =org.jboss.seam.core.EventContext@106e02e getClass=org.jboss.seam.core.EventCon
| text@106e02e hashCode =17227822
| 16:38:51,102 INFO [Component] component =Component(pageContext) and hashCode =6819952 BeanClass =class org.jboss.seam.c
| ore.PageContext getClass =class org.jboss.seam.Component
| 16:38:51,102 INFO [Component] result =org.jboss.seam.core.PageContext@f3387 getClass=org.jboss.seam.core.PageContext
| @f3387 hashCode =996231
| 16:38:51,102 INFO [Component] component =Component(conversationContext) and hashCode =735 BeanClass =class org.jboss.se
| am.core.ConversationContext getClass =class org.jboss.seam.Component
| 16:38:51,102 INFO [Component] result =org.jboss.seam.core.ConversationContext@bc839a getClass=org.jboss.seam.core.Co
| nversationContext@bc839a hashCode =12354458
| 16:38:51,117 INFO [Initialization] done initializing Seam
| 16:38:51,196 INFO [EARDeployer] Started J2EE application: file:/D:/MyServers/JBoss4.0.4P1/server/default/deploy/DPA.ear
|
How ever in my .xhtml page when i view the source i don't see the dpaSliderListener.js File and hence it is giving a JavaScript Error ..
I don't see any Error in the server console..
I see the stateless session bean in my JNDI View..
| Global JNDI Namespace
|
| +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
| +- DPA (class: org.jnp.interfaces.NamingContext)
| | +- SliderListener (class: org.jnp.interfaces.NamingContext)
| | | +- local (proxy: $Proxy62 implements interface com.lmco.dpa.ISliderListenerLocal,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
| +- TopicConnectionFactory (class: org.jboss.naming.LinkRefPair)
|
Thanks
Sateesh
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3963025#3963025
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3963025
19 years, 9 months
[JBoss Seam] - Re: A couple of observations
by iradix
anonymous wrote : I can see uses for this, but remember you can do bijection etc. through Component and the Context.
True, but then why not always use method calls and disregard annotations all together? It seems to me that most of the functionality is available programatically, but the annotations, and maybe more importantly the method interception and automatic bijection that go along with them make life a lot easier.
Also, thanks for pointing out the logger which is another good example of why bijection is still very handy in plain java beans that don't necessarily need to live in a context themselves.
anonymous wrote : Yeah. Something similar to the Hibernate Naming Strategy I think would be a good idea.
Cool. Anybody else?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3963023#3963023
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3963023
19 years, 9 months