[opencms-dev] A method into a JSP

Robert Burén robert.buren at gmail.com
Wed Dec 15 12:15:39 CET 2004


Just do exactly what the error message says: catch the exception, or
declare that it can be thrown in the method. For example, to declare
it in your method, change the lines:

  void FindChilds( String groupName, HttpServletRequest request,
                          HttpServletResponse response){

to read: 

  void FindChilds( String groupName, HttpServletRequest request,
                          HttpServletResponse response) 
                          throws com.opencms.core.CmsException {


Regards,

/Robert



On Wed, 15 Dec 2004 12:07:04 +0100, Rafael Diaz Valdes
<Rafael.Diaz.Valdes at cern.ch> wrote:
> Hi, list
> 
>  I have  to include a method into a jsp in order to make a look for all subgroups of a group, This is my method :
> 
> <%@ page import="com.opencms.flex.jsp.*,com.opencms.core.*, com.opencms.file.*, java.lang.*,java.util.*" %>
> 
> <%!
>  void FindChilds( String groupName, HttpServletRequest request,
>                          HttpServletResponse response){
> 
>     CmsJspActionElement cms = new CmsJspActionElement( pageContext, request, response );
>     CmsObject         cmso  = cms.getCmsObject();
> 
>                Vector vector = cmso.getChild(groupName);
>             int size = vector.size();
>             if(size == 0){
>               System.out.println("<option>" + groupName + " </option>") ;
>               return;
>             }else{
>                 int n=0;
>                 while(n<size){
>                       CmsGroup childgroup = (CmsGroup)vector.get(n);
>                       String childgroupName = childgroup.getName();
>         FindChilds(childgroupName, request, response);
>         n++;
>          }
>             return;
>            }
>   }
> %>
> 
> But I recive this error :
> 
> Root cause:
> org.apache.jasper.JasperException: Unable to compile class for JSP
> An error occurred at line: -1 in the jsp file: null
> Generated servlet error:
>     [javac] Compiling 1 source file
> /usr/local/jakarta-tomcat-4.1.29/work/Standalone/localhost/opencms/WEB-INF/jsp/offline/NewAlicePortal/en/Collaboration/Site_Admin/CreateWebUserForm_jsp_jsp.java:22: unreported exception com.opencms.core.CmsException; must be caught or declared to be thrown
>                Vector vector = cmso.getChild(groupName);
>                                             ^
> 1 error
> 
> Someone have an idea to solve this error ??.
> Best Regards
>  Rafael
> 
> 
> 
> 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev
> 
>



More information about the opencms-dev mailing list