It is possible, just not well documented. Essentially you use the Resource Key to 
access the Menu Object model. I remember there was some scoping issues. I have 
attached an example, if your interested.


>>> Jose Gonzalez Gomez <[EMAIL PROTECTED]> 03/13/03 06:00AM >>>

    Edgar,

    Is there support in struts-menu for dynamic menus? I evaluated it 
for one of the applications I'm developing, but I got the impression 
that you can only render menus that are specified in a configuration 
file, and finally I used a javascript menu directly as I needed to 
render a dynamic menu (taken from database).

    Regards
    Jose

Edgar Dollin wrote:

>There is internationalization built into struts-menu. 
>
>Edgar
>
>  
>
>>-----Original Message-----
>>From: Heligon Sandra [mailto:[EMAIL PROTECTED] 
>>Sent: Thursday, March 13, 2003 5:13 AM
>>To: '[EMAIL PROTECTED]'; '[EMAIL PROTECTED]' 
>>Subject: RE: Struts-menu with Tiles
>>
>>
>>       
>>      Is it possible to do internationalization with struts-menu ?
>>
>>    
>>
>>> 
>>>-----------------------------------------------------------
>>>As of February 12, 2003 Thomson unifies its email addresses on a
>>>      
>>>
>>worldwide
>>    
>>
>>>basis.Please note my new email address: [EMAIL PROTECTED] 
>>>
>>>Thomson is the leader in solutions and technologies for the
>>>      
>>>
>>entertainment
>>    
>>
>>>and media industries and serves its customers under its 
>>>      
>>>
>>four strategic
>>    
>>
>>>brands: Technicolor, Grass Valley, RCA and THOMSON.
>>>More about Thomson: http://www.thomson.net/videochain 
>>>
>>>----Original Message-----
>>>From:        Heligon Sandra  
>>>Sent:        13 March 2003 09:47
>>>To:  '[EMAIL PROTECTED]'; '[EMAIL PROTECTED]' 
>>>Subject:     Struts-menu with Tiles
>>>
>>>
>>>     My question is perhaps stupid, sorry. 
>>>     I would wish to know if it is possible to use 
>>>      
>>>
>>struts-menu with Tiles.
>>    
>>
>>>     I for a long time seek an example of horizontal dropdown menu
>>>      
>>>
>>and
>>    
>>
>>>the menu used in struts-menu example
>>>     coolmenus3 seems to me satisfactory. 
>>>     But I use the Tiles components to build my pages. 
>>>     Is it possible to use the two technologies? 
>>>     Thanks a lot in advance.
>>>     
>>>     Sandra
>>>      
>>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED] 
>For additional commands, e-mail: [EMAIL PROTECTED] 
>
>
>
>  
>

/*
 * MenuLoaderListener.java
 *
 * Created on February 5, 2003, 6:25 PM
 */

package net.etson.picture.plugins;

import com.fgm.web.menu.MenuComponent;
import com.fgm.web.menu.MenuRepository;
import java.net.URLEncoder;
import java.rmi.RemoteException;
import java.util.Collection;
import java.util.Iterator;
import javax.ejb.CreateException;
import javax.naming.NamingException;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletException;
import net.etson.picture.common.EjbUtils;
import net.etson.picture.interfaces.CategoryEntityData;
import net.etson.picture.interfaces.UserSession;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.action.PlugIn;
import org.apache.struts.config.ModuleConfig;

/** Loads the picture categories into the Menu Resource.
 * @author wetson
 * @version 1.0
 */

public class PicturePlugin implements PlugIn {
    public static final String MENU_NAME = "AlbumsMenu";
    /** Helper function to create the Category Menu
     * @return MenuComponent containing the Category Menu
     */    
    private MenuComponent createMenu() {
        MenuComponent result = new MenuComponent();
        result.setName(MENU_NAME);
        result.setTitle("Albums");
        result.setDescription("Please select a category");
        //Create subMenus
        try{
            UserSession lSession = EjbUtils.getUserSession();
            Collection categories = lSession.listCategories();
            Iterator i = categories.iterator();
            int index = 0;
            while(i.hasNext()){
                CategoryEntityData category = (CategoryEntityData)i.next();
                
                //Prepare thumbnail menu item
                MenuComponent thumbnailMenu = new MenuComponent(); 
                thumbnailMenu.setName("Thumbnail" + index);
                thumbnailMenu.setTitle("Thumbnail");
                thumbnailMenu.setDescription("Thumbnail");
                thumbnailMenu.setLocation("list-pictures.do?category=" + 
java.net.URLEncoder.encode(category.getName()));
                
                //Prepare slideshow menu
                MenuComponent slideshowMenu = new MenuComponent();
                slideshowMenu.setName("Slideshow" + index);
                slideshowMenu.setTitle("Slideshow");
                slideshowMenu.setDescription("Slideshow");
                slideshowMenu.setLocation("start-slideshow.do?category=" + 
java.net.URLEncoder.encode(category.getName()));
                
                //Prepare category menu item
                MenuComponent categoryMenu = new MenuComponent();
                categoryMenu.setName("Category" + index);
                categoryMenu.setTitle(category.getName());
                categoryMenu.setDescription(category.getName());
                categoryMenu.addMenuComponent(thumbnailMenu);
                categoryMenu.addMenuComponent(slideshowMenu);
                
                result.addMenuComponent(categoryMenu);
                index++;
            }
        }catch(NamingException ne){
            ne.printStackTrace();
        }catch(RemoteException re){
            re.printStackTrace();
        }catch(CreateException ce){
            ce.printStackTrace();
        }
        return result;
    }
    
    public void destroy() {
    }
    
    public void init(ActionServlet actionServlet, ModuleConfig moduleConfig) 
    throws javax.servlet.ServletException {
        MenuRepository menu = 
(MenuRepository)actionServlet.getServletContext().getAttribute(MenuRepository.MENU_REPOSITORY_KEY);
        if(menu == null) throw new ServletException("MenuRepository not initialized.");
        menu.addMenu(createMenu());
    }
}

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to