[opencms-dev] get uuid of article in formatter

kaybe kris.brys at redtree.be
Thu Nov 8 13:41:02 CET 2012


I can't get this uuid in a scriptlet on the JSP. 
I write: 
<c:set var="newsuuid"
value="${cms:vfs(pageContext).resource[cms.element.sitePath].structureId}"
/>
<jsp:useBean id="newsuuid" class="org.opencms.util.CmsUUID" scope="request"
/>

I got the following error in the log: java.lang.InstantiationException: bean
newsuuid not found within scope

17: <c:set var="newsuuid"
value="${cms:vfs(pageContext).resource[cms.element.sitePath].structureId}"
/>
18:     <jsp:useBean id="newsuuid" type="org.opencms.util.CmsUUID" />
19:     <c:set var="category" value="${value.Category}" />
20:     <c:set var="categoryobj" value="${category.obtainCmsObject()}" />
21:     <jsp:useBean id="categoryobj" type="org.opencms.file.CmsObject" />


Stacktrace:
    at
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
    at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
    at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
    at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:593)
    at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:530)
    at
org.opencms.flex.CmsFlexRequestDispatcher.includeExternal(CmsFlexRequestDispatcher.java:188)
    at
org.opencms.flex.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:163)
    at org.opencms.loader.CmsJspLoader.service(CmsJspLoader.java:618)
    at
org.opencms.flex.CmsFlexRequestDispatcher.includeInternalWithCache(CmsFlexRequestDispatcher.java:417)
    at
org.opencms.flex.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:167)
    at org.opencms.loader.CmsJspLoader.dispatchJsp(CmsJspLoader.java:903)
    at org.opencms.loader.CmsJspLoader.dump(CmsJspLoader.java:304)
    at
org.opencms.ade.containerpage.CmsElementUtil.getElementContent(CmsElementUtil.java:498)
    at
org.opencms.ade.containerpage.CmsElementUtil.getContentsByContainerName(CmsElementUtil.java:212)
    at
org.opencms.ade.containerpage.CmsElementUtil.getElementData(CmsElementUtil.java:441)
    at
org.opencms.ade.containerpage.CmsContainerpageService.getNewElement(CmsContainerpageService.java:1207)
    at
org.opencms.ade.containerpage.CmsContainerpageService.getNewElementData(CmsContainerpageService.java:429)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at
com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
    at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
    at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
    at
com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.opencms.gwt.CmsGwtService.service(CmsGwtService.java:191)
    at org.opencms.main.OpenCmsCore.invokeGwtService(OpenCmsCore.java:1579)
    at org.opencms.main.OpenCmsServlet.doGet(OpenCmsServlet.java:150)
    at org.opencms.main.OpenCmsServlet.doPost(OpenCmsServlet.java:166)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
    at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
    at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
    at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
    at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
Caused by: javax.servlet.ServletException: java.lang.InstantiationException:
bean newsuuid not found within scope
    at
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:911)
    at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:840)
    at
org.apache.jsp.WEB_002dINF.jsp.offline.system.modules.be_redtree_crelan_intranet_news.formatters.detail_jsp._jspService(detail_jsp.java:393)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    ... 52 more
Caused by: java.lang.InstantiationException: bean newsuuid not found within
scope
    at
org.apache.jsp.WEB_002dINF.jsp.offline.system.modules.be_redtree_crelan_intranet_news.formatters.detail_jsp._jspService(detail_jsp.java:175)
    ... 55 more

Is there a better way to get this uuid available in a java scriptlet? 

Kind regards, 
Kris



kaybe wrote:
> 
> That did the trick. Thanks.
> 
> Siegfried Ehret-2 wrote:
>> 
>> You may try
>> ${cms:vfs(pageContext).resource[cms.element.sitePath].structureId}
>> Have fun !
>> 
>> Siegfried Ehret
>> 
>> On 11/06, kaybe wrote:
>>> 
>>> Is there any way to get the uuid of the article from within the
>>> formatter
>>> detail.jsp?
>>> I want to get custom properties of the article and display them in the
>>> formatter. When I have the uuid of that article I can request the
>>> properties. 
>>> If there is no way from within the formatter, how can this be done in an
>>> other way?
>>> 
>>> Kind regards
>>> Kris 
>>> 
>>> -- 
>>> View this message in context:
>>> http://old.nabble.com/get-uuid-of-article-in-formatter-tp34647596p34647596.html
>>> Sent from the OpenCMS - Dev mailing list archive at Nabble.com.
>>> 
>>> _______________________________________________
>>> This mail is sent to you from the opencms-dev mailing list
>>> To change your list options, or to unsubscribe from the list, please
>>> visit
>>> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>>> 
>>> 
>>> 
>>> 
>> _______________________________________________
>> This mail is sent to you from the opencms-dev mailing list
>> To change your list options, or to unsubscribe from the list, please
>> visit
>> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>> 
>> 
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/get-uuid-of-article-in-formatter-tp34647596p34656058.html
Sent from the OpenCMS - Dev mailing list archive at Nabble.com.




More information about the opencms-dev mailing list