Hello
You may check wicket-guide
http://wicket.apache.org/guide/guide/jsintegration.html
Simply override the page#renderHeader(IHeaderResponse response){
response.render(JavaScriptHeaderItem.forScript("your script here",null));
}
And may need to customize the output markup id to work.
On Mon, Feb 2, 2015 at 5:44 AM, Chris <[email protected]> wrote:
> Hi all,
>
> I would like to use Leaflet JS library in order to display open street
> maps. According to this library, certain JS code has to be placed in the
> body element of the html underneath a div element, e.g.:
>
> <body>
> <div id="map"></div>
> <script>
> var map = L.map('map').setView([51.505, -0.09], 13);
> L.tileLayer('https://{s}.tiles.mapbox.com/v3/{id}/{z}/{x}/{y}.png', {
> maxZoom: 18,
> attribution: 'Map data © <a
> href="http://openstreetmap.org">OpenStreetMap</a>
> contributors, ' +
> '<a
> href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>,
> ' +
> 'Imagery © <a href="http://mapbox.com">Mapbox</a>',
> id: 'examples.map-i875mjb7'
> }).addTo(map);
> L.marker([51.5, -0.09]).addTo(map)
> .bindPopup("<b>Hello world!</b><br />I am a
> popup.").openPopup();
> L.circle([51.508, -0.11], 500, {
> color: 'red',
> fillColor: '#f03',
> fillOpacity: 0.5
> }).addTo(map).bindPopup("I am a circle.");
> </script>
> </body>
>
> What is the best way to generate this code in wicket so that map makers
> can be set dynamically?
> I tried to insert it via add(new Label("script“,“...“) but in this case,
> all the quotation marks are escaped in a wrong way (using \).
>
> Thanks a lot, Chris
--
----------------------------------------------------------------------->
We do this not because it is easy. We do this because it is hard.
----------------------------------------------------------------------->
ShengChe Hsiao
----------------------------------------------------------------------->
[email protected]
[email protected]
----------------------------------------------------------------------->
VoIP : 070-910-2450
----------------------------------------------------------------------->