-
1. Re: rich:hotKey (since I saw the blog post)
meetoblivion Jan 17, 2009 9:05 PM (in response to meetoblivion)now that i'm looking at it, firefox's webdeveloper plugin is pointing this out
Error: syntax error Source File: http://localhost:8080/view/liveBlog/FirstLiveBlog Line: 35, Column: 90 Source Code: new Richfaces.hotKey('j_id31:j_id36','return','', {timing:'immediate'}, function(event) { .click() });
-
2. Re: rich:hotKey (since I saw the blog post)
nbelaevski Jan 18, 2009 8:29 AM (in response to meetoblivion)Hello,
I'm looking at how:#{rich:element('button')}.click()
is output:function(event) { .click() }
Please check that id='button' component is present on the page -
3. Re: rich:hotKey (since I saw the blog post)
meetoblivion Jan 18, 2009 12:42 PM (in response to meetoblivion)No, it's not, and it's not on the blog post either (thus implying that it's not needed).
I did however add it at one point and assumed it was the wrong move because I get a stack trace like this:javax.faces.FacesException: javax.el.ELException: /liveBlog/viewLiveBlog.xhtml @38,98 value="#{viewLiveBlogBean.availableCharacters}": Error reading 'availableCharacters' on type com.tad.apps.blog.liveblogs.ViewLiveBlog_$$_javassist_39 at javax.faces.component.UIOutput.getValue(UIOutput.java:187) at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:201) at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:284) at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:154) at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:861) at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:286) at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:124) at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:67) at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:115) at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:67) at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:115) at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:67) at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:115) at org.ajax4jsf.renderkit.AjaxContainerRenderer.encodeAjax(AjaxContainerRenderer.java:123) at org.ajax4jsf.component.AjaxViewRoot.encodeAjax(AjaxViewRoot.java:677) at org.ajax4jsf.component.AjaxViewRoot.encodeChildren(AjaxViewRoot.java:548) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:930) at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592) at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100) at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176) at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83) at org.jboss.seam.web.RewriteFilter.doFilter(RewriteFilter.java:63) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178) at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390) at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517) at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92) at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126) at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619) Caused by: javax.el.ELException: /liveBlog/viewLiveBlog.xhtml @38,98 value="#{viewLiveBlogBean.availableCharacters}": Error reading 'availableCharacters' on type com.tad.apps.blog.liveblogs.ViewLiveBlog_$$_javassist_39 at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:76) at javax.faces.component.UIOutput.getValue(UIOutput.java:184) ... 68 more Caused by: org.jboss.seam.core.LockTimeoutException: could not acquire lock on @Synchronized component: viewLiveBlogBean at org.jboss.seam.core.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:41) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185) at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103) at com.tad.apps.blog.liveblogs.ViewLiveBlog_$$_javassist_39.getAvailableCharacters(ViewLiveBlog_$$_javassist_39.java) at sun.reflect.GeneratedMethodAccessor490.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at javax.el.BeanELResolver.getValue(BeanELResolver.java:62) at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53) at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72) at org.jboss.el.parser.AstPropertySuffix.getValue(AstPropertySuffix.java:53) at org.jboss.el.parser.AstValue.getValue(AstValue.java:67) at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186) at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71) ... 69 more
The getter in question is defined as:public void setSmartName(String smartName) { this.smartName = smartName; } public int getAvailableCharacters() { if(postText == null) return 1024; else return 1024 - postText.length(); } public String getPostText() { return postText; } public void setPostText(String postText) { this.postText = postText; }
-
4. Re: rich:hotKey (since I saw the blog post)
nbelaevski Jan 18, 2009 4:30 PM (in response to meetoblivion)Caused by: org.jboss.seam.core.LockTimeoutException: could not acquire lock on @Synchronized compone nt: viewLiveBlogBean
is @Synchronized really necessary here?
P.S. Can you please post a link to the blog post you are talking about? -
5. Re: rich:hotKey (since I saw the blog post)
meetoblivion Jan 18, 2009 6:46 PM (in response to meetoblivion)http://www.jboss.org/feeds/post/submitting_on_enter
I don't have it marked @Synchronized...
The form works fine if i actually click the button, so i don't think it's that. -
6. Re: rich:hotKey (since I saw the blog post)
nbelaevski Jan 19, 2009 8:12 AM (in response to meetoblivion)Try this:
<rich:hotKey key="return" handler="#{rich:element('addComment')}.click()"/>
-
7. Re: rich:hotKey (since I saw the blog post)
meetoblivion Jan 19, 2009 2:12 PM (in response to meetoblivion)Are you assuming the button has id addComment? If so, it's no different than if it had the id button.
-
8. Re: rich:hotKey (since I saw the blog post)
nbelaevski Jan 19, 2009 3:40 PM (in response to meetoblivion)Works for me:
<a4j:form ajaxSubmit="true"> <h:inputText value="" id="postText"> <a4j:support event="onkeyup" reRender="availableCharacters" /> <a4j:support event="onblur" reRender="availableCharacters" /> </h:inputText> <a4j:commandButton id="addComment" value="Add Comment" reRender="postText,availableCharacters" /> <br /> <h:outputText value="" id="availableCharacters" /> characters left <rich:hotKey key="return" handler="#{rich:element('addComment')}.click()" /> </a4j:form>
Yes, as by your code id of the button is 'addComment'. So, after you changed from 'button' to 'addComment', do you still see Javascript error or server exception? Also looks like there are concurrent AJAX requests, can you please remove <a4j:support event="onkeyup" reRender="availableCharacters" /> and check? -
9. Re: rich:hotKey (since I saw the blog post)
meetoblivion Jan 19, 2009 9:15 PM (in response to meetoblivion)well hmm this seems like odd results to me. This block works perfect..
<a4j:form ajaxSubmit="true"> <h:inputText value="#{viewLiveBlogBean.postText}" id="postText" class="postText"> <a4j:support event="onkeyup" reRender="availableCharacters" /> </h:inputText> <a4j:commandButton id="button" action="#{viewLiveBlogBean.addPost}" value="Add Comment" reRender="postText,availableCharacters"/><br /> <h:outputText value="#{viewLiveBlogBean.availableCharacters}" id="availableCharacters" /> characters left <rich:hotKey key="return" handler="#{rich:element('button')}.click()"/> </a4j:form>
So the question is, did having 2 events occurring break it? Or just the fact that it's a blur event. -
10. Re: rich:hotKey (since I saw the blog post)
ilya_shaikovsky Jan 20, 2009 7:49 AM (in response to meetoblivion)just blur event fired when you click the button. So in your case - two concurrent request sent. and seems its causes the problem.
-
11. Re: rich:hotKey (since I saw the blog post)
meetoblivion Jan 20, 2009 7:55 PM (in response to meetoblivion)while i can see that happening, i don't get why hitting enter would blur the field, the cursor's not leaving it... my thought was that using a hotkey emulates the action, rather than actually doing it. or does richfaces event model state that click moves the active element to the button?
-
12. Re: rich:hotKey (since I saw the blog post)
nbelaevski Jan 20, 2009 10:00 PM (in response to meetoblivion)True, click() should not move focus. I've added onblur handler and do not see it is triggering when typing in input in IE7 & FF3. However I see it blurring in Chrome. Are you using Safari or Chrome?
-
13. Re: rich:hotKey (since I saw the blog post)
nbelaevski Jan 20, 2009 10:01 PM (in response to meetoblivion)Correction: when typing in input and pressing return