Package org.apache.struts.tiles

Examples of org.apache.struts.tiles.ComponentDefinition


     */
    protected String processAsDefinitionOrURL(String name) throws Exception
    {
        try
        {
            ComponentDefinition definition =
                    TilesUtil.getDefinition(name, this.request, this.application);
            if (definition != null)
            {
                return processDefinition(definition);
            }
View Full Code Here


         HttpServletResponse response)
  throws Exception {

    System.out.println( "Start dynamic definition" );
      // Create template definition
    ComponentDefinition definition = new ComponentDefinition();
    String path = "/tutorial";
      // set definition 'contents'
    //definition.setTemplate( "/tutorial/basic/myFramesetLayout.jsp" );
    definition.put( "title", "My first dynamic frameset page", true );
      // using type="string" is the same as direct=true
    definition.put( "header", path + "/common/header.jsp", "string", null );
    definition.put( "footer", path + "/common/footer.jsp", true );
    definition.put( "menu", path + "/basic/menu.jsp", true );
    definition.put( "body", path + "/basic/helloBody.jsp", true );

    System.out.println( "definition=" + definition );
      // Save our definition as a bean :
    request.setAttribute( "templateDefinition", definition );
View Full Code Here

    */
   public DefinitionCatalog( String catalogName, HttpServletRequest request, ServletContext context)
     throws FactoryNotFoundException, DefinitionsFactoryException
   {
     // Get definition containing list of definitions
   ComponentDefinition catalogDef = DefinitionsUtil.getDefinition( catalogName, request, context);
   if(debug)
     System.out.println( "Got definition " + catalogDef );
     // Get list of definition names
   List list = (List)catalogDef.getAttribute( DEFINITION_LIST_ATTRIBUTE );
   Iterator i = list.iterator();
   while(i.hasNext() )
     {
     String name = (String)i.next();
     System.out.println( "add " + name );
     ComponentDefinition def = DefinitionsUtil.getDefinition(name, request, context);
     if(def==null)
       throw new NoSuchDefinitionException("Can't find definition '" + name + "'" );
     add( name, def );
     } // end loop
   if(debug)
View Full Code Here

    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

      throw new ServletException( "Error - CustomSkinAction : attribute '"
                                  + LAYOUT_ATTRIBUTE
                                  + "' not found in Tile's attributes. Need it to select appropriate layout"  );

      // Get user current skin
    ComponentDefinition definition = getCurrentDefinition( context, request, getServlet().getServletContext() );
      // get requested layout from definition
    String layout = (String)definition.getAttribute(layoutKey);
    if(layout==null)
      throw new ServletException( "Error - CustomSkinAction : no layout defined for key '"
                                  + layoutKey
                                  + "' in currently selected skin '"
                                  + getUserSetting(context, request ) + "'."  );
View Full Code Here

  {
    // Get selected key
  String selected = getUserSetting(context, request);

  DefinitionCatalog catalog = getCatalog( context, request, servletContext);
  ComponentDefinition definition =  (ComponentDefinition)catalog.get( selected );
  if( definition == null )
    definition = (ComponentDefinition)catalog.getDefault();

  return definition;
  }
View Full Code Here

     * @throws JspException On errors processing tag.
     */
    public int doStartTag() throws JspException {
        // Do we extend a definition ?
        if (extendsDefinition != null && !extendsDefinition.equals("")) {
            ComponentDefinition parentDef =
                TagUtils.getComponentDefinition(extendsDefinition, pageContext);

            definition = new ComponentDefinition(parentDef);

        } else {
            definition = new ComponentDefinition();
        }

        // Set definitions attributes
        if (page != null) {
            definition.setTemplate(page);
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

   */
  protected TagHandler processDefinitionName(String name)
    throws JspException {

    try {
      ComponentDefinition definition =
        TilesUtil.getDefinition(
          name,
          (HttpServletRequest) pageContext.getRequest(),
          pageContext.getServletContext());

View Full Code Here

   * @throws JspException InstantiationException Can't create requested controller
   */
  public TagHandler processAsDefinitionOrURL(String name)
    throws JspException {
    try {
      ComponentDefinition definition =
        TilesUtil.getDefinition(
          name,
          pageContext.getRequest(),
          pageContext.getServletContext());

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.