이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 24. Remoting
Seam uses Asynchronous JavaScript and XML (AJAX) to remotely access components from a web page. The framework for this functionality requires very little development effort — you can make your components AJAX-accessible with simple annotations. This chapter describes the steps required to build an AJAX-enabled web page, and explains the Seam Remoting framework in further detail.
24.1. Configuration 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
To use remoting, you must first configure your Seam Resource Servlet in your
web.xml
file:
Next, import the necessary JavaScript into your web page. A minimum of two scripts must be imported. The first contains all client-side framework code, which enables remoting functionality:
<script type="text/javascript" src="seam/resource/remoting/resource/remote.js"> </script>
<script type="text/javascript"
src="seam/resource/remoting/resource/remote.js">
</script>
The second contains the stubs and type definitions for the components you wish to call. This is generated dynamically, based on the local interface of your components, and includes type definitions for all classes that can be used to call the remotable methods of the interface. The script name reflects your component name. For example, if you annotate a stateless session bean with
@Name("customerAction")
, your script tag should look like this:
<script type="text/javascript" src="seam/resource/remoting/interface.js?customerAction"> </script>
<script type="text/javascript"
src="seam/resource/remoting/interface.js?customerAction">
</script>
If you want to access more than one component from the same page, include them all as parameters of your script tag:
<script type="text/javascript" src="seam/resource/remoting/interface.js?customerAction&accountAction"> </script>
<script type="text/javascript"
src="seam/resource/remoting/interface.js?customerAction&accountAction">
</script>
You can also use the
s:remote
tag to import the required JavaScript. Separate each component or class name that you want to import with a comma:
<s:remote include="customerAction,accountAction"/>
<s:remote include="customerAction,accountAction"/>