Re: THEMES AND TEMPLATES
Juan Espinosa wrote: Hi is there any theme repository ??? I want to change my theme, like putting the field errors in red, in the right of the component (field) who cause the error... I'm not sure what you mean by a theme repository, but documentation on customizing Struts 2 themes and templates is here: http://struts.apache.org/2.x/docs/themes-and-templates.html For simple tweaks like changing colours, you can use plain ol' CSS. For more extensive changes, you'll want a customized theme. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Themes and templates
Thanks mark for your help, i will give a try to your advices Regards Juan -Mensaje original- De: Mark Shifman [mailto:[EMAIL PROTECTED] Enviado el: Martes, 28 de Noviembre de 2006 05:20 p.m. Para: Struts Users Mailing List Asunto: Re: Themes and templates If you set struts.ui.theme=simple in the struts.properties file you won't fight with the templates and it will be sort of like good old struts 1. However, there are other gotchas in store. You have to get validation errors on the screen yourself using s:fielderror/ since the theme cleverly puts the validation errors next to the invalid fields but not with simple. This is how I have done it but there is probably a better way: s:if test=hasErrors() h3span style=color:red; font-weight:boldValidation Error/span/h3 s:actionerror/ s:fielderror/ /s:if The hasErrors() comes from the value stack from you action that extended ActionSupport. But this didn't really answer your question of how to make themes and templates work for you :(. Juan Espinosa wrote: Hi to all, im building an struts2 based application and i dont understan the concept of themes an templates. In the past i used struts 1, and in the view i used jsp tags and struts tags like iterate and others. Now in the application that im buildin i use tags provided by struts like s:action s:include s:iterator, s:form etc. the problem started when i was using the radio button tag that renders radio buttons based on a list. The buttons are put side by side... and i want to put one below the other label radio1 label radio2 (now) label radio1 label radio2 (mi needs) I want to know if render of buttons tables forms and other tags are based on this templates..and how i could change it Regards Juan -- Mark Shifman MD. Ph.D. Yale Center for Medical Informatics Phone (203)737-5219 [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Themes and templates
If you set struts.ui.theme=simple in the struts.properties file you won't fight with the templates and it will be sort of like good old struts 1. However, there are other gotchas in store. You have to get validation errors on the screen yourself using s:fielderror/ since the theme cleverly puts the validation errors next to the invalid fields but not with simple. This is how I have done it but there is probably a better way: s:if test=hasErrors() h3span style=color:red; font-weight:boldValidation Error/span/h3 s:actionerror/ s:fielderror/ /s:if The hasErrors() comes from the value stack from you action that extended ActionSupport. But this didn't really answer your question of how to make themes and templates work for you :(. Juan Espinosa wrote: Hi to all, im building an struts2 based application and i dont understan the concept of themes an templates. In the past i used struts 1, and in the view i used jsp tags and struts tags like iterate and others. Now in the application that im buildin i use tags provided by struts like s:action s:include s:iterator, s:form etc. the problem started when i was using the radio button tag that renders radio buttons based on a list. The buttons are put side by side... and i want to put one below the other label radio1 label radio2 (now) label radio1 label radio2 (mi needs) I want to know if render of buttons tables forms and other tags are based on this templates..and how i could change it Regards Juan -- Mark Shifman MD. Ph.D. Yale Center for Medical Informatics Phone (203)737-5219 [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Themes and templates
On 11/28/06 4:04 PM, Juan Espinosa [EMAIL PROTECTED] wrote: I want to know if render of buttons tables forms and other tags are based on this templates..and how i could change it Hi Juan, The rendering of the buttons is based on the theme template. The templates can be found in the Struts source in: /core/src/main/resources/template There are a few directories there. I believe S2 defaults to the xhtml theme. I have extended the xhtml theme extensively to do variable multi-column layouts. It took some work, and at the time I thought it was hard, but in retrospect it wasn't that bad. Take a look at the template that backs s:textfield first. It's text.ftl in the xhtml directory. It's real short: #include /${parameters.templateDir}/${parameters.theme}/controlheader.ftl / #include /${parameters.templateDir}/simple/text.ftl / #include /${parameters.templateDir}/xhtml/controlfooter.ftl / It includes a controlheader, the simple text.ftl template, then a controlfooter. The control header and footer is where the table wrapping happens and the simple/text.ftl is where the actual input element is generated from. Just go through it a piece at a time. I have yet to use a radio button group, but I think the template to start with is radiomap.ftl. When going through this just remember to follow the includes. Good luck, Mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Themes and templates
On 11/28/06 4:06 PM, Mark Menard [EMAIL PROTECTED] wrote: On 11/28/06 4:04 PM, Juan Espinosa [EMAIL PROTECTED] wrote: I want to know if render of buttons tables forms and other tags are based on this templates..and how i could change it Hi Juan, The rendering of the buttons is based on the theme template. The templates can be found in the Struts source in: /core/src/main/resources/template Forgot to mention if you want to hack on these do the following: 1. In WEB-INF/classes/ make a template directory. 2. Copy the xhtml, and simple directories from the Struts distribution to that directory. 3. in WEB-INF/classes/template make a directory for your own theme, such as WEB-INF/class/template/mytheme/. You'll put any template you want to override in this directory. 4. Optionally, although I'd highly recommend it, copy the contents of the xhtml theme to your theme directory so you have something to hack on. 5. Hack away and see how it works. Later, Mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Themes
I'm googling now for the article you mentioned since it isn't clear to me exactly where you meant. If you have a URL I'd appreciate it. This Tiles Controller looks like it is worth a good look. Regards Marty -Original Message- From: David G. Friedman [mailto:[EMAIL PROTECTED] Sent: Tuesday, 14 June 2005 4:36 PM To: Struts Users Mailing List Subject: RE: Themes Martin, If you're using tiles already, be sure to check out a tiles controller. It can insert pieces (putList) into your tile however you wish it, i.e. if the path is /members, if you set a (session?) cookie, etc. A tutorial on the capabilities of Tiles Controllers by Cedric Dumoulin which I wrote about earlier this week. The link is under the userGuide section for Tiles (at the bottom of the page). The site is in France but the tutorial is in English, if I recall correctly. I read it a year ago but it should still be relevant and current. Regards, David -Original Message- From: Martin Ravell [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 14, 2005 2:09 AM To: 'Struts Users Mailing List' Subject: RE: Themes Thanks for the links David. The app is already using Tiles extensively and as a result I need something that integrates well with this framework. I've had a quick read of the SiteMesh and Xkins sites and plan to download and compare the two later today. Will post back any findings. Regards Marty -Original Message- From: David G. Friedman [mailto:[EMAIL PROTECTED] Sent: Tuesday, 14 June 2005 2:58 PM To: Struts Users Mailing List Subject: RE: Themes Martin, Have you looked at any of these? a) Tiles http://struts.apache.org b) SiteMesh: http://www.opensymphony.com/sitemesh c) XKins: http://xkins.sourceforge.net/ Regards, David -Original Message- From: Martin Ravell [mailto:[EMAIL PROTECTED] Sent: Monday, June 13, 2005 8:22 PM To: Struts User Mailing List Subject: Themes I have a requirement to build a 'Themes' (think 'skins') capability into the UI of my Struts app and would just like to poll the list for ideas on the best way to approach such a mechanism. Multiple customers use the same app but they need to be presented with a view that meets their specific requirements. For example graphics, fonts and even layout would be specific to the user's login (actually their company/organization which is stored in the database). Now, for ease of use I guess something relying on CSS would be a way to go. Since I already use stylesheets for most HTML elements specifying a particular theme's stylesheet would not be hard. The tricky part is that I'd also like to be able to specify different jsp pages (mainly for Tiles layouts) in case I need to modify the layout beyond what is easy to do with CSS. Ultimately I may well have functionality in the app itself that is specific to a given customer so this concept should deal with handling customisation to that level well. Ideally I'd like to have a concept of an 'alternate source' directory that is used by the app to load it's jsp. i.e. the app first looks under the appropriate alternate directory for a jsp and uses the page it finds there if it exists but falls back to the standard jsp dir if there is no alternate. This would mean that I could create a theme with only those pages that need to be modified rather than copying and modifying the entire jsp source tree. If anyone has had to implement something along these lines I'd love to hear from you. What sort of mechanisms have you found work well within the structure of a Struts app? My architecture is Struts, Tiles, Spring and Hibernate if you are interested but I'm thinking that it's the Struts area that I'll be looking at mostly for this job. Are there any Struts sub-projects that touch on this sort of thing? Regards Marty - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Themes
I seem to keep coming back to the 'put' definitions in my tiles defs. put name=sidemenu value=/layout/menu.jsp/ Is there a way that I can insert a variable into the value at runtime? Something like: put name=sidemenu value=${themes_dir}/layout/menu.jsp/ This still doesn't answer the fall-back to 'original' jsp tree idea but it would be a start. Worst case I could keep a register of the pages that have alternates for a particular theme and sub in the dir when necessary otherwise leaving it blank to grab the base 'original' version. Obviously I don't want to setup a put for every theme page. This would get out of hand awful fast. Regards Marty -Original Message- From: David G. Friedman [mailto:[EMAIL PROTECTED] Sent: Tuesday, 14 June 2005 4:36 PM To: Struts Users Mailing List Subject: RE: Themes Martin, If you're using tiles already, be sure to check out a tiles controller. It can insert pieces (putList) into your tile however you wish it, i.e. if the path is /members, if you set a (session?) cookie, etc. A tutorial on the capabilities of Tiles Controllers by Cedric Dumoulin which I wrote about earlier this week. The link is under the userGuide section for Tiles (at the bottom of the page). The site is in France but the tutorial is in English, if I recall correctly. I read it a year ago but it should still be relevant and current. Regards, David -Original Message- From: Martin Ravell [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 14, 2005 2:09 AM To: 'Struts Users Mailing List' Subject: RE: Themes Thanks for the links David. The app is already using Tiles extensively and as a result I need something that integrates well with this framework. I've had a quick read of the SiteMesh and Xkins sites and plan to download and compare the two later today. Will post back any findings. Regards Marty -Original Message- From: David G. Friedman [mailto:[EMAIL PROTECTED] Sent: Tuesday, 14 June 2005 2:58 PM To: Struts Users Mailing List Subject: RE: Themes Martin, Have you looked at any of these? a) Tiles http://struts.apache.org b) SiteMesh: http://www.opensymphony.com/sitemesh c) XKins: http://xkins.sourceforge.net/ Regards, David -Original Message- From: Martin Ravell [mailto:[EMAIL PROTECTED] Sent: Monday, June 13, 2005 8:22 PM To: Struts User Mailing List Subject: Themes I have a requirement to build a 'Themes' (think 'skins') capability into the UI of my Struts app and would just like to poll the list for ideas on the best way to approach such a mechanism. Multiple customers use the same app but they need to be presented with a view that meets their specific requirements. For example graphics, fonts and even layout would be specific to the user's login (actually their company/organization which is stored in the database). Now, for ease of use I guess something relying on CSS would be a way to go. Since I already use stylesheets for most HTML elements specifying a particular theme's stylesheet would not be hard. The tricky part is that I'd also like to be able to specify different jsp pages (mainly for Tiles layouts) in case I need to modify the layout beyond what is easy to do with CSS. Ultimately I may well have functionality in the app itself that is specific to a given customer so this concept should deal with handling customisation to that level well. Ideally I'd like to have a concept of an 'alternate source' directory that is used by the app to load it's jsp. i.e. the app first looks under the appropriate alternate directory for a jsp and uses the page it finds there if it exists but falls back to the standard jsp dir if there is no alternate. This would mean that I could create a theme with only those pages that need to be modified rather than copying and modifying the entire jsp source tree. If anyone has had to implement something along these lines I'd love to hear from you. What sort of mechanisms have you found work well within the structure of a Struts app? My architecture is Struts, Tiles, Spring and Hibernate if you are interested but I'm thinking that it's the Struts area that I'll be looking at mostly for this job. Are there any Struts sub-projects that touch on this sort of thing? Regards Marty - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
RE: Themes
Use CSS. Use one JSP/tile to get your content together, then based on the company setting, choose a CSS style sheet to go with it. The style sheet would contain your graphics, fonts, layouts, etc. Take a look at http://www.csszengarden.com/ to see the possibilities of this approach. Wiebe -Original Message- From: Martin Ravell [mailto:[EMAIL PROTECTED] Sent: Monday, June 13, 2005 5:22 PM To: Struts User Mailing List Subject: Themes I have a requirement to build a 'Themes' (think 'skins') capability into the UI of my Struts app and would just like to poll the list for ideas on the best way to approach such a mechanism. Multiple customers use the same app but they need to be presented with a view that meets their specific requirements. For example graphics, fonts and even layout would be specific to the user's login (actually their company/organization which is stored in the database). Now, for ease of use I guess something relying on CSS would be a way to go. Since I already use stylesheets for most HTML elements specifying a particular theme's stylesheet would not be hard. The tricky part is that I'd also like to be able to specify different jsp pages (mainly for Tiles layouts) in case I need to modify the layout beyond what is easy to do with CSS. Ultimately I may well have functionality in the app itself that is specific to a given customer so this concept should deal with handling customisation to that level well. Ideally I'd like to have a concept of an 'alternate source' directory that is used by the app to load it's jsp. i.e. the app first looks under the appropriate alternate directory for a jsp and uses the page it finds there if it exists but falls back to the standard jsp dir if there is no alternate. This would mean that I could create a theme with only those pages that need to be modified rather than copying and modifying the entire jsp source tree. If anyone has had to implement something along these lines I'd love to hear from you. What sort of mechanisms have you found work well within the structure of a Struts app? My architecture is Struts, Tiles, Spring and Hibernate if you are interested but I'm thinking that it's the Struts area that I'll be looking at mostly for this job. Are there any Struts sub-projects that touch on this sort of thing? Regards Marty - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Themes
While Tiles is better for page composition I think you'll find SiteMesh better suited for overall site layout, especially for things like custom CSS/JavaScript/... based on request or session level parameters. -- Abdullah -Original Message- From: Wiebe de Jong [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 14, 2005 11:48 AM To: 'Struts Users Mailing List' Subject: RE: Themes Use CSS. Use one JSP/tile to get your content together, then based on the company setting, choose a CSS style sheet to go with it. The style sheet would contain your graphics, fonts, layouts, etc. Take a look at http://www.csszengarden.com/ to see the possibilities of this approach. Wiebe -Original Message- From: Martin Ravell [mailto:[EMAIL PROTECTED] Sent: Monday, June 13, 2005 5:22 PM To: Struts User Mailing List Subject: Themes I have a requirement to build a 'Themes' (think 'skins') capability into the UI of my Struts app and would just like to poll the list for ideas on the best way to approach such a mechanism. Multiple customers use the same app but they need to be presented with a view that meets their specific requirements. For example graphics, fonts and even layout would be specific to the user's login (actually their company/organization which is stored in the database). Now, for ease of use I guess something relying on CSS would be a way to go. Since I already use stylesheets for most HTML elements specifying a particular theme's stylesheet would not be hard. The tricky part is that I'd also like to be able to specify different jsp pages (mainly for Tiles layouts) in case I need to modify the layout beyond what is easy to do with CSS. Ultimately I may well have functionality in the app itself that is specific to a given customer so this concept should deal with handling customisation to that level well. Ideally I'd like to have a concept of an 'alternate source' directory that is used by the app to load it's jsp. i.e. the app first looks under the appropriate alternate directory for a jsp and uses the page it finds there if it exists but falls back to the standard jsp dir if there is no alternate. This would mean that I could create a theme with only those pages that need to be modified rather than copying and modifying the entire jsp source tree. If anyone has had to implement something along these lines I'd love to hear from you. What sort of mechanisms have you found work well within the structure of a Struts app? My architecture is Struts, Tiles, Spring and Hibernate if you are interested but I'm thinking that it's the Struts area that I'll be looking at mostly for this job. Are there any Struts sub-projects that touch on this sort of thing? Regards Marty - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Themes
Martin, Have you looked at any of these? a) Tiles http://struts.apache.org b) SiteMesh: http://www.opensymphony.com/sitemesh c) XKins: http://xkins.sourceforge.net/ Regards, David -Original Message- From: Martin Ravell [mailto:[EMAIL PROTECTED] Sent: Monday, June 13, 2005 8:22 PM To: Struts User Mailing List Subject: Themes I have a requirement to build a 'Themes' (think 'skins') capability into the UI of my Struts app and would just like to poll the list for ideas on the best way to approach such a mechanism. Multiple customers use the same app but they need to be presented with a view that meets their specific requirements. For example graphics, fonts and even layout would be specific to the user's login (actually their company/organization which is stored in the database). Now, for ease of use I guess something relying on CSS would be a way to go. Since I already use stylesheets for most HTML elements specifying a particular theme's stylesheet would not be hard. The tricky part is that I'd also like to be able to specify different jsp pages (mainly for Tiles layouts) in case I need to modify the layout beyond what is easy to do with CSS. Ultimately I may well have functionality in the app itself that is specific to a given customer so this concept should deal with handling customisation to that level well. Ideally I'd like to have a concept of an 'alternate source' directory that is used by the app to load it's jsp. i.e. the app first looks under the appropriate alternate directory for a jsp and uses the page it finds there if it exists but falls back to the standard jsp dir if there is no alternate. This would mean that I could create a theme with only those pages that need to be modified rather than copying and modifying the entire jsp source tree. If anyone has had to implement something along these lines I'd love to hear from you. What sort of mechanisms have you found work well within the structure of a Struts app? My architecture is Struts, Tiles, Spring and Hibernate if you are interested but I'm thinking that it's the Struts area that I'll be looking at mostly for this job. Are there any Struts sub-projects that touch on this sort of thing? Regards Marty - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]