It is quite easy to use the ArcGIS JavaScript API in a portal environment, although there are some considerations that have to do with portlet development as opposed to jsp/servlet development. The samples provided in the ArcGIS JavaScript API Resource