|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Help using EditLink componentHi Guys,
How are ya? I have a question about the EditLink component. I am trying to use it to edit an object of type gov.nasa.jpl.edrn.Participant. I have the following simple code snippet in my Trails application's Home.page: <p> <a href="#" jwcid="@trails:EditLink" model="ognl:page.persistenceService.getInstance(gov.nasa.jpl.edrn.Participa nt.class)" >Add a new Participant</a> </p> It's hard to find examples of how to use this EditLink component on the web. I need it though because I don't want to use the ListAllLink component (that trails uses by default), as I only want to shown certain objects (like the gov.nasa.jpl.edrn.Participant one) and allow users to add/edit them. By browsing around different examples, and the FishEye web repo, I thought maybe the above snippet would work, but it gives me an error (partial stack trace shown): org.apache.tapestry.BindingException: Unable to parse OGNL expression 'model': model [classpath:/org/trails/component/EditLink.jwc, line 9, column 30] at org.apache.tapestry.binding.ExpressionBinding.resolveExpression(ExpressionBi nding.java:145) at org.apache.tapestry.binding.ExpressionBinding.getObject(ExpressionBinding.ja va:125) at org.apache.tapestry.binding.AbstractBinding.getObject(AbstractBinding.java:8 4) at $ExternalLink_12.getParameters($ExternalLink_12.java) at org.apache.tapestry.link.ExternalLink.getLink(ExternalLink.java:40) at org.apache.tapestry.link.DefaultLinkRenderer.constructURL(DefaultLinkRendere r.java:120) at org.apache.tapestry.link.DefaultLinkRenderer.renderLink(DefaultLinkRenderer. java:68) at org.apache.tapestry.link.AbstractLinkComponent.renderComponent(AbstractLinkC omponent.java:94) at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725) [..snip..] Caused by: org.apache.hivemind.ApplicationRuntimeException: Unable to parse OGNL expression 'model': model at org.apache.tapestry.services.impl.ExpressionCacheImpl.parse(ExpressionCacheI mpl.java:156) at org.apache.tapestry.services.impl.ExpressionCacheImpl.getCompiledExpression( ExpressionCacheImpl.java:115) at $ExpressionCache_1189177e273.getCompiledExpression($ExpressionCache_1189177e 273.java) at org.apache.tapestry.binding.ExpressionBinding.resolveExpression(ExpressionBi nding.java:134) ... 89 more Caused by: ognl.OgnlException: model [org.apache.tapestry.BindingException: Unable to parse OGNL expression 'page.persistenceService.getInstance(gov.nasa.jpl.edrn.Participant.class)': $HomePage_0.gov [context:/WEB-INF/Home.html, line 7]] at ognl.OgnlRuntime.getMethodValue(OgnlRuntime.java:1215) at ognl.ObjectPropertyAccessor.getPossibleProperty(ObjectPropertyAccessor.java: 60) at ognl.ObjectPropertyAccessor.getProperty(ObjectPropertyAccessor.java:144) [..snip..] As far as I can tell the TrailsPage component that all pages inherit from (I'm guessing the Home.page does too) provides the persistenceService, so I should be able to access it from ognl:, and as far as I can tell as well, the model="" parameter of the EditLink expects a java.lang.Object, which I'm guessing is the object to bring up an edit page for. The weirdest thing is, if I change my EditLink call above to: <a href="#" jwcid="@trails:EditLink" model="ognl:new gov.nasa.jpl.edrn.Participant()">Add a New Participant</a> The link renders on my Home.page, but when I click it, I get a null pointer exception message when it tries to take me to the EditPage. So I guess that Hibernate probably sets up some magic in the Participant object returned from persistenceService.getInstance that my regular old new Participant() call didn't do. So, I thought that calling it would fix the problem but it didn't. Can anyone help me? Thanks! Cheers, Chris ______________________________________________ Chris Mattmann, Ph.D. Chris.Mattmann@... Cognizant Development Engineer Early Detection Research Network Project _________________________________________________ Jet Propulsion Laboratory Pasadena, CA Office: 171-266B Mailstop: 171-246 _______________________________________________________ Disclaimer: The opinions presented within are my own and do not reflect those of either NASA, JPL, or the California Institute of Technology. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Help using EditLink componentHi Chris
The first error is due to the ognl expression This is how you reference a class from ognl: "ognl:@gov.nasa.jpl.edrn.Participant@class" http://www.ognl.org/2.6.9/Documentation/html/LanguageGuide/staticMethods.html You are right, the EditLink expects an hibernate entity so that code won't work. You can try something like this <a href="#" jwcid="@trails:EditLink" model="ognl:page.persistenceService.getInstance(@gov.nasa.jpl.edrn.Participant@class, 1)" > Edit Participant Nº 1 </a> That should work, but I have never tried it. I think that the NewLink component is what you are looking for. Try with this: <a class="newlink" href="#" jwcid="@trails:NewLink" type="ognl:@gov.nasa.jpl.edrn.Participant@class">Add a New Participant</a> I know Trails lacks good documentation :( ,and I'm responsible for that, so this mailing list is the best way to get some help. Hope this helps. Let me know how it goes. Saludos. Alejandro. -- Alejandro Scandroli - http://weblog.amneris.es/ Amneris: We build process-driven web applications. http://www.amneris.es On Sun, Mar 9, 2008 at 4:04 AM, Chris Mattmann <chris.mattmann@...> wrote: > Hi Guys, > > How are ya? I have a question about the EditLink component. I am trying to > use it to edit an object of type gov.nasa.jpl.edrn.Participant. I have the > following simple code snippet in my Trails application's Home.page: > > <p> > <a href="#" jwcid="@trails:EditLink" > model="ognl:page.persistenceService.getInstance(gov.nasa.jpl.edrn.Participa > nt.class)" >Add a new Participant</a> > </p> > > It's hard to find examples of how to use this EditLink component on the web. > I need it though because I don't want to use the ListAllLink component (that > trails uses by default), as I only want to shown certain objects (like the > gov.nasa.jpl.edrn.Participant one) and allow users to add/edit them. By > browsing around different examples, and the FishEye web repo, I thought > maybe the above snippet would work, but it gives me an error (partial stack > trace shown): > > org.apache.tapestry.BindingException: Unable to parse OGNL expression > 'model': model [classpath:/org/trails/component/EditLink.jwc, line 9, column > 30] > at > org.apache.tapestry.binding.ExpressionBinding.resolveExpression(ExpressionBi > nding.java:145) > at > org.apache.tapestry.binding.ExpressionBinding.getObject(ExpressionBinding.ja > va:125) > at > org.apache.tapestry.binding.AbstractBinding.getObject(AbstractBinding.java:8 > 4) > at $ExternalLink_12.getParameters($ExternalLink_12.java) > at > org.apache.tapestry.link.ExternalLink.getLink(ExternalLink.java:40) > at > org.apache.tapestry.link.DefaultLinkRenderer.constructURL(DefaultLinkRendere > r.java:120) > at > org.apache.tapestry.link.DefaultLinkRenderer.renderLink(DefaultLinkRenderer. > java:68) > at > org.apache.tapestry.link.AbstractLinkComponent.renderComponent(AbstractLinkC > omponent.java:94) > at > org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725) > > > [..snip..] > > Caused by: org.apache.hivemind.ApplicationRuntimeException: Unable to parse > OGNL expression 'model': model > at > org.apache.tapestry.services.impl.ExpressionCacheImpl.parse(ExpressionCacheI > mpl.java:156) > at > org.apache.tapestry.services.impl.ExpressionCacheImpl.getCompiledExpression( > ExpressionCacheImpl.java:115) > at > $ExpressionCache_1189177e273.getCompiledExpression($ExpressionCache_1189177e > 273.java) > at > org.apache.tapestry.binding.ExpressionBinding.resolveExpression(ExpressionBi > nding.java:134) > ... 89 more > Caused by: ognl.OgnlException: model [org.apache.tapestry.BindingException: > Unable to parse OGNL expression > 'page.persistenceService.getInstance(gov.nasa.jpl.edrn.Participant.class)': > $HomePage_0.gov [context:/WEB-INF/Home.html, line 7]] > at ognl.OgnlRuntime.getMethodValue(OgnlRuntime.java:1215) > at > ognl.ObjectPropertyAccessor.getPossibleProperty(ObjectPropertyAccessor.java: > 60) > at > ognl.ObjectPropertyAccessor.getProperty(ObjectPropertyAccessor.java:144) > > [..snip..] > > As far as I can tell the TrailsPage component that all pages inherit from > (I'm guessing the Home.page does too) provides the persistenceService, so I > should be able to access it from ognl:, and as far as I can tell as well, > the model="" parameter of the EditLink expects a java.lang.Object, which I'm > guessing is the object to bring up an edit page for. The weirdest thing is, > if I change my EditLink call above to: > > <a href="#" jwcid="@trails:EditLink" model="ognl:new > gov.nasa.jpl.edrn.Participant()">Add a New Participant</a> > > The link renders on my Home.page, but when I click it, I get a null pointer > exception message when it tries to take me to the EditPage. So I guess that > Hibernate probably sets up some magic in the Participant object returned > from persistenceService.getInstance that my regular old new Participant() > call didn't do. So, I thought that calling it would fix the problem but it > didn't. Can anyone help me? > > Thanks! > > Cheers, > Chris > > > > ______________________________________________ > Chris Mattmann, Ph.D. > Chris.Mattmann@... > Cognizant Development Engineer > Early Detection Research Network Project > _________________________________________________ > Jet Propulsion Laboratory Pasadena, CA > Office: 171-266B Mailstop: 171-246 > _______________________________________________________ > > Disclaimer: The opinions presented within are my own and do not reflect > those of either NASA, JPL, or the California Institute of Technology. > > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Help using EditLink componentHi Alejandro,
Thanks for your email! This code: > <a class="newlink" href="#" jwcid="@trails:NewLink" > type="ognl:@gov.nasa.jpl.edrn.Participant@class">Add a New > Participant</a> Worked fine, and took me to the edit page, for a new entity, which is exactly what I wanted to happen. Also, your code to edit a Participant makes sense, and I will try it out. I appreciate your help! Cheers, Chris On 3/9/08 8:07 AM, "Alejandro Scandroli" <alejandroscandroli@...> wrote: > Hi Chris > > The first error is due to the ognl expression This is how you > reference a class from ognl: > "ognl:@gov.nasa.jpl.edrn.Participant@class" > http://www.ognl.org/2.6.9/Documentation/html/LanguageGuide/staticMethods.html > > You are right, the EditLink expects an hibernate entity so that code > won't work. You can try something like this > > <a href="#" jwcid="@trails:EditLink" > model="ognl:page.persistenceService.getInstance(@gov.nasa.jpl.edrn.Participant > @class, > 1)" > > Edit Participant Nº 1 > </a> > > That should work, but I have never tried it. > > I think that the NewLink component is what you are looking for. > Try with this: > > <a class="newlink" href="#" jwcid="@trails:NewLink" > type="ognl:@gov.nasa.jpl.edrn.Participant@class">Add a New > Participant</a> > > I know Trails lacks good documentation :( ,and I'm responsible for > that, so this mailing list is the best way to get some help. > > > Hope this helps. > Let me know how it goes. > Saludos. > Alejandro. > > > -- > Alejandro Scandroli - http://weblog.amneris.es/ > Amneris: We build process-driven web applications. > http://www.amneris.es > > > > > On Sun, Mar 9, 2008 at 4:04 AM, Chris Mattmann > <chris.mattmann@...> wrote: >> Hi Guys, >> >> How are ya? I have a question about the EditLink component. I am trying to >> use it to edit an object of type gov.nasa.jpl.edrn.Participant. I have the >> following simple code snippet in my Trails application's Home.page: >> >> <p> >> <a href="#" jwcid="@trails:EditLink" >> model="ognl:page.persistenceService.getInstance(gov.nasa.jpl.edrn.Participa >> nt.class)" >Add a new Participant</a> >> </p> >> >> It's hard to find examples of how to use this EditLink component on the web. >> I need it though because I don't want to use the ListAllLink component (that >> trails uses by default), as I only want to shown certain objects (like the >> gov.nasa.jpl.edrn.Participant one) and allow users to add/edit them. By >> browsing around different examples, and the FishEye web repo, I thought >> maybe the above snippet would work, but it gives me an error (partial stack >> trace shown): >> >> org.apache.tapestry.BindingException: Unable to parse OGNL expression >> 'model': model [classpath:/org/trails/component/EditLink.jwc, line 9, column >> 30] >> at >> org.apache.tapestry.binding.ExpressionBinding.resolveExpression(ExpressionBi >> nding.java:145) >> at >> org.apache.tapestry.binding.ExpressionBinding.getObject(ExpressionBinding.ja >> va:125) >> at >> org.apache.tapestry.binding.AbstractBinding.getObject(AbstractBinding.java:8 >> 4) >> at $ExternalLink_12.getParameters($ExternalLink_12.java) >> at >> org.apache.tapestry.link.ExternalLink.getLink(ExternalLink.java:40) >> at >> org.apache.tapestry.link.DefaultLinkRenderer.constructURL(DefaultLinkRendere >> r.java:120) >> at >> org.apache.tapestry.link.DefaultLinkRenderer.renderLink(DefaultLinkRenderer. >> java:68) >> at >> org.apache.tapestry.link.AbstractLinkComponent.renderComponent(AbstractLinkC >> omponent.java:94) >> at >> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725) >> >> >> [..snip..] >> >> Caused by: org.apache.hivemind.ApplicationRuntimeException: Unable to parse >> OGNL expression 'model': model >> at >> org.apache.tapestry.services.impl.ExpressionCacheImpl.parse(ExpressionCacheI >> mpl.java:156) >> at >> org.apache.tapestry.services.impl.ExpressionCacheImpl.getCompiledExpression( >> ExpressionCacheImpl.java:115) >> at >> $ExpressionCache_1189177e273.getCompiledExpression($ExpressionCache_1189177e >> 273.java) >> at >> org.apache.tapestry.binding.ExpressionBinding.resolveExpression(ExpressionBi >> nding.java:134) >> ... 89 more >> Caused by: ognl.OgnlException: model [org.apache.tapestry.BindingException: >> Unable to parse OGNL expression >> 'page.persistenceService.getInstance(gov.nasa.jpl.edrn.Participant.class)': >> $HomePage_0.gov [context:/WEB-INF/Home.html, line 7]] >> at ognl.OgnlRuntime.getMethodValue(OgnlRuntime.java:1215) >> at >> ognl.ObjectPropertyAccessor.getPossibleProperty(ObjectPropertyAccessor.java: >> 60) >> at >> ognl.ObjectPropertyAccessor.getProperty(ObjectPropertyAccessor.java:144) >> >> [..snip..] >> >> As far as I can tell the TrailsPage component that all pages inherit from >> (I'm guessing the Home.page does too) provides the persistenceService, so I >> should be able to access it from ognl:, and as far as I can tell as well, >> the model="" parameter of the EditLink expects a java.lang.Object, which I'm >> guessing is the object to bring up an edit page for. The weirdest thing is, >> if I change my EditLink call above to: >> >> <a href="#" jwcid="@trails:EditLink" model="ognl:new >> gov.nasa.jpl.edrn.Participant()">Add a New Participant</a> >> >> The link renders on my Home.page, but when I click it, I get a null pointer >> exception message when it tries to take me to the EditPage. So I guess that >> Hibernate probably sets up some magic in the Participant object returned >> from persistenceService.getInstance that my regular old new Participant() >> call didn't do. So, I thought that calling it would fix the problem but it >> didn't. Can anyone help me? >> >> Thanks! >> >> Cheers, >> Chris >> >> >> >> ______________________________________________ >> Chris Mattmann, Ph.D. >> Chris.Mattmann@... >> Cognizant Development Engineer >> Early Detection Research Network Project >> _________________________________________________ >> Jet Propulsion Laboratory Pasadena, CA >> Office: 171-266B Mailstop: 171-246 >> _______________________________________________________ >> >> Disclaimer: The opinions presented within are my own and do not reflect >> those of either NASA, JPL, or the California Institute of Technology. >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe from this list, please visit: >> >> http://xircles.codehaus.org/manage_email >> >> >> > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > ______________________________________________ Chris Mattmann, Ph.D. Chris.Mattmann@... Cognizant Development Engineer Early Detection Research Network Project _________________________________________________ Jet Propulsion Laboratory Pasadena, CA Office: 171-266B Mailstop: 171-246 _______________________________________________________ Disclaimer: The opinions presented within are my own and do not reflect those of either NASA, JPL, or the California Institute of Technology. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
| Free embeddable forum powered by Nabble | Forum Help |