RichFaces has quite a few extensions to make displays more sortable using just JSF. RichFaces itself uses jQuery internally in some cases. You might want to check the list of tags and see if any of them help. I use sortable extendedDataTables all the time.
However, sometimes raw jQuery is what you need. You can usually get things to work right by enclosing the <script> elements inside <f:verbatim> elements. Like so:
The rather odd construction here has its reasons.
Which could have been even worse, but in this particular case, the quotes were all unambiguous. Otherwise you'd have to do stuff like ""are you sure?"". In fact, even the ampersands are OK here, but if there'd been a "if ( a > b )", that would have been certain trouble.
An IDE is no substitute for an Intelligent Developer.