<p>If I can do this, how do I call Java code (methods for instance) from within JavaScript code, in Wicket. </p>

Assuming you mean JavaScript running on the client - you cause an HTTP redirect to be made to the server, and have your servlet react to the request for the given URL.
This is known as
Ajax
, and there are a
number
of
libraries
that help you do it..