Honestly, I dont know if links on XPages created using anchor tags be coded to execute server side scripts. I have tried it but I get exceptions when I attempt to preview my XPage on client or browser.
So here is a work around to do the same.
1.Assume that you want to create a link by the name "My XPage Link"
2. Create a label on the XPage with the label mentioned in #1. Now move to the source code panel in the XPage.
3.Let me assume that the xsp code created for the label that you have just dopped in is <xp:label blah blah blah></xp:label>
4. Code the label with the server side script on its on click event. and ensure where it works fine.
5. Now locate the label in the source code panel and modify the label's code to suit the following,
<a href='#" class="your style class if any>
<xp:label blah blah blah></xp:label>
6. Now you got the link on the xpage that will execute the server side script.
Use case: It feels a little wearied to convert a label code on its onclick event, and then convert it into a link etc... You may ask y can't we use it as such and apply styles for the label directly.
Remember with links, you can write code that will support- hover, active and visited properties. Especially when u use links with in list then they can help you create beautiful menus etc....
And in these cases direct labels would not be of much use
Hope it makes sense to you :)