Totally Newbie: is this a problem of screens.render? Please help me

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Totally Newbie: is this a problem of screens.render? Please help me

VuTheCuong
Dear all
Currently I'm reading "apache ofbiz development the beginner's tutorial".
I installed ofbiz 4.0 as required by the book and I had problem
at the section "Cleaning Up in the "party" Component".
To be hornest, I did exactly as same as the book guided as follow, but the error still there,
Please help me to solve this problem. I'm really really stuck and need your help.
I attached related files for your reference. If you need other info, please let me know.

The Book guide:
---------------------------------------
Cleaning Up in the "party" Component
We take the opportunity here to clean up the mess we made in the party component
in Chapter 2. Edit ${component:learning}\widget\partymgr\OurPartyScreens.
xml and insert a new screen widget:
<screen name="editcontactmech.extend">
<section>
  <widgets>
    <platform-specific><html>
      <html-templatelocation="component://learning/webapp/
                         partymgr/party/editcontactmech.extend.ftl"/>
    </html></platform-specific>
  </widgets>
</section>
</screen>
In the folder ${component:learning}\webapp\partymgr\party, create a new file
editcontactmech.extend.ftl. Enter into the file this:
<tr>
<td class="label">Planetoo</td>
<td>
  <input type="text" size="30" maxlength="100"
         name="planet" value="${(mechMap.postalAddress.planet)!""}">
</td>
</tr>
Edit the file ${webapp:partymgr}\party\editcontactmech.ftl, go to line 166
and replace:
<tr>
<td class="label">Planet</td>
<td>
  <input type="text" size="30" maxlength="100"
         name="planet" value="${(mechMap.postalAddress.planet)!""}">
</td>
</tr>
with:
${screens.render("component://learning/widget/partymgr/OurPartyScreens.xml#editcontactmech.extend")}
-----------------------------

However, when I fired an http request to webapp partymgr, log in, find a
party with the last name of Researcher, and first name OFBiz, then
I opened the update screen for the party's postal address to see the field Planet with a misspelled label of Planetoo.
below error occurred:

