|
|
OpenCms Forum » List all forums » » Forum: Questions about Programming » » » Thread: Problems with CmsJspTagContentLoad in Plain Java |
|
| Print at May 22, 2013 5:35:22 PM | View all posts in this thread on one page |
| Posted by Daniel.fidalgo at Jan 21, 2008 6:28:34 PM |
|
Problems with CmsJspTagContentLoad in Plain Java hi, I've developed a newsletter package for my webapp based on opencms... that works fine using the serach engine... the problem is that the search doesn't return all the content available... I changed to CmsJspTagContentLoad but I've getting NPE no matter what I do. That's the code: package br.com.armtec.newsletter; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.ListIterator; import org.opencms.jsp.CmsJspTagContentLoad; import org.opencms.jsp.CmsJspXmlContentBean; import org.opencms.main.OpenCms; import org.opencms.search.CmsSearch; import org.opencms.search.CmsSearchResult; public class GetNews { private CmsSearch busca = new CmsSearch(); private NoticiaDAO noticia = new NoticiaDAO(); private List<NoticiaInfoVO> listNoticias = new ArrayList<NoticiaInfoVO>(); public BuscaNoticias() { } public Collection<NoticiaInfoVO> buscar(){ /*busca.setIndex("Noticias"); busca.setQuery("noticia");*/ try { CmsJspXmlContentBean content = new CmsJspXmlContentBean(); System.out.println("CmsJspXmlContentBean criated"); CmsJspTagContentLoad contentlist = (CmsJspTagContentLoad)content.contentload("allInFolderDateReleasedDesc", "/cooperforte/noticias/arquivos_noticias/|noticia", false); //This line returns NullPoiterException System.out.println("CmsJspTagContentLoad criated"); while (contentlist.hasMoreContent()) { System.out.println("has content"); } } catch (Exception e) { System.out.println(e); } /*List results = busca.getSearchResult(); ListIterator iterator = results.listIterator();*/ return listNoticias; } } thanks for your help Daniel Fidalgo Silva |
| Posted by Flo at Jan 22, 2008 12:27:25 PM |
|
Re: Problems with CmsJspTagContentLoad in Plain Java Is the JSP placed in OpenCms VFS, more precisely ist the JSP called by means of the OpenCms servlet? ---------------------------------------- /** * Florian Hopf * synyx GmbH & Co. KG */ |
| Posted by Daniel.fidalgo at Jan 22, 2008 1:46:33 PM |
|
Re: Problems with CmsJspTagContentLoad in Plain Java it's not actually a jsp... it's a java class... it's called by the the OpenCms Scheduller. this class is called from one of the jobs... I kinda found the problem... but still can't overcome it... I'm calling the method: public I_CmsXmlContentContainer contentload(String collectorName, String collectorParam, boolean editable) throws JspException { return contentload(collectorName, collectorParam, getRequestContext().getLocale(), editable); } this method calls the method: public I_CmsXmlContentContainer contentload( String collectorName, String collectorParam, Locale locale, boolean editable) throws JspException { return new CmsJspTagContentLoad(null, getJspContext(), collectorName, collectorParam, locale, editable); } the problem seems to be the getJspContext() method since its called from a plain java code ... is there any solution? once again thanks for your help... Daniel Fidalgo Silva |
| Posted by jmontes at Mar 30, 2009 9:27:35 PM |
|
Re: Problems with CmsJspTagContentLoad in Plain Java try CmsJspXmlContentBean content = new CmsJspXmlContentBean(context, request, response); insted of: CmsJspXmlContentBean content = new CmsJspXmlContentBean(); |
| Posted by Eska at Mar 31, 2009 5:11:58 PM |
|
Re: Problems with CmsJspTagContentLoad in Plain Java > CmsJspTagContentLoad contentlist = (CmsJspTagContentLoad)content.contentload("allInFolderDateReleasedDesc", "/cooperforte/noticias/arquivos_noticias/|noticia", false); //This line returns NullPoiterException sad What happens, if you add a query "/sites/XYZ/cooperforte/noticias/arquivos_noticias/|noticia" there? Eska |
| Posted by luluxiu at Jun 27, 2011 5:08:25 AM |
|
Re: Problems with CmsJspTagContentLoad in Plain Java Placed in the OpenCms VFS JSP, more precisely the OpenCms JSP servlet by the IST method is called? ---------------------------------------- Pay more attention at leather pumps sandals 2012 then you will feel surprise with the special design. |
| Posted by WilliamSimps at Oct 6, 2011 9:33:41 AM |
|
Re: Problems with CmsJspTagContentLoad in Plain Java The collector read the xml content resources. Collectors are defined in java classes which are configured in the opencms-vfs.xml configuration file. ---------------------------------------- seo services |
| Posted by jakelarson at Dec 13, 2011 10:01:12 AM |
|
Re: Problems with CmsJspTagContentLoad in Plain Java public I_CmsXmlContentContainer contentload(String collectorName, String collectorParam, boolean editable) throws JspException { ---------------------------------------- get free facebook likes |