display Freemarker in JSP in explorer?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2010 01:10 PM
I wanted to use Freemarker in JSPs in explorer. How would I do this? How would I create a dialog for example?
Labels:
- Labels:
-
Archive
15 REPLIES 15
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2010 10:57 AM
Yes, it helps very much. Thank you! Thank you for your posts!
Now, the question I have is how can I pass a list of Nodes, a java.util.List of Nodes to my freemarker template and have it display the list as well as information from the list?
I assume I would have to put this List in the model.
I tried:
But this returns an error from Alfresco :
16:51:45,208 User:admin ERROR [ui.common.Utils] 05040003 Error during processing
of the template 'null'. Please contact your system administrator.
org.alfresco.service.cmr.repository.TemplateException: 05040003 Error during pro
cessing of the template 'null'. Please contact your system administrator.
at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProc
essor.java:206)
at org.alfresco.repo.processor.TemplateServiceImpl.processTemplate(Templ
ateServiceImpl.java:181)
at org.alfresco.repo.processor.TemplateServiceImpl.processTemplate(Templ
ateServiceImpl.java:111)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
on(AopUtils.java:304)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo
inpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:149)
at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterc
eptor.invoke(AlwaysProceedMethodInterceptor.java:40)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethod
Interceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInte
rceptor.java:147)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
at org.springframework.transaction.interceptor.TransactionInterceptor.in
voke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
at $Proxy191.processTemplate(Unknown Source)
at org.alfresco.web.ui.repo.component.template.UITemplate.encodeBegin(UI
Template.java:159)
at javax.faces.webapp.UIComponentTag.encodeBegin(UIComponentTag.java:467
)
at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:320)
at org.apache.jsp.jsp.extension.dialogs.list_002dreport_jsp._jspx_meth_r
_005ftemplate_005f0(list_002dreport_jsp.java:97)
at org.apache.jsp.jsp.extension.dialogs.list_002dreport_jsp._jspService(
list_002dreport_jsp.java:69)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:3
42)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp
atcher.java:630)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationD
ispatcher.java:535)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDis
patcher.java:472)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary
.java:968)
at org.apache.jsp.jsp.dialog.container_jsp._jspService(container_jsp.jav
a:647)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:3
42)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp
atcher.java:630)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(Applica
tionDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationD
ispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDis
patcher.java:302)
at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatc
h(ServletExternalContextImpl.java:419)
at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspV
iewHandlerImpl.java:211)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderRes
ponseExecutor.java:41)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:
132)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:140)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(Authentica
tionFilter.java:110)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory
$1.invoke(ChainingSubsystemProxyFactory.java:122)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
at $Proxy187.doFilter(Unknown Source)
at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxy
Filter.java:88)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
at org.alfresco.repo.web.filter.beans.NullFilter.doFilter(NullFilter.jav
a:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory
$1.invoke(ChainingSubsystemProxyFactory.java:122)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
at $Proxy187.doFilter(Unknown Source)
at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxy
Filter.java:88)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ss(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:44
7)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
at java.util.HashMap$KeyIterator.next(HashMap.java:828)
at org.alfresco.repo.template.FreeMarkerProcessor.convertValue(FreeMarke
rProcessor.java:353)
at org.alfresco.repo.template.FreeMarkerProcessor.convertValue(FreeMarke
rProcessor.java:371)
at org.alfresco.repo.template.FreeMarkerProcessor.convertValue(FreeMarke
rProcessor.java:359)
at org.alfresco.repo.template.FreeMarkerProcessor.convertToFreeMarkerMod
el(FreeMarkerProcessor.java:312)
at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProc
essor.java:201)
… 90 more
Now, the question I have is how can I pass a list of Nodes, a java.util.List of Nodes to my freemarker template and have it display the list as well as information from the list?
I assume I would have to put this List in the model.
I tried:
model.put("nodeList", this.browseBean.getContent());
But this returns an error from Alfresco :
16:51:45,208 User:admin ERROR [ui.common.Utils] 05040003 Error during processing
of the template 'null'. Please contact your system administrator.
org.alfresco.service.cmr.repository.TemplateException: 05040003 Error during pro
cessing of the template 'null'. Please contact your system administrator.
at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProc
essor.java:206)
at org.alfresco.repo.processor.TemplateServiceImpl.processTemplate(Templ
ateServiceImpl.java:181)
at org.alfresco.repo.processor.TemplateServiceImpl.processTemplate(Templ
ateServiceImpl.java:111)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
on(AopUtils.java:304)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo
inpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:149)
at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterc
eptor.invoke(AlwaysProceedMethodInterceptor.java:40)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethod
Interceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInte
rceptor.java:147)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
at org.springframework.transaction.interceptor.TransactionInterceptor.in
voke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
at $Proxy191.processTemplate(Unknown Source)
at org.alfresco.web.ui.repo.component.template.UITemplate.encodeBegin(UI
Template.java:159)
at javax.faces.webapp.UIComponentTag.encodeBegin(UIComponentTag.java:467
)
at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:320)
at org.apache.jsp.jsp.extension.dialogs.list_002dreport_jsp._jspx_meth_r
_005ftemplate_005f0(list_002dreport_jsp.java:97)
at org.apache.jsp.jsp.extension.dialogs.list_002dreport_jsp._jspService(
list_002dreport_jsp.java:69)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:3
42)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp
atcher.java:630)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationD
ispatcher.java:535)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDis
patcher.java:472)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary
.java:968)
at org.apache.jsp.jsp.dialog.container_jsp._jspService(container_jsp.jav
a:647)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:3
42)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp
atcher.java:630)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(Applica
tionDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationD
ispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDis
patcher.java:302)
at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatc
h(ServletExternalContextImpl.java:419)
at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspV
iewHandlerImpl.java:211)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderRes
ponseExecutor.java:41)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:
132)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:140)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(Authentica
tionFilter.java:110)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory
$1.invoke(ChainingSubsystemProxyFactory.java:122)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
at $Proxy187.doFilter(Unknown Source)
at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxy
Filter.java:88)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
at org.alfresco.repo.web.filter.beans.NullFilter.doFilter(NullFilter.jav
a:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory
$1.invoke(ChainingSubsystemProxyFactory.java:122)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
at $Proxy187.doFilter(Unknown Source)
at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxy
Filter.java:88)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ss(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:44
7)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
at java.util.HashMap$KeyIterator.next(HashMap.java:828)
at org.alfresco.repo.template.FreeMarkerProcessor.convertValue(FreeMarke
rProcessor.java:353)
at org.alfresco.repo.template.FreeMarkerProcessor.convertValue(FreeMarke
rProcessor.java:371)
at org.alfresco.repo.template.FreeMarkerProcessor.convertValue(FreeMarke
rProcessor.java:359)
at org.alfresco.repo.template.FreeMarkerProcessor.convertToFreeMarkerMod
el(FreeMarkerProcessor.java:312)
at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProc
essor.java:201)
… 90 more
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2010 10:10 PM
i do not know that this is possible, because space is made for this reason .
Can you tell how would you get this list of nodes?
Can you tell how would you get this list of nodes?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2010 01:08 PM
I perform a search in Alfresco from which I receive a search result list. I then modified browse.jsp, adding a button
Clicking this button opens CustomDialog calling myMethod:
this attempts to open a dialog, but an error results from the call to
model.put("nodeList", this.browseBean.getContent());
web-client-config-custom.xml
faces-config-custom.xml
custom.jsp
<td style="padding-right:4px" align=right> <%– custom button –%> <nobr><a:actionLink value="CustomButton" image="/custom/images/icons/customButton.png" style="white-space:nowrap" actionListener="#{CustomDialog.myMethod}" id="mylink1" /></nobr></td>
Clicking this button opens CustomDialog calling myMethod:
public class CustomDialog extends BaseDialogBean { Map<String, Object> templateModel; protected TemplateImageResolver imageResolver; public void myMethod(ActionEvent event) { imageResolver = new TemplateImageResolver() { public String resolveImagePathForName(String filename, FileTypeImageSize size) { FacesContext context = FacesContext.getCurrentInstance(); ServletContext servletContext = ((HttpServletRequest) context .getExternalContext().getRequest()).getSession() .getServletContext(); return FileTypeImageUtils.getFileTypeImage(servletContext, filename, size); } }; // go to custom dialog FacesContext fc = FacesContext.getCurrentInstance(); fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "dialog:custom"); } public Map getTemplateModel() { Map<String, Object> model = new HashMap<String, Object>(4, 1.0f); model.put("nodeList", this.browseBean.getContent()); model.put(TemplateService.KEY_IMAGE_RESOLVER, imageResolver); return model; } @Override protected String finishImpl(FacesContext context, String outcome) throws Exception { // return the default outcome return outcome; } public TemplateImageResolver getImageResolver() { return imageResolver; } public void setImageResolver(TemplateImageResolver imageResolver) { this.imageResolver = imageResolver; } public void setTemplateModel(Map<String, Object> templateModel) { this.templateModel = templateModel; }}
this attempts to open a dialog, but an error results from the call to
model.put("nodeList", this.browseBean.getContent());
web-client-config-custom.xml
<dialog name="custom" page="/jsp/extension/dialogs/custom.jsp" managed-bean="CustomDialog" icon="/custom/images/icons/custom_1.gif" title="Custom" description="Displays custom list" />
faces-config-custom.xml
<managed-bean> <managed-bean-name>CustomDialog</managed-bean-name> <managed-bean-class>co.esource.web.bean.CustomDialog</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> <managed-property> <property-name>nodeService</property-name> <value>#{NodeService}</value> </managed-property> <managed-property> <property-name>browseBean</property-name> <value>#{BrowseBean}</value> </managed-property> </managed-bean>
custom.jsp
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %><%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %><%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %><r:template template="alfresco/templates/custom.ftl" model="#{CustomDialog.templateModel}" />
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2010 01:48 PM
If I remove the call to :
no error occurs. And in fact I can pass values from CustomDialog to the freemarker template via the model as an example:
And I also have access to the node results from the search, but the values have to be transcribed, copied into my own custom node as example:
model.put("nodeList", this.browseBean.getContent());
no error occurs. And in fact I can pass values from CustomDialog to the freemarker template via the model as an example:
model.put("hello","hello, how are you");
And I also have access to the node results from the search, but the values have to be transcribed, copied into my own custom node as example:
public Map getTemplateModel() { nameList = new java.util.ArrayList<String>(); customList = new java.util.ArrayList<customNode>(); List<Node> searchResults = this.browseBean.getContent(); Integer searchResultsCount = searchResults.size(); for(ListIterator<Node>li=searchResults.listIterator(); li.hasNext(); ) { Node resultNode = li.next(); String Name = resultNode.getName(); nameList.add(Name); customList.add(new customNode(resultNode)); } Map<String, Object> model = new HashMap<String, Object>(4, 1.0f); model.put("names", nameList); model.put("custom", customList); //model.put("nodeList", this.browseBean.getContent()); model.put(TemplateService.KEY_IMAGE_RESOLVER, imageResolver); return model; }
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2010 01:50 PM
So, I can get search results to display in freemarker but I cannot send the nodes directly. It seems the nodes have to be copied into custom objects.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2010 01:55 PM
you can perform a search into freemarker with
http://wiki.alfresco.com/wiki/Template_Guide you have this hire.
childrenByLuceneSearch
Returns a map capable of executing a search against the entire repository based on a Lucene search string. It returns a sequence of nodes which represent the objects from the results of the search, such as companyhome.childrenByLuceneSearch["TEXT:alfresco* AND TEXT:tutorial*"]. The value can be any valid Lucene search string supported by Alfresco. Note that you may need to escape Lucene specific characters. Note that the entire repository is searched: the current node is only used as an access point to retrieve the search object.
http://wiki.alfresco.com/wiki/Template_Guide you have this hire.