File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes using jsp to allow a customizable look and feel GUI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "using jsp to allow a customizable look and feel GUI" Watch "using jsp to allow a customizable look and feel GUI" New topic
Author

using jsp to allow a customizable look and feel GUI

Derek Bright
Greenhorn

Joined: Aug 28, 2008
Posts: 28
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 29219
    
135

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

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 ]

GenRocket - A Test Data Generation Platform
Derek Bright
Greenhorn

Joined: Aug 28, 2008
Posts: 28
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: using jsp to allow a customizable look and feel GUI
 
Similar Threads
problem encountered while using jsp:getProperty tag
Including servlets into a single HTML file
Writing to a file
Design Question
XSLT as a JSP's murderer