what is advantage of using scripting variable in custom tag?.
Do you mean creating a (page-scoped) variable to be used in scriptlets? like this:
There is no advantage at all! JSP2.0 was creating to get rid of all the java-code in the jsp's. It is possible but more or less for backward compatiblity: so don't start using it in real life (unless you are being threatened by your boss )