I've been looking around and I can't find a dummy's guide to adding my own CSS to a Wicket website project. But before I start... I'm fairly new to proper java development, so when I say "Dummy's guide" I really mean it! Simple and clear explanations for me here are very much appreciated!
I started with this guide here (http://wicket.apache.org/start/quickstart.html) and have that running fine. Next up, I want to add my own CSS and start messing about with it. And I'm getting nowhere fast. Mainly because I haven't got a clue how to do this in java (I come from a C#/asp.net background).
Anyway, those that know Apache Wicket will know this already, but the source for the quick start creates your code in a place like follows project/src/main/java/com/xyz
What I presumed I could do was add a CSS folder here... so I created a sample CSS and I stuck it here like this:
project/src/main/java/com/xyz/css/conor.css
(containing something real simple like the following)
h2 {
font-family: tahoma;
}
Then I removed the Wicket default css in my homepage.html and changed it to reference mine as follows:
<link rel="stylesheet" href="css/conor.css" type="text/css" />
But my page doesn't take any heed of the conor.css... Obviously I'm doing something wrong, but cannot find a step by step guide for a java dummy (aka me!).
I have read things like you need to install web tools for eclipse. I did have no idea what use this is to me or why it will instruct my pages to use the CSS.
Any help is very much appreciated!
A particularly awkward or difficult situation or circumstance. (Generally used with on. Refers to the pitch, i.e., wicket, used in the game of cricket and the difficulty of playing on one after it has been wetted with rain.) Primarily heard in UK, Australia.
The dismissal of a batsman is known as the taking of a wicket.
The fielding team accumulates wickets against the batting team as this is their main goal. In most cases, the maximum number of wickets taken is ten. There are five main ways teams can collect a wicket. They are: being caught, bowled, run out, stumped, or leg before wicket.
Each set shall be 9 in/22.86 cm wide and shall consist of three wooden stumps with two wooden bails on top. See Appendix D. The tops of the stumps shall be 28 in/71.12 cm above the playing surface and shall be dome shaped except for the bail grooves.
While Wicket parses the markup and tries to come up with proper links, you have to help Wicket understand your markup.
In your case you try to link to a resource that is located in the Java class path. This is different from the web context root (located in src/main/webapp). The difference between class path resources and web context resources is that Wicket is responsible for and controls access to class path resources, and that your container (i.e. jetty, tomcat, glassfish, etc) is responsible for and controls access to web context resources.
For example, when a resource is under the purview of Wicket, we can do all kinds of things with it, such as variable substitution, compression, minification, aggregation. These things are part of Wicket.
Now to your problem at hand, since you didn't tell Wicket that the linked resources are under its control, Wicket assumes that you want the container to handle those. To mitigate this, you should add a <wicket:link>
tag around your <link>
tag(s).
<head>
...
<wicket:link>
<link rel="stylesheet" href="css/conor.css" type="text/css" />
...
</wicket:link>
</head>
The <wicket:link>
tags tell Wicket to look for the enclosed resources and try to resolve them on the Java class path.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With