[JBoss Seam] - Seam JSF controls do not work in external Facelet templates
by nagypalg
Hi,
When I use the following in a Facelet XHTML file, it works perfectly, validates the input, and shows the error message if validation fails:
<s:decorate id="telefonNummer" template="/layout/edit.xhtml">
| <ui:define name="label">#{messages['wbe.adresse.telefonNummer']}</ui:define>
| <h:inputText id="telefonNummerInput" size="50" maxlength="50"
| value="#{adresseEditor.instance.telefonNummer}" required="true">
| <a:support event="onblur" reRender="telefonNummer"/>
| </h:inputText>
| </s:decorate>
(/layout/edit.xhtml is the file generated by seamgen)
If I extract this fragment to a facelet composite and include it by ui:include or declare it as a facelet tag, it still validates, but the validation error messages show up only in the log, but not in the GUI. I get messages like this in the log:
anonymous wrote : INFO: WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
| sourceId=adresse:telefonNummerInput[severity=(WARN 1), summary=(Größe muss zwischen 5 und 50 liegen), detail=(Größe muss zwischen 5 und 50 liegen)]
The external template is the following:
<!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:ui="http://java.sun.com/jsf/facelets"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:c="http://java.sun.com/jstl/core"
| xmlns:fn="http://java.sun.com/jsp/jstl/functions"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:a="https://ajax4jsf.dev.java.net/ajax"
| xmlns:fa="http://www.disy.net/cadenza/fa">
|
| THIS TEXT WILL BE REMOVED
| <ui:composition>
| <c:set var="messageKey" value="wbe.#{entity}.#{property}" />
| <c:set var="labelMessage" value="#{messages[messageKey]}" />
| <c:if test="#{empty maxLength}">
| <c:set var="maxLength" value="#{size}" />
| </c:if>
| <c:if test="#{empty special}">
| <c:set var="special" value="false" />
| </c:if>
| <c:if test="#{special}">
| <c:set var="propInstance" value="#{editor[property]}" />
| </c:if>
| <c:if test="#{not special}">
| <c:set var="propInstance" value="#{editor.instance[property]}" />
| </c:if>
| <c:if test="#{empty reRender}">
| <c:set var="reRender" value="#{property}" />
| </c:if>
| <c:if test="#{empty required}">
| <c:set var="required" value="false" />
| </c:if>
|
| <s:decorate id="#{property}" template="/layout/edit.xhtml">
| <ui:define name="label">
| <h:outputText value="#{labelMessage}" />
| </ui:define>
| <h:inputText id="#{property}Input" size="#{size}"
| maxlength="#{maxLength}" value="#{propInstance}">
| <a:support event="onblur" reRender="#{reRender}"
| required="#{required}" />
| </h:inputText>
| </s:decorate>
| </ui:composition>
| THIS TEXT WILL BE REMOVED AS WELL
| </html>
|
and I invoke it as:
<fa:inputText editor="#{adresseEditor}" entity="adresse" property="telefonNummer" size="50" required="true"/>
The HTML code that is generated by the inline version (working) and the template/tag version (does not work) seems to be identical.
I also had problems with the s:link tag: it worked when I used it directly in a facelet template and stopped working in an external composite template.
My question: is it a known issue? If yes, is it intended, i.e., Seam JSF controls should not be used in facelet components? If not, will it be (has it been) corrected in Seam 2? Or is there a workaround also for Seam 1.2.1?
My setup: SUN RI 1.2, Tomcat 5.5, Seam 1.2.1GA
--
Gabor
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4082867#4082867
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4082867
18 years, 7 months
[Installation, Configuration & DEPLOYMENT] - Error while trying to deploy WAR file
by asafrr
Hi all,
I?m trying to deploy a war file. After running run.bat and the JBoss server was up and ready, I tried to deploy war file and got the following messages to the console:
10:01:53,571 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
10:01:53,571 INFO [Server] JBoss (MX MicroKernel) [4.2.1.GA (build: SVNTag=JBoss_4_2_1_GA date=200707131605)] Started in 56s:858ms
10:37:31,655 INFO [TomcatDeployer] deploy, ctxPath=/_006, warUrl=.../tmp/deploy/tmp11345523_006-exp.war/
10:37:31,779 ERROR [STDERR] log4j:ERROR A "org.jboss.logging.appender.FileAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
10:37:31,779 ERROR [STDERR] log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
10:37:31,779 ERROR [STDERR] log4j:ERROR [WebappClassLoader delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
java.net.FactoryURLClassLoader@798249
] whereas object of type
10:37:31,779 ERROR [STDERR] log4j:ERROR "org.jboss.logging.appender.FileAppender" was loaded by [org.jboss.system.server.NoAnnotationURLClassLoader@1dd7056].
10:37:31,795 ERROR [STDERR] log4j:ERROR Could not instantiate appender named "FILE".
Can you please help me? i realy don't know what im doing wrong
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4082866#4082866
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4082866
18 years, 7 months
[JBossWS] - Re: wsconsume - Problems regarding http://www.w3.org/2001/XM
by vashistvishal
Have a look at this... what i have posted
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=118062
I have also experienced issues like this when generating stubs for clients.
To resolve issues like this even with the newer stack i had to modify wsdl by hand for interoperability.
The way i did is first i created a service and client within Jboss and see how it work and what SOAP packet goes on wire...
Then do a same sort of thing on .NEt side and capture SOAP packet.
Now try to send the SOAP packet what .NET expects, for that you will have to modify your wsdl by hand. Once you know the difference between .NET side generated WSDL and required by Jboss ws client stack you cam modify other WSDLs. Some heavy lifting required to grasp the differences
Mos of the issues i have come across is Because JAX-WS is pretty strict where as older stacks were not that strict in some conventions.
All SOAP toolkit work fine within same envioronment but when used with other you normally have to fiddle with WSDL to make them work. Interoperability is their but with some modifications not just out of box yet.
I hope this helps..
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4082859#4082859
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4082859
18 years, 7 months
[JBoss Seam] - Re: ResourceBundle in Database
by Zerg-Spirit
@Scope(APPLICATION)
| @BypassInterceptors
| @Name("org.jboss.seam.core.resourceLoader")
| public class ExtendedResourceLoader extends
| org.jboss.seam.core.ResourceLoader {
|
| /**
| * Method called to load a bundle
| * @param bundleName the name of the bundle to load.
| * @return the ResourceBundle.
| */
| public ResourceBundle loadBundle(final String bundleName) {
| return new CustomResourceBundle();
| }
|
| /**
| * Private ResourceBundle fetching messages from the database
| */
| private class CustomResourceBundle extends ResourceBundle{
| java.util.Locale locale;
| //the Locale of that ResourceBundle
| Map<String,String> map;
| //this map store the messages in the database
|
| public CustomResourceBundle(){
| locale = Locale.instance();
| }
|
| @Override
| public Enumeration<String> getKeys() {
| if(map == null){
| map = new HashMap<String,String>();
| }
| map = fetchExpressionsForLocale(locale.toString());
| Vector v = new Vector(map.keySet());
| return v.elements();
| }
|
| @Override
| protected Object handleGetObject(String key) {
| java.util.Locale locale = org.jboss.seam.core.Locale.instance();
| if(map==null)
| getKeys();
| if(DBControl.instance().isDirtyLocale(locale.toString()) || DBControl.instance().isDirtyLocale("ALL")){
| /*checking if this ResourceBundle is dirty, if so, re-fetching updated datas from the database. It might not be a nice way to check it, but I didn't find an other way.*/
| getKeys();
| DBControl.instance().removeDirtyLocale(locale.toString());
| }
| if(map.containsKey(key))
| return map.get(key);
| else
| return key;
| //returning the key if no proper message were found
| }
| }
|
| /**
| * Fetching the expressions from the database matching the current Locale
| * @param locale
| * @return a map containing the translation
| */
| private Map<String,String> fetchExpressionsForLocale(String locale){
| EntityManager entityManager = (EntityManager) Component.getInstance("entityManager");
| Map<String,String> map = new HashMap<String,String>();
| boolean found = false;
| List<Message> messages = entityManager.createQuery("select message from Message message").getResultList();
| for(Message m: messages){
| entityManager.refresh(m);
| /*I'm obliged to do so, cause if 2 Locales are loaded in a short time, and a change was performed in the database, the entityManager seems to use its cache and not the proper data from the db.*/
| for(Expression e: m.getExpressions()){
| //seeking the proper Expression for the current Locale
| if(e.getLanguage().getCode().equals(locale.toString())){
| map.put(m.getKeyValue(), e.getText());
| found = true;
| }
| }
| if(!found){
| //If no proper Expression found for the current locale, adding the expression for the default Locale
| for(Expression e: m.getExpressions()){
| if(e.getLanguage().isDefaultLanguage()){
| map.put(m.getKeyValue(), e.getText());
| found = true;
| }
| }
| if(!found){
| //else, we put the key as its own translation
| map.put(m.getKeyValue(), m.getKeyValue());
| }
| }
| found = false;
| }
| return map;
| }
| }
Note: in my code, a 'Message' is an Entity containing the message keys, and an expression is its translation for a given Locale (Expression table has a link to Language table, Language.code being for example 'en'). Note that I also have a 'default' language to fetch an expression if none was found for a given Locale.
Now my little class DBControl, just a singleton to handle 'dirty locales':
| /**
| * Little singleton class handling dirty Locales
| */
| public class DBControl{
|
| private static DBControl instance;
| private List<String> dirtyLocales;
|
| private DBControl(){}
|
| public static DBControl instance(){
| if(instance==null)
| instance = new DBControl();
| return instance;
| }
|
| public void setDirtyLocale(String locale){
| if(dirtyLocales==null)
| dirtyLocales = new ArrayList<String>();
| if(!dirtyLocales.contains(locale))
| dirtyLocales.add(locale);
| }
|
| public void removeDirtyLocale(String locale){
| if(dirtyLocales!=null){
| for(String s: dirtyLocales){
| if(s.equals(locale)){
| dirtyLocales.remove(s);
| break;
| }
| }
| }
| }
| public boolean isDirtyLocale(String locale){
| if(dirtyLocales!=null){
| for(String s: dirtyLocales){
| if(s.equals(locale))
| return true;
| }
| return false;
| }
| else
| return false;
| }
| }
Thanks to that class, I can access the 'dirtyLocales' list in both my Beans and my ResourceLoader.
Again, don't know if that's really a proper way to do it, waiting for feedback.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4082856#4082856
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4082856
18 years, 7 months
[JBoss Seam] - ejb-jar.xml must either obey the right xml schema or ...
by siegfried@heintze.com
I just tried the helloworld example in the book "JBoss Seam" by Yuan and Heute.
I am running 4.0.5.GA. I get the results below. I did a google search and found someone else was getting this same error back in 2006.
It seems odd that the helloworld example in the book will not work with the last JBoss download. Is there a resolution to this?
Thanks,
Siegfried
01:04:04,343 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../dep
loy/jmx-console.war/
01:04:05,296 INFO [Http11BaseProtocol] Starting Coyote HTTP/1.1 on http-0.0.0.0
-8080
01:04:05,609 INFO [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
01:04:05,625 INFO [JkMain] Jk running ID=0 time=0/47 config=null
01:04:05,734 INFO [Server] JBoss (MX MicroKernel) [4.0.5.GA (build: CVSTag=Bran
ch_4_0 date=200610162339)] Started in 26s:297ms
01:04:40,421 INFO [EARDeployer] Init J2EE application: file:/C:/Program Files/j
boss/4.0.5.GA/server/default/deploy/helloworld.ear
01:04:40,671 ERROR [MainDeployer] Could not create deployment: file:/C:/Program
Files/jboss/4.0.5.GA/server/default/tmp/deploy/tmp36240helloworld.ear-contents/a
pp.jar
org.jboss.deployment.DeploymentException: ejb-jar.xml must either obey the right
xml schema or define a valid DOCTYPE!
at org.jboss.metadata.ApplicationMetaData.importEjbJarXml(ApplicationMet
aData.java:339)
at org.jboss.metadata.XmlFileLoader.load(XmlFileLoader.java:166)
at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:541)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
er.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractIntercept
or.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelM
BeanOperationInterceptor.java:142)
at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor
.java:97)
at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(Intercepto
rServiceMBeanSupport.java:238)
at org.jboss.ws.integration.jboss.DeployerInterceptor.create(DeployerInt
erceptor.java:74)
at org.jboss.ws.integration.jboss.DeployerInterceptorEJB.create(Deployer
InterceptorEJB.java:44)
at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.
create(SubDeployerInterceptorSupport.java:180)
at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterce
ptor.java:91)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy25.create(Unknown Source)
at org.jboss.deployment.MainDeployer.create(MainDeployer.java:969)
at org.jboss.deployment.MainDeployer.create(MainDeployer.java:959)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:818)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4082855#4082855
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4082855
18 years, 7 months