does anyone can give me some references about positioning elements in Struts. I find very awkward to do such considering Struts' underlying layout mechanism (template/theme). So what do I need to do to perform issued problem, since I can not perform anything directly on the page. I know there is xhtml-which is default template, css_xhtml , .... So I would like to use css_xhtml, I know to switch to it, but how can I appropriately modify it (should I extract struts2-core-2.0.11.jar library, then somehow modify what I want, and then repack it i store in classpath, or what...?). I'm guided by "Struts 2 in Action" - manning publisher. I would very appreciate if some one provide me straight references about my issue.
Thanks in advance!
Well, I try it, and find too much complicated and complex. I can not believe that ordinary html tags can not be rendered in the page where I use struts tags!?
It really huge disadvantage, and what should I do now when I can not render html tags?
I have no idea what you mean; of course you can use HTML tags in both JSP and FreeMarker templates.
What, specifically, are you having a problem with?
Getting the templates out of the struts2-core library is simple: copy it to a temporary directory, un-jar it using "jar xf", find the templates directory, and copy it either to the web app, or a source directory that's deployed with the application.
You can then do whatever you want to the templates: I generally copy the "css_xhtml" or "xhtml" templates to a new directory, like "my_css" or whatever. Then I set the global default theme to "my_css". I then modify the templates in the new theme.
Well, that modification border me. I have a registration form like this :
and, by default, it's ordered simply along left side of page with frameworks margin, paddings and rest l&f, which is quite uninteresting. So I want to add my margin spacing, the outlines around fields, the pics or color as a box background.Ok, I prepare template folder and copy the templates form .jar.Done.
Now, let say I want to perform mentioned modifications on <s:textfield> tag.
I go to template/xhtml/ and open textarea.ftl.
The textare.ftl is the file which consists of -controlheader.ftl, textarea.ftl and controlfooter.ftl.
Each of these files is comprise several file inclusion, and that is about 10-15 included file to perform <s:textfield> rendering. This is the content of tempalte/simple/textare.ftl, file :
I really do not get what part of file should I change to obtain aimed look and feel or even more, I do not know what file (since there is about 15 for this tag), to change to achieve such a things. I can not simply put each tag like this ;
where in .css I would define behavior of component...
Could you maybe show me the sample, of how should I do that modification?
Ok. I would create Css and place it in template/css_xhtml folder. In css I would specified style for div. Am I right? And if I am, how could I specify that this theme/this tag should use my css? Consider the case above: How should I perform such a thing like, specifying the size of <div> block, padding, border, color, background? Could you explain me that, and the same logic I will apply on any tag element.
aha. So I just provide Css, and define the attributes for the elements which theme use (is it css_xhtml-<div> or xhtml- <table>,<tr>,<td>..), it is, isn't it ?
But as I could conclude there are some limitations (for example, I cannot get visibility of borders, and such). Is there a few a things which cannot be applied by this way, as I spot (let say to control particular row, cell or division? I mean, can however specify that certain <tr> or <td> use appropriate class like <td class="one"/>,<td class="two"/>?
Or it cannot be done by this way? Thanks a lot for your patience...
You can style whatever DOM elements the templates create. Depending on which version of S2 you're using you might want to wrap the entire form/tables/divs etc. inside a wrapper div to make the CSS selectors easier and more isolated from other styles you might be using.
If you need to style very specific elements you might need to modify a template, as you say, as not all browsers support the CSS selectors needed to access all the DOM elements created.