Problem with coercion on Java 7
Hi all I have such strange problem with data incomming from a client's form with Java7. I have created a generic entity, which is a superclass for all other entities in applications. This class contains getter and setter for ID. Getter is generic, setter - due Tapestry5 coercions - expects Object and converts it to proper type inside the method setId(Object). The generic entity is here: https://code.google.com/p/fishear/source/browse/fishear-data/src/main/java/net/fishear/data/generic/entities/GenericEntity.java In applications themselves, the less generic implementation is used, which implements ID as Long: https://code.google.com/p/fishear/source/browse/fishear-data/src/main/java/net/fishear/data/generic/entities/AbstractEntity.java (the fishear project is very early, please excuse many missing things in classes). Note the method setId(Object) is not generic due Tapestry5 - in forms, in case ID is null and the ID field (from the entity) is part of the form - T5 tries to convert empty String (comming from form) to setter type - Long in this case, which result to en exception. The solution (let setter for ID non-generic) worked up to JAVA version 6 (T5 passed the String to the entity as it was). But in Java7 - T5 tries convert string to Long anyway. Why?. The best solution for me would be to convert empty string (incomming from client's form) to null object, also leave null value as null (do not throw exception) - it would allow me to make setId() method generic too (I think this is great ide generaly). Or to have possibility to change system coercer with the custom one for any type pair already registered. But the solution used currently (and functional with Java6) will be sufficient if it is functional in Java7. I tried add custom coercion, but I can't change system coercion (String - Long) - I can only add new one, which does not function (due the same type already exists?) Any ideas? Thanks Radek
Custom coercion from String to Long
Hi all I need the cutom coercion from String to Long, which will translate empty strings to null Long value. I tried add contribution to my AppModule, but with no success - coercion to Long is still processed by old manner. Is there any way to do it? Thans. Here is part of my AppModule: public static void contributeTypeCoercer(ConfigurationCoercionTuple configuration) { CoercionString, Long cc = new CoercionString, Long() { public Long coerce(String input) { if(input == null || input.length() == 0) { return null; } return new Long(input); } }; CoercionTupleString, Long tuple = new CoercionTupleString, Long(String.class, Long.class, cc); configuration.add(tuple); }
Re: LinkSubmit doesn't work
I'm sorry, I mistook in WAR's URL. the correct is http://www.gapo.cz/download/genusinum.war http://www.gapo.cz/downloads/genusinum.war
Re: NPE in afterRender method in Tomcat
I'm vwr sorry, I'm stupid.The constant Constants.REQUIRED_LOGIN_RQATR was null. But I'm surprised the Tomcat does not provide any reasonable message. Dne 7.6.2010 22:13, Radek Terber napsal(a): Hi I have such problem: I have quite simple T5 application - (T5 + hibernate), currently compiled under T 5.1.0.5. When I run it under Jetty (ver. 8.0.0), it runs fine. But when I try it to start under Tomcat, I get NullPointerException that (probably) indicates the underline request is null. I tested it under Tomcat 6.0.18, 6.0.20 and 6.0.26. Tomcats was pure installations - with no aditional libraries. It runs under Java 6.18 on Win7, the same problem in on Linux and Java 6.16. I could post application's war somewhere, but it is quite big (cca 28M including libraries), ant it requires our application server running anywhere in LAN to run. Here it the eception: --- [ERROR] TapestryModule.RequestExceptionHandler Processing of request failed with uncaught exception: Render queue error in AfterRender[Index :layout.loginform]: org.apache.tapestry5.ioc.internal.util.TapestryException org.apache.tapestry5.internal.services.RenderQueueException: Render queue error in AfterRender[Index:layout.loginform]: org.apache.tapestry5 .ioc.internal.util.TapestryException [at classpath:cz/gapo/weby/jmenovky/components/layout/Layout.tml, line 25] at org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:86) at org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:121) ... (I deleted it) ... at java.lang.Thread.run(Thread.java:619) Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException [at classpath:cz/gapo/weby/jmenovky/components/layout/Layout.tml, line 25] at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:948) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$400(ComponentPageElementImpl.java:49) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.callback(ComponentPageElementImpl.java:159) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AfterRenderPhase.render(ComponentPageElementImpl.java:374) at org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:74) ... 68 more Caused by: java.lang.NullPointerException at org.apache.catalina.connector.Request.getAttribute(Request.java:877) at org.apache.catalina.connector.RequestFacade.getAttribute(RequestFacade.java:263) at cz.gapo.webapps.common.t5.components.LoginForm.afterRender(LoginForm.java:127) at cz.gapo.webapps.common.t5.components.LoginForm.afterRender(LoginForm.java) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AfterRenderPhase.invokeComponent(ComponentPageElementImpl.java:369) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.run(ComponentPageElementImpl.java:164) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:933) ... 72 more The code fragment cause it: --- @Inject private RenderSupport rsup; @Inject private Request request; @AfterRender public void afterRender(MarkupWriter wr) { boolean requireLogin = request.getAttribute(Constants.REQUIRED_LOGIN_RQATR) != null; // here the NPE is thrown, but the request is not null if (requireLogin) { rsup.addScript($j(function() {); rsup.addScript($j(\#loginFormDialog\).dialog(\option\, \modal\, false);); rsup.addScript($j(\#loginFormDialog\).dialog(\open\);); rsup.addScript(});); } } --- Thanks for any ideas. Radek - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
NPE in afterRender method in Tomcat
Hi I have such problem: I have quite simple T5 application - (T5 + hibernate), currently compiled under T 5.1.0.5. When I run it under Jetty (ver. 8.0.0), it runs fine. But when I try it to start under Tomcat, I get NullPointerException that (probably) indicates the underline request is null. I tested it under Tomcat 6.0.18, 6.0.20 and 6.0.26. Tomcats was pure installations - with no aditional libraries. It runs under Java 6.18 on Win7, the same problem in on Linux and Java 6.16. I could post application's war somewhere, but it is quite big (cca 28M including libraries), ant it requires our application server running anywhere in LAN to run. Here it the eception: --- [ERROR] TapestryModule.RequestExceptionHandler Processing of request failed with uncaught exception: Render queue error in AfterRender[Index :layout.loginform]: org.apache.tapestry5.ioc.internal.util.TapestryException org.apache.tapestry5.internal.services.RenderQueueException: Render queue error in AfterRender[Index:layout.loginform]: org.apache.tapestry5 .ioc.internal.util.TapestryException [at classpath:cz/gapo/weby/jmenovky/components/layout/Layout.tml, line 25] at org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:86) at org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:121) ... (I deleted it) ... at java.lang.Thread.run(Thread.java:619) Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException [at classpath:cz/gapo/weby/jmenovky/components/layout/Layout.tml, line 25] at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:948) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$400(ComponentPageElementImpl.java:49) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.callback(ComponentPageElementImpl.java:159) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AfterRenderPhase.render(ComponentPageElementImpl.java:374) at org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:74) ... 68 more Caused by: java.lang.NullPointerException at org.apache.catalina.connector.Request.getAttribute(Request.java:877) at org.apache.catalina.connector.RequestFacade.getAttribute(RequestFacade.java:263) at cz.gapo.webapps.common.t5.components.LoginForm.afterRender(LoginForm.java:127) at cz.gapo.webapps.common.t5.components.LoginForm.afterRender(LoginForm.java) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AfterRenderPhase.invokeComponent(ComponentPageElementImpl.java:369) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.run(ComponentPageElementImpl.java:164) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:933) ... 72 more The code fragment cause it: --- @Inject private RenderSupport rsup; @Inject private Request request; @AfterRender public void afterRender(MarkupWriter wr) { boolean requireLogin = request.getAttribute(Constants.REQUIRED_LOGIN_RQATR) != null;// here the NPE is thrown, but the request is not null if (requireLogin) { rsup.addScript($j(function() {); rsup.addScript($j(\#loginFormDialog\).dialog(\option\, \modal\, false);); rsup.addScript($j(\#loginFormDialog\).dialog(\open\);); rsup.addScript(});); } } --- Thanks for any ideas. Radek - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: NPE in afterRender method in Tomcat
No, the app is single thread, quite clear, no experiments... Here is the self contained variant of war (with no dependencies to oour app server): http://www.gapo.cz/downloads/genusinum.war I guess to some library which the application is depend on (in combination with Tomcat libraries ??), but I have no tools and experiences to deterrmine it. Dne 7.6.2010 22:58, Howard Lewis Ship napsal(a): Caused by: java.lang.NullPointerException at org.apache.catalina.connector.Request.getAttribute(Request.java:877) at org.apache.catalina.connector.RequestFacade.getAttribute(RequestFacade.java:263) That's really showing that it's gone beyond the Tapestry code and back into the Tomcat (catalina) code. Are you doing something tricky with threads, like trying to do part of the render is a background thread? You'll probably need to single-step down ingo the catalina code to see what's exactly going on. Not enough information here to diagnose. On Mon, Jun 7, 2010 at 1:13 PM, Radek Terberlst@post.cz wrote: Hi I have such problem: I have quite simple T5 application - (T5 + hibernate), currently compiled under T 5.1.0.5. When I run it under Jetty (ver. 8.0.0), it runs fine. But when I try it to start under Tomcat, I get NullPointerException that (probably) indicates the underline request is null. I tested it under Tomcat 6.0.18, 6.0.20 and 6.0.26. Tomcats was pure installations - with no aditional libraries. It runs under Java 6.18 on Win7, the same problem in on Linux and Java 6.16. I could post application's war somewhere, but it is quite big (cca 28M including libraries), ant it requires our application server running anywhere in LAN to run. Here it the eception: --- [ERROR] TapestryModule.RequestExceptionHandler Processing of request failed with uncaught exception: Render queue error in AfterRender[Index :layout.loginform]: org.apache.tapestry5.ioc.internal.util.TapestryException org.apache.tapestry5.internal.services.RenderQueueException: Render queue error in AfterRender[Index:layout.loginform]: org.apache.tapestry5 .ioc.internal.util.TapestryException [at classpath:cz/gapo/weby/jmenovky/components/layout/Layout.tml, line 25] at org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:86) at org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:121) ... (I deleted it) ... at java.lang.Thread.run(Thread.java:619) Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException [at classpath:cz/gapo/weby/jmenovky/components/layout/Layout.tml, line 25] at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:948) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$400(ComponentPageElementImpl.java:49) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.callback(ComponentPageElementImpl.java:159) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AfterRenderPhase.render(ComponentPageElementImpl.java:374) at org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:74) ... 68 more Caused by: java.lang.NullPointerException at org.apache.catalina.connector.Request.getAttribute(Request.java:877) at org.apache.catalina.connector.RequestFacade.getAttribute(RequestFacade.java:263) at cz.gapo.webapps.common.t5.components.LoginForm.afterRender(LoginForm.java:127) at cz.gapo.webapps.common.t5.components.LoginForm.afterRender(LoginForm.java) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AfterRenderPhase.invokeComponent(ComponentPageElementImpl.java:369) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.run(ComponentPageElementImpl.java:164) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:933) ... 72 more The code fragment cause it: --- @Inject private RenderSupport rsup; @Inject private Request request; @AfterRender public void afterRender(MarkupWriter wr) { boolean requireLogin = request.getAttribute(Constants.REQUIRED_LOGIN_RQATR) != null;// here the NPE is thrown, but the request is not null if (requireLogin) { rsup.addScript($j(function() {); rsup.addScript($j(\#loginFormDialog\).dialog(\option\, \modal\, false);); rsup.addScript($j(\#loginFormDialog\).dialog(\open\);); rsup.addScript(});); } } --- Thanks for any ideas. Radek - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail:
Re: How tell T5 to return HTML page (not JSON) on AJAX call
The behavoior of combination of JQ tabs and T5 is quite strange. Tabs are loaded dynamically using it's links like this: div id=content class=ui-tabs ui-widget ul id=content-tabs-handles li id=actualTab a t:type=pageLink t:page=switch t:context=literal:actualAktuálne(/a /li li id=switchTab a t:type=pageLink t:page=switch t:context=literal:archiveArchív/a /li ...etc... /ul In case the tab content is loaded firt time, all is OK, tab content is loaded sucesfully, T5 server returns content type text/html with the page rendered. But if a T5 grid exists inside the returned content, after click on link in grid header (= change sorting), or on pagination links, the T5 server returns content type text/json and only {} = empty JSON. Sort and pagination links are rendered as event links by T5 - for example: http://localhost:8080/actual.content.grid.columns:sort/serialNum;. This is the only difference. If I compared request sent in first time content is loaded with subsequent requests (sent in case sort links are clicked on), I did not find any differences (except URL): in both cases, the header field X-Requested-With=|XMLHttpRequest| exists. When I striped out the X-Requested-With header field (using FF header modification plugin), all was OK - server always returned HTML. Dne 11.5.2010 3:36, Alex Kotchnev napsal(a): Radek, what if you just point the URL that's used w/ jQuery tabs to a regular Tapestry page ? If I recall correctly, the jQuery tabs used aul, and each li witha href=# inside had an URL of a standalone page that renders w/o any particular layout . Regards, Alex K 2010/5/10 Radek Terberter...@b2bcentrum.cz Hi all I try to use jQuery tabs together with the T5 grid in simple page - the page with grid is put as content of a tab (it seams to be good idea due application could be divided into amall pieces - without static component dependencies, as it is required by tabs made using T5, and I can combine T5 pages with other resources in tabs). It works fine, but grid's links for paging and sorting does not function. I have registered listeners on onclick evets on those links and send AJAX request to T5, but T5 - when gets XmlHttpRequest - does not render HTML page, but it returns enpty JSON. How to tel the T5 to render notmal HTML page in respone on XmlHttpRequest (aka AJAX request) ? I cannot use ajax variant of grid sorting and paging, I need just use the page. Thanks, radek. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: How tell T5 to return HTML page (not JSON) on AJAX call
No, the grid is not zone-enabled. When I tried to use zone-enabled grid in this environment, the grid did not refresh at all. Dne 11.5.2010 9:55, Inge Solvoll napsal(a): I'm guessing that the grid links are zone-enabled, so clicking them triggers AJAX calls rather than direct links. On Tue, May 11, 2010 at 9:17 AM, Radek Terberter...@b2bcentrum.cz wrote: The behavoior of combination of JQ tabs and T5 is quite strange. Tabs are loaded dynamically using it's links like this: div id=content class=ui-tabs ui-widget ul id=content-tabs-handles li id=actualTab a t:type=pageLink t:page=switch t:context=literal:actualAktuálne(/a /li li id=switchTab a t:type=pageLink t:page=switch t:context=literal:archiveArchív/a /li ...etc... /ul In case the tab content is loaded firt time, all is OK, tab content is loaded sucesfully, T5 server returns content type text/html with the page rendered. But if a T5 grid exists inside the returned content, after click on link in grid header (= change sorting), or on pagination links, the T5 server returns content type text/json and only {} = empty JSON. Sort and pagination links are rendered as event links by T5 - for example: http://localhost:8080/actual.content.grid.columns:sort/serialNum;. This is the only difference. If I compared request sent in first time content is loaded with subsequent requests (sent in case sort links are clicked on), I did not find any differences (except URL): in both cases, the header field X-Requested-With=|XMLHttpRequest| exists. When I striped out the X-Requested-With header field (using FF header modification plugin), all was OK - server always returned HTML. Dne 11.5.2010 3:36, Alex Kotchnev napsal(a): Radek, what if you just point the URL that's used w/ jQuery tabs to a regular Tapestry page ? If I recall correctly, the jQuery tabs used aul, and each li witha href=#inside had an URL of a standalone page that renders w/o any particular layout . Regards, Alex K 2010/5/10 Radek Terberter...@b2bcentrum.cz Hi all I try to use jQuery tabs together with the T5 grid in simple page - the page with grid is put as content of a tab (it seams to be good idea due application could be divided into amall pieces - without static component dependencies, as it is required by tabs made using T5, and I can combine T5 pages with other resources in tabs). It works fine, but grid's links for paging and sorting does not function. I have registered listeners on onclick evets on those links and send AJAX request to T5, but T5 - when gets XmlHttpRequest - does not render HTML page, but it returns enpty JSON. How to tel the T5 to render notmal HTML page in respone on XmlHttpRequest (aka AJAX request) ? I cannot use ajax variant of grid sorting and paging, I need just use the page. Thanks, radek. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
How tell T5 to return HTML page (not JSON) on AJAX call
Hi all I try to use jQuery tabs together with the T5 grid in simple page - the page with grid is put as content of a tab (it seams to be good idea due application could be divided into amall pieces - without static component dependencies, as it is required by tabs made using T5, and I can combine T5 pages with other resources in tabs). It works fine, but grid's links for paging and sorting does not function. I have registered listeners on onclick evets on those links and send AJAX request to T5, but T5 - when gets XmlHttpRequest - does not render HTML page, but it returns enpty JSON. How to tel the T5 to render notmal HTML page in respone on XmlHttpRequest (aka AJAX request) ? I cannot use ajax variant of grid sorting and paging, I need just use the page. Thanks, radek. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: get the service by ID and autoload services
Thiago H. de Paula Figueiredo napsal(a): Em Thu, 07 Jan 2010 10:57:33 -0200, Radek Terber ter...@b2bcentrum.cz escreveu: Hi all Hi! 1) Is there any way to obtain service by it's service ID (similarly like Spring's getBean(String) method does)? I would like to build general autocomplet component which gets service ID (as String) and returns list of entities corresponding to given text fragment (which gets too). You can't get a service only by its name in Tapestry-IoC. I just can't figure out why this would be needed for an autocomplete component or mixin, specially when Tapestry already provides one (the Autocomplete mixin). I plan create universal client autocomplet combo with key-value pair (like the HTML select has). On server side, I would like to have one service which (via ajax) get other service name and method name (both configured in template, or eventually in normal HTML page) and text fragment typped by user, and it returns set of corresponding key-value pairs. It is often repeated use case and I think this would be usefull. 2) Is there possibility to autoload services without need explicitly registering them? Not out of the box, but you can play with ClassNameLocatorImpl in your AppModule.bind() method. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
place assets outside the application context
Hi all. I need place some my assets (images and documents, all saved by end user from browser) outside of the application web context (to prvent clean it while build by maven, and from some other reasons). Is there any way in Tapestry to do so (for example create virtual URL, which will be translated - by tapestry - to real asset location) ? Thanks. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
How to pass message's parameters in template
Hi all. Is there any way how to pass parameter to message directly in TML file ? For example: I have component Example1 (resides in Example1.java) and in it's Example1.tml is something like this: in Example1.tml is -- div xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; ... ${message:any-message-text-requires-parameter} ... /div -- in Example1.properties is -- any-message-text-requires-parameter=Any text which %s here requires parameter -- And now, I would like pass the %s value directly in TML file (to avoid divide those text to two or more fragments). I know possibility to prepare entire message in JAVA class, but it is more coding, more getters ... Thanks. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
more actionlink's context values in *.tml directly
Hi all. Is there any way to put more than one context parameter (for actionlink, pagelink and similar components) directly into tml file (for example param1 and param2 to generate URL in form http://urBase/param1/param2;, something like this: t:actionlink t:id= t:context={param1,param2} ... ) ? I can do it using ComponentResources's method createEventLink..., but I dont know how to do it directly in tml. Thanks. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Difference between prop: and ${...} in PageLink
Hi all. As I know from My experiments, ${ ... } converts each object to string, in contrast to prop:..., which returns object as is. In page link, this difference should not take an effect. But in parameters this is significant ... Kai Weber napsal(a): Hi, I am a Tapestry beginner. I am far from knowing all the internals. I use the PageLink component in one of my as follows: @Component(id=backLink, parameters={ page=${backLink}, context=backLinkContext, anchor=${prev.getUniqueIdentifier()}}) private PageLink backLink; My question is now What does the ${...} do? I fail to see what this means: If I replace context=prop:backLinkContext with context=${backLinkContext} I get a different link than expected. If I replace page=prop:backLink with page=${backLink} I get no different link. Why? Kai - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: dynamic components in page
Thanks for responses. Using ajax (via component zone) is one of possibly solutions. But, ideally, i would like to solve this without Java Script - ideally all should be done on server side. I try refine my question. My idea was something like this: The component's Index.tml div xmlns:t=... ... Some Boundary Begin ... t:dynamicComponent t:source=requiredComponent / !-- this is the idea. It could be (eventually) parametrized using additional attributes ... -- ... Some Boundary End ... /div public class Index { @Inject private ComponentFactory componentFactory; // or any other service to obtaint component's instance, ComponentResources ... ?? public Object getRequiredComponent() { String pathToComponent = getPathFromAnywhere(); AnyComponentClass componentInstance = componentFactory.getOrLoadComponent(pathToComponent); // or any other way to obtain component's instance dynamically (without injection) // do something with componentInstance return componentInstance; } } There could be more ways to obtain component's instance: using path, using component class, ... ?? This is idea only. I do not know if something such this is possible. As far as I know, the component source in template (e.g. something like this: t:component t:id=COMPONENT_SOURCE /) is now reference to page directly (or to field annotated as @Component(id = COMPONENT_SOURCE) ... ) and there cannot be typed any expression (all typed here is interpreted as component´s page link or ID, including brackets ${...}). Radek Terber napsal(a): Hi Is there possibility to render components in T5 page dynamically (in dependency on return value of any method in page´s class for example, or so) ? Methods onEvent... return pages whose are rendered dynamically too - each method can return many pages. I thing it would be possible allow dynamic including components similar way, but i am not able to do it. Thanks. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Problem with cyclic including components
Hi all. I'm new in tapestry 5 and I have a problem with component including. I have two components, each of them need to include the other (the example is here): First class: public class RoleList extends AbstractGridFragmentRole { @Component private SearchRole searchRole; @Inject private RoleAdminService roleAdminService; ... etc ... } Second class: public class SearchRole { @Component(id = roleList) private RoleList roleList; @Component(id = searchForm) private Form searchForm; ... etc ... } The first component (RoleList) is referenced from Index (only this component - nothing else). If the same structure was created as pages (injected using @InjectPage), all was OK. But if I have changed it to components, I obtain exception. I tried replace @Component annotation with @InjectComponent with the same result. I need solve this problem Thanks for suggestions. The exception: - org.apache.tapestry5.ioc.internal.util.TapestryException Component admin/role/Index:rolelist does not contain an embedded component with id 'SearchRole'. Available components: add, clearSearch, delete, detail, grid, if, refreshbutton, search. location classpath: ...package.../pages/admin/role/Index.tml, line 8, column 33 title/title 4 /head 5 body 6 h2${message:role-managemant}/h2 7 8 t:component t:id=roleList / 9 10 p The current time is: ${currentTime}. /p 11 /body 12 /html
dynamic components in page
Hi Is there possibility to render components in T5 page dynamically (in dependency on return value of any method in page´s class for example, or so) ? Methods onEvent... return pages whose are rendered dynamically too - each method can return many pages. I thing it would be possible allow dynamic including components similar way, but i am not able to do it. Thanks. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org