-
1. Re: Gotchas (so far)
gavin.king Nov 12, 2006 11:36 PM (in response to tony.herstell1)1. I think this is normal in facelets.
2. Why on earth not? I'm sure you are mistaken.
3. Not correct, just put the button outside the <f:form/> element that has the validation. (This is standard JSF, nothing to do with Seam.)
4. Yes, this is normal, and is the default in recent (1.1.0.BETA) releases of Seam. That's why the getting started guide says use JBoss 4.0.4 with Seam 1.0.1.
5. We absolutely do not recommend the use of MyFaces tomahawk stuff with Seam, we have found this stuff to be extremely fragile, buggy and generally low quality. We will have examples of Trinidad as soon as there is an actual Trinidad release available (there is already an example on the Wiki).
6. The problem here is that the default SFSB timeout is longer than the default session timeout in JBoss. Bill promises me he will fix this. (You can adjust the SFSB timeout in various ways in JBoss EJB3.)
By the way, if you are not going into production in the next month, I strongly recommend 1.1.0.BETA2 over of 1.0.1.GA. A *lot* of good work has been done in the past few months. -
2. Re: Gotchas (so far)
tony.herstell1 Nov 13, 2006 3:13 AM (in response to tony.herstell1)1. I cannot now reproduce this... (I feel silly)
2. Ok, On Firefox nothing happens with the close, IE7 comes up with a question asking if I want to close the window, which I agree to and then it doesn't close it. (Go Figure...). I guess my javascript must be wrong.
Both come up with the before and after alerts.<td class="rightTop" width="25%"> <form> <table class="rightTop" border="0" width="100%"> <tr> <td class="right"> <label> username: </label> John Doe </td> </tr> <tr> <td class="right"> <input type="button" value="Logout" onclick="javascript:alert('before');window.close();alert('after');" /> </td> </tr> </table> </form> </td>
3. Humm.. Outside of the \<h:form\> If I have a command button then it wont let me have it outide the form; if I use a html input type of button then it can't figure out the bean reference for the action...<h:commandButton type="submit" value="Back" action="#{zoneSubscriptionManager.cancel}"/>
Please advise....
I just don't want to do a browser - back button trigger.. I want to clean up things...
5. Hope some nice ones appear as you suggest they will. Tree is very useful! roll on Trinidad.
6. I will look this up.
I will of course upgrade to 1.1.0.Beta2... I would be on Beta1 but I never got the examples to work wheras 1.0.1 did :/
Now I know more and may be able to solve more problems if it didn't work out of the box.
Thanks to you and Michael Yuan for helpful and prompt replies.
I have booking example broken into xxx.ear, xxx.jar and xxx.war J2EE inter-related projects working well in MyEclipse and with most of the addons of MyEclipse working well. Deploy through the JBoss MyEclipse Plugin works beatufilly as an exploded archive.
-
3. Re: Gotchas (so far)
tony.herstell1 Nov 13, 2006 3:23 AM (in response to tony.herstell1)From the .xhtml file...
<!-- <div class="right"> <h:commandButton type="submit" value="Back" action="#{zoneSubscriptionManager.scancel}"/> </div> -->
this givesAn Error Occurred: Bean: $Proxy89, property: scancel +- Stack Trace javax.el.PropertyNotFoundException: Bean: $Proxy89, property: scancel at com.sun.facelets.el.LegacyELContext$LegacyELResolver.getValue(LegacyELContext.java:146) at com.sun.el.parser.AstValue.getValue(AstValue.java:117) at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192) at com.sun.facelets.el.ELText$ELTextVariable.toString(ELText.java:174) at com.sun.facelets.el.ELText$ELTextComposite.toString(ELText.java:115) at com.sun.facelets.compiler.CommentInstruction.write(CommentInstruction.java:38) at com.sun.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:39) at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:232) at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239) at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:554) at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:30) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112) at java.lang.Thread.run(Thread.java:595)
As its commented out this is VERY weired... Not a SEAM bug though I think. -
4. Re: Gotchas (so far)
pmuir Nov 13, 2006 4:44 AM (in response to tony.herstell1)(1) AFAIK This is a bug with the Facelets user manual - it says comments are skipped by default, when in fact they aren't. You need to explicitly set it to false.
http://wiki.java.net/bin/view/Projects/FaceletsFAQ#How_do_I_prevent_HTML_comments_f
(3) I would propose the alternative of using immediate="true" on the button but keeping it in the form. Both solutions will of course mean the model (entity beans) aren't updated. If you just want to cancel out you can just use a button with a logical (navigation) outcome for the button e.g.<h:commandButton action="home" value="Cancel" />
-
5. Re: Gotchas (so far)
tony.herstell1 Nov 13, 2006 6:47 AM (in response to tony.herstell1)I hear what you say about Facelets and comments. Thanks.
This worked for the button:
<h:commandButton action="mainMenu" value="Cancel" immediate="true" type="submit"/>
It does however ONLY get me back to main menu ( so no chance to @End the conversation or do any other cleanup :( ) -
6. Re: Gotchas (so far)
tony.herstell1 Nov 13, 2006 6:56 AM (in response to tony.herstell1)got it
<h:commandButton action="#{controller.cancel}" value="Cancel" immediate="true" type="submit"/>
Now I can...controller @End public String cancel() { log.info("Cancelled request"); // Other cleanup; release resource etc. return "mainMenu"; }
End.
Thx. -
7. Re: Gotchas (so far)
pmuir Nov 13, 2006 6:56 AM (in response to tony.herstell1)If you want to do some non-trivial cleanup you can still call an action method - just set immediate="true", place the command{Button, Link} inside the form and make sure to NOT flush the persistence context from the method (either use a FlushModeType.MANUAL conversation OR set TransactionAttributeType.NOT_SUPPORTED on the cancel method).
If the cleanup is trivial (conversation control) then use s:conversationPropogation (or of course s:link) which can end or leave-active-but-not-current the conversation.
http://docs.jboss.com/seam/1.1BETA2/reference/en/html/controls.html -
8. Re: Gotchas (so far)
tony.herstell1 Nov 13, 2006 7:12 AM (in response to tony.herstell1)
and make sure to NOT flush the persistence context from the method (either use a FlushModeType.MANUAL conversation OR set TransactionAttributeType.NOT_SUPPORTED on the cancel method).
Not sure I know what this means, as am a newbie to Seam. I am sure it will become clear when I look at dvd store that uses transactions. -
9. Re: Gotchas (so far)
gavin.king Nov 13, 2006 12:23 PM (in response to tony.herstell1)Outside of the \<h:form\> If I have a command button then it wont let me have it outide the form;
Just put it in a different form. -
10. Re: Gotchas (so far)
tony.herstell1 Nov 13, 2006 3:31 PM (in response to tony.herstell1)Thanks; wanted to keep my layout together.
<h:commandButton action="#{controller.cancel}" value="Cancel" immediate="true" type="submit"/>
This worked. -
11. Re: Gotchas (so far)
tony.herstell1 Nov 14, 2006 6:33 PM (in response to tony.herstell1)Another Gotcha....
if you have a@Length(min = 12, max = 30, message = "sim must between 12 and 30 characters long")
on a Database Object that is NOT mandatory (like a post code) that is mapped to a view component of type string.
If you leave the string empty in the view you get a "" back as apposed to a null (which seems helpful as it reduces a lot of null pointer exceptions).
However, I had to write code to convert the "" back to null just before persisting it to stop the validator failing...// Need to set "" to null for validator to allow a blank field through. subscriber.setCreationDate(new Date()); if (subscriber.getXxx().equals("")) { ZZZZZZZ.setXxx(null); } if (subscriber.getYyy().equals("")) { ZZZZZZZ.setYyy(null); } em.persist(ZZZZZZ);
I could have extended the validator, but this seemed wrong as a string of "" should fail !!!
The better solution was to pass null to the validator.
humm... -
12. Re: Gotchas (so far)
tony.herstell1 Nov 14, 2006 11:26 PM (in response to tony.herstell1)2 solved...
Closing a window in Firefox and IE.<input type="button" value="Logout" onclick="javascript:window.open('javascript:window.close();','_self','');"/>
from.....http://www.interwebby.com/blog/2006/02/04/3/ # zenith Says: September 28th, 2006 at 10:54 am Nice solution. Thanks very much. You can compress this down to a single line as follows : javascript:window.open(?javascript:window.close();?,'_self?,'?);
-
13. Re: Gotchas (so far)
tony.herstell1 Jan 1, 2007 3:53 PM (in response to tony.herstell1)Finally found why I was getting exceptions after a period of inactivity saying that SEAM was having probelms removing beans.
Don't forget to add
public void destroy();
to your stateful action interfaces...
You ARE reminded to do this for Entities...
:/
Is there a FAQ for all things like this?