Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using jsp to allow a customizable look and feel GUI

 
Derek Bright
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i am new here...nice to meet you guys~ i have a problem for my Enterprise assignment. It requires me to develop a jsp portal-like application (not using portlets), thus there is a function which needs me to allow users to customize their home page (look and feel, e.g. the text style, background colour, etc.)...therefore, i need recommendations in which i can achieve this. From my research, i know that there is a way of using javabean to store the user configuration.

I would like to know whether there is any other way to achieve this as well as how would i be able to change the css dynamically? Thanks~
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Derek,
Welcome to JavaRanch!

It sounds like you want to write out some CSS code on the page based on the users selections. In addition to how to communicate with the page (the JavaBean you mentioned), you also need to decide where to store the user specified preferences - color, font, etc. A database is a common option for storing data.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another option is to allow the user to upload a collection of style files (css, images, etc) as a skin or template. These would typically be zipped/tar'd/gzipped file that contains a standard template layout. Once the file is uploaded you unzip it to a specified location. At that point you would store the user skin/template preference in a database and when the page is rendered use this property to get the correct styles, images, etc. For example, say you defined a really simple template layout.

gregg.zip
---images
-----header.png
---styles
-----styles.css

When gregg.zip is uploaded its contents are placed in a template/gregg directory. A database entry of 'gregg' is stored for the user's preferred skin. Then you might do something like this in your JSP



Very rough but I think this gives you an idea.
[ August 28, 2008: Message edited by: Gregg Bolinger ]
 
Derek Bright
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys, thanks for the replies really appreciate that.

Just 1 more thing here, say..my system allows user to select the font, the background colour, etc, the elements they prefer, is it better to store them in database. That is my table Preference would have the following fields :
text font, forecolor, backcolor, size, etc? OR i just store them in XML format?

Lastly, is it possible to dynamically generate css in the servlet; for e.g. response.setContentType("text/css");
writer.write("......blah blah")
something like that, would it work?

Thanks for the response
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic