[JBoss Seam] - Re: Evaluation of action attibute in s:link
by dmitriy.lapko
But why should we stop on such a simple solution? Let's evolve this idea (dynamic EL construction) till the whole madness?
Why only parameter value should be dynamic? What about bean name or action name? If action value used only on invoke application phase, and on rendering phase it is converted to MethodBinding object for validation (I'm not sure it is true)?
For example:
<s:link action="#{#{beanNameToEvaluate}.#{methodNameToEvaluate}(#{valueToEvaluate)})}" .../>
Looks ugly, eha?
But sometimes I thought about it - because of my humble knowledge of problems with it, as I can see the result of such construction only as a GET paramet in URL of the link.
So, may be it just possible to allow next code:
<s:link dynaAction="#{beanNameToEvaluate}.#{methodNameToEvaluate}(#{valueToEvaluate)})" .../>
like additional attribute for tag s:link which will try to evaluate the code before considering it's contents as method name during page rendering phase?
Wouldn't it be convenient?
Again, in another words,
<s:link action="#{someBean.doSomeAction('value1')}" ... />
may be convenient to write as
<s:link dynaAction="someBean.doSomeAction('value1')" ... />
or
<s:link dynaAction="#{'someBean.doSomeAction(\'value1\')'}" ... />
which looks more real...
It will work the same way but with pre-evaluation of given expression.
For JSP tags it can be something like this:
package org.jboss.seam.ui.tag;
|
| import javax.el.ELContext;
| import javax.el.ELException;
| import javax.el.ValueExpression;
| import javax.faces.FacesException;
| import javax.faces.component.ActionSource;
| import javax.faces.component.UIComponent;
| import javax.faces.context.FacesContext;
| import javax.faces.el.MethodBinding;
|
| @SuppressWarnings("deprecation")
| public class DynaLinkTag extends LinkTag {
|
| private String dynaAction;
|
| protected void setProperties(UIComponent component) {
| super.setProperties(component);
| setDynaActionProperty(getFacesContext(), component, getDynaAction());
| }
|
| public static void setDynaActionProperty(FacesContext context, UIComponent component, String dynaAction) {
| if (dynaAction != null) {
| if (!(component instanceof ActionSource)) {
| throw new IllegalArgumentException("Component " + component.getClientId(context) + " is no ActionSource");
| }
| if (isValueReference(dynaAction)) {
| ValueExpression vb = component.getValueExpression(dynaAction);
| ELContext elContext = FacesContext.getCurrentInstance().getELContext();
| String actionValue = null;
| try {
| actionValue = (String) vb.getValue(elContext);
| } catch (ELException ele) {
| throw new FacesException(ele);
| }
| MethodBinding mb = context.getApplication().createMethodBinding(actionValue, null);
| ((ActionSource) component).setAction(mb);
| } else {
| component.getAttributes().put("outcome", dynaAction);
| }
| }
| }
|
| public String getDynaAction() {
| return this.dynaAction;
| }
|
| public void setDynaAction(String dynaAction) {
| this.dynaAction = dynaAction;
| }
| }
|
|
For Facelets it needs changes in Facelets code, I think, it is not so obvious as for JSP...
What do you think?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067933#4067933
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4067933
18Â years, 9Â months
[JBoss Messaging] - Problem after mcving from 1.3 to 1.4
by HibsMax
Hi, Group.
I had this test application setup using JBM 1.3 and it was working but with some problems. I decided to upgrade to the latest version of JBM and now I get errors after the server has started. I think there is something that I need to do but I don't really know where to start looking. Any ideas based on the stack traces below?
12:42:43,351 ERROR [MessagingXAResourceWrapper] ********************************Failed to connect to server
javax.naming.NameNotFoundException: DefaultJMSProvider not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at org.jboss.jms.server.recovery.MessagingXAResourceWrapper.getConnectionFactory(MessagingXAResourceWrapper.java:343)
at org.jboss.jms.server.recovery.MessagingXAResourceWrapper.connect(MessagingXAResourceWrapper.java:300)
at org.jboss.jms.server.recovery.MessagingXAResourceWrapper.getDelegate(MessagingXAResourceWrapper.java:259)
at org.jboss.jms.server.recovery.MessagingXAResourceWrapper.recover(MessagingXAResourceWrapper.java:107)
at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.xaRecovery(XARecoveryModule.java:746)
at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.resourceInitiatedRecovery(XARecoveryModule.java:685)
at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.periodicWorkSecondPass(XARecoveryModule.java:179)
at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.doWork(PeriodicRecovery.java:237)
at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.run(PeriodicRecovery.java:163)
12:42:43,356 WARN [loggerI18N] [com.arjuna.ats.internal.jta.recovery.xarecovery1] Local XARecoveryModule.xaRecovery got XA exception javax.transaction.xa.XAException: Error trying to connect to provider DefaultJMSProvider, XAException.XAER_RMERR
12:42:43,356 ERROR [MessagingXAResourceWrapper] ********************************Failed to connect to server
javax.naming.NameNotFoundException: DefaultJMSProvider not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at org.jboss.jms.server.recovery.MessagingXAResourceWrapper.getConnectionFactory(MessagingXAResourceWrapper.java:343)
at org.jboss.jms.server.recovery.MessagingXAResourceWrapper.connect(MessagingXAResourceWrapper.java:300)
at org.jboss.jms.server.recovery.MessagingXAResourceWrapper.getDelegate(MessagingXAResourceWrapper.java:259)
at org.jboss.jms.server.recovery.MessagingXAResourceWrapper.recover(MessagingXAResourceWrapper.java:107)
at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.xaRecovery(XARecoveryModule.java:771)
at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.resourceInitiatedRecovery(XARecoveryModule.java:685)
at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.periodicWorkSecondPass(XARecoveryModule.java:179)
at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.doWork(PeriodicRecovery.java:237)
at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.run(PeriodicRecovery.java:163)
I didn't get these error messages before. The first occurrence is 10s after startup then every 130s after that.
Thanks, Anders
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067931#4067931
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4067931
18Â years, 9Â months