Can you please send me the sample codes of your implementation for Images ?
I also want dynamic images to be displayed on my web page. Thanks, Farhan ________________________________ From: Michael O'Cleirigh <michael.ocleir...@rivulet.ca> To: users@wicket.apache.org Sent: Wednesday, July 22, 2009 8:04:00 PM Subject: Re: Save CSS/StyleSheet in Database ? Hi Farhan, You should create an IRequestTargetUrlCodingStrategy implementation to serve the CSS from the database. It should work to mount the strategy on something like '/custom-user-css' and then user the rest of the path as the options for say the user and version of the css to load. The version number may be needed to get around browser caching of the CSS if changes are made. You get look at the other implementations to see how they do this but yours will be slightly different since you are serving CSS not Pages. You can then add in the CSS resource link to the pages that need it only customizing the user parameter part of the url. I've done something similar for generating user specific images (custom images stamped with user specific details) so I know it will work. Regards, Mike > Thanks for quick response. > Obviously, styles can be loaded from database after Login. But i want to make > a separate css file and dont want ot add it in the java code, for sake of > simplicity. > > Is there any way to store css styles directly from css file for a specific > user, and then load styles directly to css file after user Login ? > > Or can we make css file dynamic by introducing variables in it (like in PHP) ? > > Thanks... > > > ________________________________ > From: Mathias Nilsson <wicket.program...@gmail.com> > To: users@wicket.apache.org > Sent: Wednesday, July 22, 2009 4:59:53 PM > Subject: Re: Save CSS/StyleSheet in Database ? > > > You would probably have to use cookies to save which style the users would > have. There is no way knowing this without login or cookie. > > There are probably a better way of doing this but if you save style and > classes in a database like this > > *{ font-family: verdana; } // a row in the database > a{ color: red; } // a row in the database > > you could implement the IHeaderContributor and override the renderHead > > public void renderHead(IHeaderResponse response) { > StringBuffer buf = new StringBuffer(); > buf.append( "<style type=\"text/css\">" ); > buf.append( "*{ font-size: 9px; }" ); > buf.append( "</style>" ); > response.renderString(buf); > } > > of couse you should the get it from a service or directly from a dao. > > public void renderHead(IHeaderResponse response) { > BradningService service = getBrandingService(); // get this using > @SpringBean or whatever > List<String> styles = service.getStyles( user ); // get the style for a > user > iterate here and add the style > > } > > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org