Method public java.lang.String org.ofbiz.widget.screen.ScreenRenderer.render(java.lang.String) throws org.ofbiz.base.util.GeneralException,java.io.IOException,org.xml.sax.SAXException,javax.xml.parsers.ParserConfigurationException threw an exception when invoked on org.ofbiz.widget.screen.ScreenRenderer@556949 The problematic instruction: ---------- ==> ${screens.render("component://learning/widget/partymgr/OurPartyScreens.xml#editcontactmech.extend")} [on line 167, column 1 in component://party/webapp/partymgr/party/editcontactmech.ftl] ---------- Java backtrace for programmers: ---------- freemarker.template.TemplateModelException: Method public java.lang.String org.ofbiz.widget.screen.ScreenRenderer.render(java.lang.String) throws org.ofbiz.base.util.GeneralException,java.io.IOException,org.xml.sax.SAXException,javax.xml.parsers.ParserConfigurationException threw an exception when invoked on org.ofbiz.widget.screen.ScreenRenderer@556949 at freemarker.ext.beans.OverloadedMethodModel.exec(OverloadedMethodModel.java:134) at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93) at freemarker.core.Expression.getAsTemplateModel(Expression.java:89) at freemarker.core.Expression.getStringValue(Expression.java:93) at freemarker.core.DollarVariable.accept(DollarVariable.java:76) at freemarker.core.Environment.visit(Environment.java:196) at freemarker.core.MixedContent.accept(MixedContent.java:92) at freemarker.core.Environment.visit(Environment.java:196) at freemarker.core.IfBlock.accept(IfBlock.java:82) at freemarker.core.Environment.visit(Environment.java:196) at freemarker.core.MixedContent.accept(MixedContent.java:92) at freemarker.core.Environment.visit(Environment.java:196) at freemarker.core.IfBlock.accept(IfBlock.java:82) at freemarker.core.Environment.visit(Environment.java:196) at freemarker.core.MixedContent.accept(MixedContent.java:92) at freemarker.core.Environment.visit(Environment.java:196) at freemarker.core.Environment.process(Environment.java:176) at org.ofbiz.base.util.template.FreeMarkerWorker.renderTemplate(FreeMarkerWorker.java:179) at org.ofbiz.base.util.template.FreeMarkerWorker.renderTemplate(FreeMarkerWorker.java:161) at org.ofbiz.base.util.template.FreeMarkerWorker.renderTemplateAtLocation(FreeMarkerWorker.java:138) at org.ofbiz.widget.screen.HtmlWidget.renderHtmlTemplate(HtmlWidget.java:82) at org.ofbiz.widget.screen.HtmlWidget$HtmlTemplate.renderWidgetString(HtmlWidget.java:110) at org.ofbiz.widget.screen.HtmlWidget.renderWidgetString(HtmlWidget.java:65) at org.ofbiz.widget.screen.ModelScreenWidget$PlatformSpecific.renderWidgetString(ModelScreenWidget.java:806) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:151) at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:244) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:151) at org.ofbiz.widget.screen.ModelScreenWidget$DecoratorSection.renderWidgetString(ModelScreenWidget.java:521) at org.ofbiz.widget.screen.ModelScreenWidget$SectionsRenderer.render(ModelScreenWidget.java:183) at org.ofbiz.widget.screen.ModelScreenWidget$DecoratorSectionInclude.renderWidgetString(ModelScreenWidget.java:553) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:151) at org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:299) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:151) at org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:299) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:151) at org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:299) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:151) at org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:299) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:151) at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:244) at org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:134) at org.ofbiz.widget.screen.ModelScreenWidget$IncludeScreen.renderWidgetString(ModelScreenWidget.java:394) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:151) at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:244) at org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:134) at org.ofbiz.widget.screen.ModelScreenWidget$DecoratorScreen.renderWidgetString(ModelScreenWidget.java:489) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:151) at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:244) at org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:134) at org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:105) at org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:90) at org.ofbiz.widget.screen.ScreenWidgetViewHandler.render(ScreenWidgetViewHandler.java:78) at org.ofbiz.webapp.control.RequestHandler.renderView(RequestHandler.java:643) at org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:427) at org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:189) at javax.servlet.http.HttpServlet.service(HttpServlet.java:595) at javax.servlet.http.HttpServlet.service(HttpServlet.java:688) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:248) 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.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541) 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.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:662) Caused by: org.xml.sax.SAXParseException: Element type "html-templatelocation" must be followed by either attribute specifications, ">" or "/>". at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:124) at org.ofbiz.base.util.UtilXml.readXmlDocument(UtilXml.java:240) at org.ofbiz.base.util.UtilXml.readXmlDocument(UtilXml.java:179) at org.ofbiz.widget.screen.ScreenFactory.getScreenFromLocation(ScreenFactory.java:114) at org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:104) at org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:90) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:616) at freemarker.ext.beans.OverloadedMethodModel.exec(OverloadedMethodModel.java:111) ... 74 more


:ERROR MESSAGE:
org.ofbiz.base.util.GeneralException: Error rendering screen [component://party/widget/partymgr/PartyScreens.xml#editcontactmech]: org.ofbiz.base.util.GeneralException: Error rendering screen [component://party/widget/partymgr/CommonScreens.xml#main-decorator]: org.ofbiz.base.util.GeneralException: Error rendering screen [component://common/widget/CommonScreens.xml#GlobalDecorator]: java.lang.RuntimeException: Error rendering included template at location [component://party/webapp/partymgr/party/editcontactmech.ftl]: freemarker.template.TemplateModelException: Method public java.lang.String org.ofbiz.widget.screen.ScreenRenderer.render(java.lang.String) throws org.ofbiz.base.util.GeneralException,java.io.IOException,org.xml.sax.SAXException,javax.xml.parsers.ParserConfigurationException threw an exception when invoked on org.ofbiz.widget.screen.ScreenRenderer@556949 (Error rendering included template at location [component://party/webapp/partymgr/party/editcontactmech.ftl]: freemarker.template.TemplateModelException: Method public java.lang.String org.ofbiz.widget.screen.ScreenRenderer.render(java.lang.String) throws org.ofbiz.base.util.GeneralException,java.io.IOException,org.xml.sax.SAXException,javax.xml.parsers.ParserConfigurationException threw an exception when invoked on org.ofbiz.widget.screen.ScreenRenderer@556949) (Error rendering screen [component://common/widget/CommonScreens.xml#GlobalDecorator]: java.lang.RuntimeException: Error rendering included template at location [component://party/webapp/partymgr/party/editcontactmech.ftl]: freemarker.template.TemplateModelException: Method public java.lang.String org.ofbiz.widget.screen.ScreenRenderer.render(java.lang.String) throws org.ofbiz.base.util.GeneralException,java.io.IOException,org.xml.sax.SAXException,javax.xml.parsers.ParserConfigurationException threw an exception when invoked on org.ofbiz.widget.screen.ScreenRenderer@556949 (Error rendering included template at location [component://party/webapp/partymgr/party/editcontactmech.ftl]: freemarker.template.TemplateModelException: Method public java.lang.String org.ofbiz.widget.screen.ScreenRenderer.render(java.lang.String) throws org.ofbiz.base.util.GeneralException,java.io.IOException,org.xml.sax.SAXException,javax.xml.parsers.ParserConfigurationException threw an exception when invoked on org.ofbiz.widget.screen.ScreenRenderer@556949)) (Error rendering screen [component://party/widget/partymgr/CommonScreens.xml#main-decorator]: org.ofbiz.base.util.GeneralException: Error rendering screen [component://common/widget/CommonScreens.xml#GlobalDecorator]: java.lang.RuntimeException: Error rendering included template at location [component://party/webapp/partymgr/party/editcontactmech.ftl]: freemarker.template.TemplateModelException: Method public java.lang.String org.ofbiz.widget.screen.ScreenRenderer.render(java.lang.String) throws org.ofbiz.base.util.GeneralException,java.io.IOException,org.xml.sax.SAXException,javax.xml.parsers.ParserConfigurationException threw an exception when invoked on org.ofbiz.widget.screen.ScreenRenderer@556949 (Error rendering included template at location [component://party/webapp/partymgr/party/editcontactmech.ftl]: freemarker.template.TemplateModelException: Method public java.lang.String org.ofbiz.widget.screen.ScreenRenderer.render(java.lang.String) throws org.ofbiz.base.util.GeneralException,java.io.IOException,org.xml.sax.SAXException,javax.xml.parsers.ParserConfigurationException threw an exception when invoked on org.ofbiz.widget.screen.ScreenRenderer@556949) (Error rendering screen [component://common/widget/CommonScreens.xml#GlobalDecorator]: java.lang.RuntimeException: Error rendering included template at location [component://party/webapp/partymgr/party/editcontactmech.ftl]: freemarker.template.TemplateModelException: Method public java.lang.String org.ofbiz.widget.screen.ScreenRenderer.render(java.lang.String) throws org.ofbiz.base.util.GeneralException,java.io.IOException,org.xml.sax.SAXException,javax.xml.parsers.ParserConfigurationException threw an exception when invoked on org.ofbiz.widget.screen.ScreenRenderer@556949 (Error rendering included template at location [component://party/webapp/partymgr/party/editcontactmech.ftl]: freemarker.template.TemplateModelException: Method public java.lang.String org.ofbiz.widget.screen.ScreenRenderer.render(java.lang.String) throws org.ofbiz.base.util.GeneralException,java.io.IOException,org.xml.sax.SAXException,javax.xml.parsers.ParserConfigurationException threw an exception when invoked on org.ofbiz.widget.screen.ScreenRenderer@556949)))

thanks and best regards,


OurPartyScreens.xml (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Totally Newbie: is this a problem of screens.render? Please help me

Erwan de FERRIERES
Le 10/06/2011 14:07, VuTheCuong a écrit :

> Dear all
> Currently I'm reading "apache ofbiz development the beginner's tutorial".
> I installed ofbiz 4.0 as required by the book and I had problem
> at the section "Cleaning Up in the "party" Component".
> To be hornest, I did exactly as same as the book guided as follow, but the error still there,
> Please help me to solve this problem. I'm really really stuck and need your help.
> I attached related files for your reference. If you need other info, please let me know.
>
> The Book guide:
> ---------------------------------------
> Cleaning Up in the "party" Component
> We take the opportunity here to clean up the mess we made in the party component
> in Chapter 2. Edit ${component:learning}\widget\partymgr\OurPartyScreens.
> xml and insert a new screen widget:
> <screen name="editcontactmech.extend">
> <section>
>    <widgets>
>      <platform-specific><html>
>        <html-templatelocation="component://learning/webapp/
>                           partymgr/party/editcontactmech.extend.ftl"/>
>      </html></platform-specific>
>    </widgets>
> </section>
> </screen>

>

Hi,

the error is in the stacktrace :
Element type "html-templatelocation" must be followed by either
attribute specifications, ">" or "/>".

As you are in XML, you can't cut your text, it will insert spaces in it.
So you should write:

      <platform-specific><html>
 
<html-templatelocation="component://learning/webapp/partymgr/party/editcontactmech.extend.ftl"/>
       </html></platform-specific>

and this should be good.

Cheers,

--
Erwan de FERRIERES
www.nereide.biz
Reply | Threaded
Open this post in threaded view
|

Re: Totally Newbie: is this a problem of screens.render? Please help me

Adrian Crum-3
Also, there should be a space between html-template and location.

-Adrian

On 6/10/2011 1:21 PM, Erwan de FERRIERES wrote:

> Le 10/06/2011 14:07, VuTheCuong a écrit :
>> Dear all
>> Currently I'm reading "apache ofbiz development the beginner's
>> tutorial".
>> I installed ofbiz 4.0 as required by the book and I had problem
>> at the section "Cleaning Up in the "party" Component".
>> To be hornest, I did exactly as same as the book guided as follow,
>> but the error still there,
>> Please help me to solve this problem. I'm really really stuck and
>> need your help.
>> I attached related files for your reference. If you need other info,
>> please let me know.
>>
>> The Book guide:
>> ---------------------------------------
>> Cleaning Up in the "party" Component
>> We take the opportunity here to clean up the mess we made in the
>> party component
>> in Chapter 2. Edit
>> ${component:learning}\widget\partymgr\OurPartyScreens.
>> xml and insert a new screen widget:
>> <screen name="editcontactmech.extend">
>> <section>
>> <widgets>
>> <platform-specific><html>
>> <html-templatelocation="component://learning/webapp/
>>                           partymgr/party/editcontactmech.extend.ftl"/>
>> </html></platform-specific>
>> </widgets>
>> </section>
>> </screen>
>
>>
>
> Hi,
>
> the error is in the stacktrace :
> Element type "html-templatelocation" must be followed by either
> attribute specifications, ">" or "/>".
>
> As you are in XML, you can't cut your text, it will insert spaces in it.
> So you should write:
>
> <platform-specific><html>
>
> <html-templatelocation="component://learning/webapp/partymgr/party/editcontactmech.extend.ftl"/>
>
> </html></platform-specific>
>
> and this should be good.
>
> Cheers,
>
Reply | Threaded
Open this post in threaded view
|

RE: Totally Newbie: is this a problem of screens.render? Please help me

VuTheCuong
-----Original Message-----
From: Adrian Crum [mailto:[hidden email]]
Sent: Friday, June 10, 2011 7:26 PM
To: [hidden email]
Subject: Re: Totally Newbie: is this a problem of screens.render? Please help me

Also, there should be a space between html-template and location.

-Adrian

On 6/10/2011 1:21 PM, Erwan de FERRIERES wrote:

> Le 10/06/2011 14:07, VuTheCuong a écrit :
>> Dear all
>> Currently I'm reading "apache ofbiz development the beginner's
>> tutorial".
>> I installed ofbiz 4.0 as required by the book and I had problem at
>> the section "Cleaning Up in the "party" Component".
>> To be hornest, I did exactly as same as the book guided as follow,
>> but the error still there, Please help me to solve this problem. I'm
>> really really stuck and need your help.
>> I attached related files for your reference. If you need other info,
>> please let me know.
>>
>> The Book guide:
>> ---------------------------------------
>> Cleaning Up in the "party" Component
>> We take the opportunity here to clean up the mess we made in the
>> party component in Chapter 2. Edit
>> ${component:learning}\widget\partymgr\OurPartyScreens.
>> xml and insert a new screen widget:
>> <screen name="editcontactmech.extend"> <section> <widgets>
>> <platform-specific><html>
>> <html-templatelocation="component://learning/webapp/
>>
>> partymgr/party/editcontactmech.extend.ftl"/>
>> </html></platform-specific>
>> </widgets>
>> </section>
>> </screen>
>
>>
>
> Hi,
>
> the error is in the stacktrace :
> Element type "html-templatelocation" must be followed by either
> attribute specifications, ">" or "/>".
>
> As you are in XML, you can't cut your text, it will insert spaces in it.
> So you should write:
>
> <platform-specific><html>
>
> <html-templatelocation="component://learning/webapp/partymgr/party/edi
> tcontactmech.extend.ftl"/>
>
> </html></platform-specific>
>
> and this should be good.
>
> Cheers,
>
Dear Adrian Crum and Erwan de FERRIERES
These worked for me. Thank you very much. I'm continuing my learning of the book.
Onece again, thank you.