aspose file tools*
The moose likes Struts and the fly likes Change color of clicked link - tiles Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Change color of clicked link - tiles" Watch "Change color of clicked link - tiles" New topic
Author

Change color of clicked link - tiles

Niall
Greenhorn

Joined: Mar 22, 2006
Posts: 6
Hi,

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 ]
Mohammad Ibrahim
Ranch Hand

Joined: Nov 28, 2004
Posts: 51
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:


Please help me out..

Thanks.
[ March 27, 2006: Message edited by: Basha Mohd. ]
Niall
Greenhorn

Joined: Mar 22, 2006
Posts: 6
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)
Mohammad Ibrahim
Ranch Hand

Joined: Nov 28, 2004
Posts: 51
Hi,
5.Created a tiles-defs.xml file and changed the action mapping to:

I think, I should have been more specific. I had indeed placed the <action-mappings> in my struts-config.xml.



I added the following contents to my tiles-defs.xml:


Regards
Niall
Greenhorn

Joined: Mar 22, 2006
Posts: 6
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.

<action...
....
.... />
<forward name="success" path="/login.do" />
</action>
Mohammad Ibrahim
Ranch Hand

Joined: Nov 28, 2004
Posts: 51
Hi Niall,
It's working..
But instead of:


I had written:


Thanks for your coordination.
Regards,
Mohd.Ibrahim

[ March 29, 2006: Message edited by: Mohammad Ibrahim ]
[ March 29, 2006: Message edited by: Mohammad Ibrahim ]
Niall
Greenhorn

Joined: Mar 22, 2006
Posts: 6
Glad you got it sorted. Now, if only someone could help me!!

Anyone?
 
Don't get me started about those stupid light bulbs.
 
subject: Change color of clicked link - tiles