• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Change color of clicked link - tiles

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Glad you got it sorted. Now, if only someone could help me!!

Anyone?
 
reply
    Bookmark Topic Watch Topic
  • New Topic