Package org.apache.struts.tiles

Examples of org.apache.struts.tiles.ComponentDefinition


    if( param != null )
      {
      try
        {
          // Read definition from factory, but we can create it here.
        ComponentDefinition definition = DefinitionsUtil.getDefinition( param, request, getServlet().getServletContext() );
        //definition.putAttribute( "attributeName", "aValue" );
        DefinitionsUtil.setActionDefinition( request, definition);
        }
       catch( FactoryNotFoundException ex )
        {
View Full Code Here


    log.debug("Extract menu item from '" + object + "'");

    if (object instanceof String) { // definition name
      try {
        ComponentDefinition def =
          DefinitionsUtil.getDefinition(
            (String) object,
            request,
            servletContext);

        extractItems(result, def, request, servletContext);

      } catch (Exception ex) { // silently fail
      }

    } else if (object instanceof List) {
      List list = (List) object;
      Iterator iter = list.iterator();
      while (iter.hasNext()) {
        extractItems(result, iter.next(), request, servletContext);
      }

    } else if (object instanceof ComponentDefinition) {
      ComponentDefinition definition = (ComponentDefinition) object;
      Object attribute = definition.getAttribute("items");
      if (attribute == null) {
        attribute = definition.getAttribute("list");
      }

      if (attribute == null) {
        return;
      }
View Full Code Here

  @Override
  protected String prepareForRendering(HttpServletRequest request, HttpServletResponse response)
      throws Exception {

    // get component definition
    ComponentDefinition definition = getComponentDefinition(this.definitionsFactory, request);
    if (definition == null) {
      throw new ServletException("No Tiles definition found for name '" + getUrl() + "'");
    }

    // get current component context
    ComponentContext context = getComponentContext(definition, request);

    // execute component controller associated with definition, if any
    Controller controller = getController(definition, request);
    if (controller != null) {
      if (logger.isDebugEnabled()) {
        logger.debug("Executing Tiles controller [" + controller + "]");
      }
      executeController(controller, context, request, response);
    }

    // determine the path of the definition
    String path = getDispatcherPath(definition, request);
    if (path == null) {
      throw new ServletException(
          "Could not determine a path for Tiles definition '" + definition.getName() + "'");
    }

    return path;
  }
View Full Code Here

   */
  protected String prepareForRendering(HttpServletRequest request, HttpServletResponse response)
      throws Exception {

    // get component definition
    ComponentDefinition definition = getComponentDefinition(this.definitionsFactory, request);
    if (definition == null) {
      throw new ServletException("No Tiles definition found for name '" + getUrl() + "'");
    }

    // get current component context
    ComponentContext context = getComponentContext(definition, request);

    // execute component controller associated with definition, if any
    Controller controller = getController(definition, request);
    if (controller != null) {
      if (logger.isDebugEnabled()) {
        logger.debug("Executing Tiles controller [" + controller + "]");
      }
      executeController(controller, context, request, response);
    }

    // determine the path of the definition
    String path = getDispatcherPath(definition, request);
    if (path == null) {
      throw new ServletException(
          "Could not determine a path for Tiles definition '" + definition.getName() + "'");
    }

    return path;
  }
View Full Code Here

      throws JspException
    {

    try
      {
      ComponentDefinition definition =  DefinitionsUtil.getDefinition(name, pageContext);
      if( definition == null )
        {  // is it possible ?
        throw new NoSuchDefinitionException();
        }
      return processDefinition( definition );
View Full Code Here

    public TagHandler processAsDefinitionOrURL( String name )
      throws JspException
    {
    try
      {
      ComponentDefinition definition =  DefinitionsUtil.getDefinition(name, pageContext);
      if( definition != null )
        return processDefinition( definition );
      }
     catch( DefinitionsFactoryException ex )
      { // silently failed, because we can choose to not define a factory.
View Full Code Here

      // Walk thru xml set and copy each definitions.
    Iterator i = xmlDefinitions.getDefinitions().values().iterator();
    while( i.hasNext() )
      {
      XmlDefinition xmlDefinition = (XmlDefinition)i.next();
        putDefinition( new ComponentDefinition( xmlDefinition) );
      // end loop
   }
View Full Code Here

   public int doStartTag() throws JspException
   {
     // Do we extend a definition ?
   if( extendsDefinition != null && !extendsDefinition.equals("") )
     {
     ComponentDefinition parentDef = TagUtils.getComponentDefinition( extendsDefinition, pageContext );
     System.out.println( "parent definition=" + parentDef );
     definition = new ComponentDefinition( parentDef );
     // end if
    else
      definition = new ComponentDefinition();

      // Set definitions attributes
   if( page != null )
     definition.setTemplate(page);
   if( role != null )
View Full Code Here

      // Walk thru xml set and copy each definitions.
    Iterator i = xmlDefinitions.getDefinitions().values().iterator();
    while( i.hasNext() )
      {
      XmlDefinition xmlDefinition = (XmlDefinition)i.next();
        putDefinition( new ComponentDefinition( xmlDefinition) );
      // end loop
   }
View Full Code Here

        // Try to dispatch to requested definition
      try
        {
          // Read definition from factory, but we can create it here.
        ComponentDefinition definition = DefinitionsUtil.getDefinition( name, request, getServlet().getServletContext() );
        System.out.println("get Definition " + definition );
        DefinitionsUtil.setActionDefinition( request, definition);
        }
       catch( FactoryNotFoundException ex )
        {
View Full Code Here

TOP

Related Classes of org.apache.struts.tiles.ComponentDefinition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.