Re: [Webwork-user] Web "Skins"
Brought to you by:
baldree,
rickardoberg
From: Rickard O. <ri...@te...> - 2000-12-03 15:47:19
|
> Rickard, > How easy (any examples?) for creating "skins". WebWork comes with a HelloWorld example that has two skins (called brief and verbose). Basically it comes to down to this. Assumptions: * Action objects return JSP URL's that are relative (i.e. "foo.jsp" instead of "/foo.jsp") * All JSP's for the apps default skin is in the directory "/skin1" So, if the following is executed: /myapp/skin1/Foo.action?result=foo.jsp the results will be viewed with: /skin1/foo.jsp All relative links within foo.jsp (<A HREF>'s and forms etc.) will be parsed relative to /skin1, as usual. This means that if you copy the /skin1 directory to /skin2 you now immediately gave a new "skin". And using it is as simple as doing: /myapp/skin2/Foo.action?result=foo.jsp which will view /skin2/foo.jsp The use of skins can be used for many purposes. One could be to support many kinds of clients, but another could be for internationalization, i.e. the skins look exactly the same but the content text are in different languages. And of course you can combine it. Let's say you have two client types ("simple" and "standard") and you want to support the languages English and Swedish ("en" and "se" locales), then you would have four different skins which could be organized as follows: /simple/en -> simple style English /simple/se -> simple style Swedish /standard/en -> standard style English /standard/se -> standard style Swedish Now you can allow the user to select language and style in some preferences dialog, and all you have to do is direct the user to the right initial directory. From there on it is "business as usual". I hope this clarifies how skins works in WebWork, and how they can be applied for various purposes. Note also that this is merely one way to do skins. There are of course many other ways to accomplish the same thing. This technique does not rely on any particular feature in WebWork other than the ability to have relative page references as result values from execute(). regards, Rickard |