From: Mike S. <ms...@md...> - 2006-10-30 17:03:16
|
You might want to add a cacheKey and cacheVersion (or something like that) so that you can cache the WOElement that you parsed, and when you pass a different revision number, it reparses ... probably defaulting to the current uncached behavior. ms On Oct 30, 2006, at 11:31 AM, Timo Hoepfner wrote: > A bit improved version... > > <InlineComponent.java> > > Components/Main.wo/Main.html: > > <wo:string value="$testDict.index"/> > <wo:InlineComponent template="$htmlForInlineComponent" text="This > is a string from the InlineComponent's binding" count="15" > dict="$testDict"/> > <wo:string value="$testDict.index"/> > > Sources/Main.java: > > public String htmlForInlineComponent= > "<wo:string value=\"$text\" />. <br />\n" + > "<wo:WORepetition count=\"$count\" index=\"$dict.index\">\n" + > " Index: <wo:string value=\"$dict.index\" /> <br />\n" + > "</wo:WORepetition>\n" + > "\n" + > "<wo:WOForm a=\"b\">\n" + > " <wo:WOTextField value=\"$enteredValue\" /><br />\n" + > " <wo:WOSubmitButton value=\"Set Value\" />\n" + > "</wo:WOForm>\n" + > ""; > > public NSMutableDictionary testDict=new NSMutableDictionary(new > Integer(0),"index"); > > > > > There seems to be a problem, when a component has no bindings at > all, like the WOForm above. If you leave out the a="b", you'll get: > > com.webobjects.appserver._private.WOHTMLFormatException: > <WOHTMLWebObjectTag cannot initialize WebObject tag <wo:WOForm> . > It has no NAME=... parameter > at com.webobjects.appserver._private.WOHTMLWebObjectTag.extractName > (WOHTMLWebObjectTag.java:21) > at com.webobjects.appserver._private.WOHTMLWebObjectTag.<init> > (WOHTMLWebObjectTag.java:52) > at > ognl.helperfunction.WOHelperFunctionHTMLTemplateParser.didParseOpening > WebObjectTag(WOHelperFunctionHTMLTemplateParser.java:157) > at > ognl.helperfunction.WOHelperFunctionHTMLParser.didParseOpeningWebObjec > tTag(WOHelperFunctionHTMLParser.java:169) > at > ognl.helperfunction.WOHelperFunctionHTMLParser.startOfWebObjectTag > (WOHelperFunctionHTMLParser.java:142) > at ognl.helperfunction.WOHelperFunctionHTMLParser.parseHTML > (WOHelperFunctionHTMLParser.java:67) > at ognl.helperfunction.WOHelperFunctionHTMLTemplateParser.parseHTML > (WOHelperFunctionHTMLTemplateParser.java:192) > at ognl.helperfunction.WOHelperFunctionHTMLTemplateParser.parse > (WOHelperFunctionHTMLTemplateParser.java:208) > at > com.webobjects.appserver._private.WOParser.templateWithHTMLAndDeclarat > ion(WOParser.java:71) > at com.webobjects.appserver.WOComponent.templateWithHTMLString > (WOComponent.java:1296) > at InlineComponent.template(InlineComponent.java:64) > ... > > When there is no bundle corresponding to the above component at all > (InlineComponent.wo), you get: > > java.lang.IllegalStateException: Unable to find framework named > "WOTest". > at com.webobjects.appserver._private.WOComponentDefinition.<init> > (WOComponentDefinition.java:179) > at > com.webobjects.appserver.WOApplication._componentDefinitionFromClassNa > med(WOApplication.java:2353) > at com.webobjects.appserver.WOApplication._componentDefinition > (WOApplication.java:2448) > at > com.webobjects.appserver._private.WOHTMLWebObjectTag._componentReferen > ceWithClassNameDeclarationAndTemplate(WOHTMLWebObjectTag.java:129) > at > com.webobjects.appserver._private.WOHTMLWebObjectTag._elementWithDecla > ration(WOHTMLWebObjectTag.java:196) > at > com.webobjects.appserver._private.WOHTMLWebObjectTag.dynamicElement > (WOHTMLWebObjectTag.java:122) > at > ognl.helperfunction.WOHelperFunctionHTMLTemplateParser.didParseClosing > WebObjectTag(WOHelperFunctionHTMLTemplateParser.java:168) > at > ognl.helperfunction.WOHelperFunctionHTMLParser.didParseClosingWebObjec > tTag(WOHelperFunctionHTMLParser.java:181) > at ognl.helperfunction.WOHelperFunctionHTMLParser.endOfWebObjectTag > (WOHelperFunctionHTMLParser.java:148) > at ognl.helperfunction.WOHelperFunctionHTMLParser.parseHTML > (WOHelperFunctionHTMLParser.java:64) > at ognl.helperfunction.WOHelperFunctionHTMLTemplateParser.parseHTML > (WOHelperFunctionHTMLTemplateParser.java:192) > at ognl.helperfunction.WOHelperFunctionHTMLTemplateParser.parse > (WOHelperFunctionHTMLTemplateParser.java:208) > at > com.webobjects.appserver._private.WOParser.templateWithHTMLAndDeclarat > ion(WOParser.java:71) > at com.webobjects.appserver._private.WOComponentDefinition.template > (WOComponentDefinition.java:288) > at com.webobjects.appserver.WOComponent.templateWithName > (WOComponent.java:597) > at com.webobjects.appserver.WOComponent.template(WOComponent.java: > 507) > at com.webobjects.appserver.WOComponent.appendToResponse > (WOComponent.java:982) > at com.webobjects.appserver.WOSession.appendToResponse > (WOSession.java:1200) > at er.extensions.ERXSession.appendToResponse(ERXSession.java:556) > at com.webobjects.appserver.WOApplication.appendToResponse > (WOApplication.java:1418) > at er.extensions.ERXApplication.appendToResponse > (ERXApplication.java:712) > ... > > > Am 30.10.2006 um 12:59 schrieb Timo Hoepfner: > >>> Together with a component which takes the definition from a string >>> binding and allows access to the other bindings via KVC (and has >>> something like ERXNonSynchronizingComponent.dynamicBindings for e.g. >>> repetitions) templating and configurable views are much easier to >>> implement. >> >> Rough proof of concept attached. >> >> <InlineComponent.java> >> >> Use with e.g. >> >> <wo:InlineComponent template="$htmlForInlineComponent" text="This >> is a string from the InlineComponent's binding" count="15"/> >> >> in some component where "htmlForInlineComponent" is something like: >> >> public String htmlForInlineComponent= >> "This App wants to welcome you with the following message: <br / >> > \n" + >> "<wo:string value=\"$bindings.text\" />. <br /> \n" + >> "One more thing: <br />\n" + >> "<wo:WORepetition count=\"$bindings.count\" index= >> \"$dynamicBindings.index\">\n" + >> " Index: <wo:string value=\"$dynamicBindings.index\" /> >> <br />\n" + >> "</wo:WORepetition>\n"; >> >> Of course that would normally come from the DB... >> >> Cool. >> >> Timo >> >> --------------------------------------------------------------------- >> ---- >> Using Tomcat but need to do more? Need to support web services, >> security? >> Get stuff done quickly with pre-integrated technology to make your >> job easier >> Download IBM WebSphere Application Server v.1.0.1 based on Apache >> Geronimo >> http://sel.as-us.falkag.net/sel? >> cmd=lnk&kid=120709&bid=263057&dat=121642_____________________________ >> __________________ >> Wonder-disc mailing list >> Won...@li... >> https://lists.sourceforge.net/lists/listinfo/wonder-disc > > ---------------------------------------------------------------------- > --- > Using Tomcat but need to do more? Need to support web services, > security? > Get stuff done quickly with pre-integrated technology to make your > job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel? > cmd=lnk&kid=120709&bid=263057&dat=121642______________________________ > _________________ > Wonder-disc mailing list > Won...@li... > https://lists.sourceforge.net/lists/listinfo/wonder-disc |