hi all, i am trying to design a shopping cart in java servlet, but i am having a little problem, how can i change or write this code in php to servlet code, here is the php code:

<?php

echo "<a href=\"x.php?action=insert&id=". $row[num_id]."\">BUY</a>"

?>

hw can i change the above php code to a servlet code.
the function of the code is to allow the user buy a product and the addToQuantity page will display that particular product and various info about that product, the way a shopping cart would?