I'm using tiles and have a menu tile with 7 options. I want to change the color of the text for whatever option has currently been selected. I'm trying to do this using 'onclick' to call a stylesheet format called 'optionOn', but have been unable to get this code to work:
I'm trying to avoid writing a separate verison of the tile for each option selected, which is the only alternative I can think of. Can anyone make any suggestions?
Any help appreciated. [ March 27, 2006: Message edited by: Niall Mc Gurk ]
Hi Niall, I am also using Tiles for my Struts application. Although, I followed each and every step carefully, the JSP pages are not getting dislayed along with my layout pages.
I followed the following steps: 1.Added the struts-tiles.tld file to the /WEB-INF and registered it in web.xml. 2.Referenced all Jsp's with:
3.Created Layout pages: header.jsp,footer.jsp,mainLayout.jsp. 4.Update existing JSPs to use layouts: now, here's where I think I am going wrong. 5.Created a tiles-defs.xml file and changed the action mapping to:
I'm quite new to struts too but I think you're misunderstanding the purpose of the struts-config.xml and tiles-defs.xml files. Is that excerpt from your tiles-definitions file? All that stuff should be in your struts-config file. An excerpt from my struts-config.xml:
Then 'product.detail' is defined in tiles-deinfitions.xml as being an extension of the main layout, except with differing title and content value:
I've built my struts application up this way, by using my struts-config file to forward to various tiles depending on what has been selected, then defining these tiles as being extensions of one overall layout but with different jsp pages populating their content area. Hope this helps - it sounds like you need to read a bit more about struts tiles: courses.coreservlets.com/Course-Materials/pdf/struts/10-Struts-Tiles.pdf
Now, can anybody help me with my problem? (see first post in thread)
I don't think the forwards in your struts-config.xml should be forwarding to jsp pages - this defeats the purpose of using tiles. They should be forwarding to defined tiles and these tiles use your jsp pages, or in some cases they may forward to other actions in your struts-config.xml, eg.