Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to load themes dynamically?

 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ,
In our application we are giving permissions to user to select backgroud themes, 4 themes with different 4 .css files, and in the database we are storing the name of the file, after user created his profile and if he wants to see his profile and checked on view profile, then we need to display the theme as he selected when he registered.

How can we display the background theme? actually our jsp is design according to the .css file and each theme's .css file have the same with different colors, images, etc...

we just gathering the name of .css file from the database and we need to display jsp according to the theme.

Could some one help me about this. if possible send a simple code

thanks,
Sumant K
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just use JSP mechanisms to generate the right theme CSS file name in the <link> tag.

E.g.


(Assumes that themeName has been set as a scoped variable at some point.)
 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you Bear,

Can we add like this ?


if not, pleases explain the following

 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Bear,

My application is working, excellent.

I used the following line


and i put themeFileName in pageContext.

Thank you very mucu Bear
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The notation I used, ${themeName}, uses the EL (Expression language), available as of JSP 2.0. It is the modern-day equivalent to your old-fashioned scriptlets. If you are using JSP 2.0, or even plan to continue to use JSP in the future, this is a topic you should investigate very very soon.
 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your information, I must investigate the information about the future versions.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic