I am assuming you are already doing the below.
The HTML code generated is the starting point in order to get this thing done.
Use the "view source" feature available in the browser which you are using,
What you might be missing is the place holder for the '*'.
For this you have to create a 'DIV' element. Usually this can be created directly by having h
utputText with "ID" attribute. Set the style for this 'DIV' element to 'display:none' initially.
Now in your onchange() / onBlur() function, you could have the function that sets the styple
Note - This can be done easily if you have consistent naming for the field values. A sample example is as below. You would have to replace the parameters appropriately if you plan to use this function below.