This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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~
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.
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.
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?