Re: Strange behavior when instantiating properties directly in the page
Hi, Thorsten This is correct behavior. Tapestry pages are shared across all requests, so User object will be the same. you need to add some code like follow: @Persist @Property private User user; @OnEvent(Form.PREPARE) void prepare() { if (user == null) { user = new User(); } } Thorsten Castor wrote: Hi, we just figured out that properties which are instantiated directly will be shared between sessions on the same server. So if you start the example app on two browsers and type some text in the textfield of the first browser, hit enter and reload on the second browser you will see the content here as well. If the property is instantiated lazy in a getter or any other method the content won't be shared. I tested it with 5.0.11, 5.0.12-SNAPSHOT and 5.0.13-SNAPSHOT on jetty-6.1.9 and tomcat-6.0.13. I'm quite new to the list so was this problem discussed before or is it a bug? Here the example I used: public class Index { @Persist @Property private User user = new User(); @Component(id=textField, parameters={value=user.name}) private TextField textField; } html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; head/head body t:form t:textfield t:id=textField/ /t:form /body /html public class User { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Page pool exausted?
Look at http://tapestry.apache.org/tapestry5/tapestry-core/guide/conf.html for parameters tapestry.page-pool.hard-limit and tapestry.page-pool.soft-limit Peter Stavrinides wrote: Hi All, I have a peculiar error turning up in our server logs, I am running a Tapestry 5 application on Tomcat 6: Render queue error in BeginRender[hf/Client:wrapper.header.pagelink_0]: The page pool for page 'hf/Home' (in locale en) has been exausted: there are 20 instances currently being used and no more can be created. Try increasing the hard limit (symbol tapestry.page-pool.hard-limit) to allow additional instances to be created, or increasing the soft wait (symbol tapestry.page-pool.soft-wait) to trade away some throughput for more efficient use of page instances. I guess my question is how do I configure the application to be efficient and scalable for at least 200 - 500 users as a baseline, this morning I had only 15 sessions connected to the Tapestry application for testing, and got this error. Please advise! is there potentially a memory leak here? or is this simply a configuration issue? I have not seen many articles on tuning Tapestry applications, has anyone dealt with this? Thanks for your help, Peter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Persistence pains
The problem in client strategy that it used Serializable mechanism of jvm. Of cause it produce a lot of data (not getting in mind that most domain objects are not Serializable). I use own persistent strategy called 'parameter'. It is similar to client with follow exceptions. * It uses ValueEncoder to convert from Object to String and from String to Object. It save a lot of space, because for domain object only it id is persistent, which is rarely longer than 6 characters. * It persist each field in separate parameters (when client persist all data in parameter t:ac) . In this way it is similar to activation context's friendly url behavior. User see somethings like this http://somewhere.com/page?user=123order=12item=5 With help of this strategy I persist data between request to the same page. It solves both: problem with multiple browser tabs and problem with too many persistent fields in session. Ivan Dubrov wrote: Right. Most annoying things for us about “session” and “flash” scopes was that they don’t work in several tabs. And “client” can’t hold too much data. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Strange return for grid component
Stacktrace and some source and *.tml code will be helpful. Methods definition is not enough to see the problem 滕训华 write: I have a grid component in the page of T5 and its sources is got from db.There is also another search field to filter the records. I defined 2 method in my service class: ListCustomerInfo getAllCustomers() ListCustomerInfo search(String key) when init this page will return all customers it run normally,but when I input some to press the search button,it give me a error page: An unexpected application exception has occurred. Index: 4, Size: 4 I do not know why and how to slove this.please help .thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is it possible to receive uploaded files from non-tapestry pages?
Hi, Ken May be it possible but will be hard to achieve, because T5 (you use T5, don't you?) use hidden fields with internal information with every form. Without this information form can't be processed. As for your stacktrace: You try to change character encoding for request when it is too late for this. If you do this as RequestHandler it should be placed first in chain. But probably usage of javax.servlet.ServletFilter is more appropriated. Ken wrote: Hi. I wrote simple HTML like below start.html: form action=/myapp/upload method=post enctype=multipart/form-data input type=file/ input type=submit/ /form and very very simple tapestry codes. Upload.java: public class Upload {} When I press submit button in the HTML file, following error is occurred. What I should to do? Thanks for advice. [ERROR] RequestExceptionHandler Processing of request failed with uncaught exception: getReader() or getInputStream() called java.lang.IllegalStateException: getReader() or getInputStream() called at org.mortbay.jetty.servlet.ServletHttpRequest.setCharacterEncoding(ServletHttpRequest.java:602) at com.example.myapp.services.AppModule$1.service(AppModule.java:74) at $RequestFilter_1197ee90f59.service($RequestFilter_1197ee90f59.java) at $RequestHandler_1197ee90f5b.service($RequestHandler_1197ee90f5b.java) at org.apache.tapestry.internal.services.LocalizationFilter.service(LocalizationFilter.java:42) at $RequestHandler_1197ee90f5b.service($RequestHandler_1197ee90f5b.java) at org.apache.tapestry.services.TapestryModule$3.service(TapestryModule.java:553) at $RequestHandler_1197ee90f5b.service($RequestHandler_1197ee90f5b.java) at org.apache.tapestry.services.TapestryModule$2.service(TapestryModule.java:520) at $RequestHandler_1197ee90f5b.service($RequestHandler_1197ee90f5b.java) at org.apache.tapestry.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:79) at $RequestHandler_1197ee90f5b.service($RequestHandler_1197ee90f5b.java) at org.apache.tapestry.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:93) at org.apache.tapestry.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:84) at org.apache.tapestry.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:77) at org.apache.tapestry.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:106) at $RequestHandler_1197ee90f5b.service($RequestHandler_1197ee90f5b.java) at $RequestHandler_1197ee90f51.service($RequestHandler_1197ee90f51.java) at org.apache.tapestry.services.TapestryModule$12.service(TapestryModule.java:924) at org.apache.tapestry.upload.internal.services.MultipartServletRequestFilter.service(MultipartServletRequestFilter.java:43) at $HttpServletRequestHandler_1197ee90f52.service($HttpServletRequestHandler_1197ee90f52.java) at org.apache.tapestry.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62) at $HttpServletRequestFilter_1197ee90f50.service($HttpServletRequestFilter_1197ee90f50.java) at $HttpServletRequestHandler_1197ee90f52.service($HttpServletRequestHandler_1197ee90f52.java) at $HttpServletRequestHandler_1197ee90f4e.service($HttpServletRequestHandler_1197ee90f4e.java) at org.apache.tapestry.TapestryFilter.doFilter(TapestryFilter.java:168) at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75) at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821) at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:471) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568) at org.mortbay.http.HttpContext.handle(HttpContext.java:1530) at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:633) at org.mortbay.http.HttpContext.handle(HttpContext.java:1482) at org.mortbay.http.HttpServer.service(HttpServer.java:909) at org.mortbay.http.HttpConnection.service(HttpConnection.java:820) at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986) at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837) at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245) at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357) at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534) - To unsubscribe, e-mail: [EMAIL PROTECTED]
Re: ComponentEventException on Form Submit with Ajax
You can return Block or Component from listener only when tapestry is precessing _ajax_ request. 'this.form.submit()' is not an ajax. As I know currently there is no ajax support for radio button (may be I am wrong), but you can look into code of TriggerFragment mixin and adopt this code for radio button. Petros Petrou пишет: Yes returning void is a typo. What I am trying to achieve is the following: I have two versions of a searchCriteriaForm. I have a second form (configureSearchCriteriaForm) that contains two radio buttons. Depending on which radio button is selected an onclick event submits this form to decide which searchCriteriaForm will be used. The searchCriteriaForm is contained in a zone. Now, when the searchCriteriaForm is submitted another zone is updated (searchResultsZone) that contains a Grid component. The code below should make everything clearer. Configure search criteria t:form t:id=configureSearchCriteriaForm zone=searchCriteriaZone t:radio t:id=searchCriteria1 onclick=this.form.submit()/ t:radio t:id=searchCriteria1 onclick=this.form.submit()/ !-- onSuccess of this form the block searchCriteriaBlock is returned-- /t:form Specify search criteria t:zone t:id=searchCriteriaZone t:block t:id=searchCriteriaBlock t:form t:id=searchCriteriaForm zone=searchResultsZone !-- onSuccess of this form the block searchResultsBlock is returned and this works fine if the searchCriteriaZone and searchCriteriaForm are returned /t:form /t:block t:zone Display search results t:zone t:id=searchResultsZone t:block t:id=searchResultsBlock t:grid source=foundEntitiesList/ /t:block /t:zone Petros - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5 Checkbox Problem
When form submission occurs Tapestry5 do not look at binding that was used during render phase. Instead it use ValueEncoder to restore object from String id. If you do not provide an ValueEncoder (I think you don't, do you?) tapestry will use default. Default ValueEncoder use java serialization mechanism for conversion from and to object. So when your form is submitted _new_ objects are deserialized from serialization data. Those object are not the same objects as in actorList (equals will return true, but == will return false). To solve the problem you need to provide your own ValueEncoder. Something similar to follow. tr t:type=Loop source=displayActorList value=actor encoder=encoder tdt:checkbox t:value=actor.enabled//td td${actor.name}/td /tr public ValueEncoder getEncoder() { return new ValueEncoder() { public String toClient(Object value) { // TODO: indexOf is not very effective operation return String.valueOf(getDisplayActorList().indexOf(value)); } public Object toValue(String clientValue) { return getDisplayActorList().get(Integer.parseInt(clientValue)); } }; } With code above you do not ever need to persist actorList, because it is restored from getStoredActorList every request. Tim Sawyer пишет: Hi Folks, I have a list of checkboxes on a page: tr t:type=Loop source=displayActorList value=actor tdt:checkbox t:value=actor.enabled//td td${actor.name}/td /tr The method to return the displayActorList is public ListActor getDisplayActorList() { if (this.getActorList() == null) { this.setActorList(this.getStoredActorList()); } return this.getActorList(); } where actor list is persistant. @Persist private ListActor actorList; The problem I'm having is that after submitting the page with my checkbox list in, the actor list is not being updated with the new values. Can anyone suggest what I could be doing wrong? Thanks, Tim. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is there a way to include a component with fields in a form ?
Stephane Decleire пишет: Hi, In my application, i have got several forms with the same bunch of fields and other different fields. What i would like is to create a component with the bunch of fields and include it in the forms. But the validateForm event is only managed by the page where my form is declared and i can not catch it in the component itself so i can not record crossfield errors. And i can neither record crossfield errors in the page because the fields are declared in the component and not in the page ... Any idea ? Stephane Hi, Stephane Here is short description of possible solution: Inject environmental FormSupport object into you component @Environmental() private FormSupport formSupport; In the end step of render add listener to formSupport. By adding listener in later render phase you ensure that fields get their values are validated before cross field validation occurs @CleanupRender void cleanupRender() { formSupport.store(new ValidateAction(this)); } Create listener class static class ValidateAction implements ComponentActionYouComponentClassname, Serializable { public void execute(YouComponentClassname component) { //TODO: add validate action here. // you may get ValidationTracker from environment (the same way as you get FormSupport) } } Best Regards, Dmitry Shyshkin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IE6 issue with dropdowns
It is not tapestry problem. In IE6 dropdown always display at top of others page elements. As work around you may use javascript dropdown. For example you may look at dojo combobox http://dojotoolkit.org/book/dojo-book-0-9/part-2-dijit/form-validation-specialized-input/auto-completer sasidhar пишет: Hi, In a web page, when a menu / floating pane is displayed over a dropdown, dropdown overlaps the menu / floating pane. This problem is observed only in IE6 (works fine in IE7 and firefox) Note : i am using @propertySelection component. Tapestry version - 4.1.3. Is there a way to workaround this? Thanks in advance sasidhar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: Now to generate page with binary output
Hello, all I want to generate image by tapestry page. Follow code successfully set Content-Type and output image data, but after that exception is thrown : java.lang.RuntimeException: Page resource/Image did not generate any markup when rendered. This could be because its template file could not be located, or because a render phase method in the page prevented rendering. Is there is a way to tell tapestry that page output is binary and ResposeWriter won't be used for generation? I've thought about StreamResponse but it accepted only from action events, not from render phase events. @Inject private Response _response; @BeginRender void render() throws IOException { Image image = ...; IOUtil.transfer(image.getImage().getBinaryStream(), _response.getOutputStream(image.getContentType())); } Thanks, Dmitry - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Do I have to @persist( session ) input values in verify page?
Persistence is needed because form is submitted in one request (that send redirect in response) and rendered in second request. If you do not want to persist data for form you should 1. turn off redirect after post and process submission in one request public class WebModule { public static void contributeApplicationDefaults(MappedConfigurationString, String configuration) { configuration.add(TapestryConstants.SUPPRESS_REDIRECT_FROM_ACTION_REQUESTS_SYMBOL, true); } } 2. Disallow form to persist ValidationTracker (if you need this). in .tml form t:type=form tracket=tracker ... /form in .java @Property(write = false) private ValidationTracker tracker; osamuo пишет: Register.tml: let a user register a value Verify.tml: let a user verify a input Register.tml --- form t:type=Form t:id=form input t:type=TextField t:value=someValue / input type=submit / /form --- Register.java --- public class Register{ @Property private String someValue; @InjectPage private Verify verifyPage; public Object onSuccessFromForm() verifyPage.setSomeValue( someValue ); return verifyPage; } } Verify.tml - form t:type=Form t:id=form input t:type=TextField t:value=someValue / input type=submit / /form - Verify.java - public class Verify{ @Persist( session ) == I don't want to store this into the session. private String someValue; public String getSomeValue(){ return someValue; } public void setSomeValue( String someValue ){ this.someValue = someValue; } public Object onSuccessFromForm(){ ... } } - Is there any way to submit someValue in Verify.tml without using @Persist( session )? And why don't T5 support t:type=Hidden? Thanks, Osamuo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: Stop current event bubbling but continue processing of other events
Hi, all. Is there a way to stop bubbling of current event? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Stop current event bubbling but continue processing of other events
Non null value stop processing of all other event and start page rendering. But it actually not what I need. I have a multiple onActivate event handlers with different count of arguments, and I want to process only one of them. void onActivate(Long id) { object = loadobject(id); // do something to stop bubling here } void onActivate() { object = newobject(); } Stephane Decleire пишет: The event will bubble up the hierarchy, until it is aborted. The event is aborted when an event handler method returns a non-null value. (http://tapestry.apache.org/tapestry5/tapestry-core/guide/event.html) Stephane Dmitry Shyshkin a écrit : Hi, all. Is there a way to stop bubbling of current event? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Stop current event bubbling but continue processing of other events
I've found the answer. To achieve this you should return 'true' from event handler. Dmitry Shyshkin пишет: Non null value stop processing of all other event and start page rendering. But it actually not what I need. I have a multiple onActivate event handlers with different count of arguments, and I want to process only one of them. void onActivate(Long id) { object = loadobject(id); // do something to stop bubling here } void onActivate() { object = newobject(); } Stephane Decleire пишет: The event will bubble up the hierarchy, until it is aborted. The event is aborted when an event handler method returns a non-null value. (http://tapestry.apache.org/tapestry5/tapestry-core/guide/event.html) Stephane Dmitry Shyshkin a écrit : Hi, all. Is there a way to stop bubbling of current event? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: t5: onValidationFromForm ?
1. You may replace submit action with some other .I'am sure you do not need form field values in case back button was pressed. change input type=submit value=back/ to input type=button value=back/ or input type=reset value=back/ 2. In case if you need it you may set defer parameter to false in Submit component and receive submit event before validation Angelo Chen пишет: Hi, following is the order of events fired when a form is submitted, I'd like to avoid validation by setting a flag in the onSelectedFromBackButton, but can't find a way, onValidateFromForm is always called before any onAction or onSelected, even I do an ajax call to onSelectedFromBackupButton, any idea? thanks onValidateFromForm onSelectedFromBackButton - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T4: EventListener on multiple elements
Hello, All. I want to apply the only @EventListener(onchange) for multiple form elements (say checkboxes or selectboxes). Each of them is placed into his own row in the table (table is not a component, it's formed using @For by tr). But the problem here is that I do not know how many table rows I will have in the table so can't specify explicit targets/elements for @EventListener annotation (because I do not know its identifiers). I'd also like to get informed about the source of the event (table row id for example). Thanks in advance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]