implementation XHViewState and add api