Back Forum Reply New

How to use RESTful Template

hi guys:

I am new to Spring3.0. Just wondering how to use RESTfulTemplate ?   I mean is the class only for test purpose ? I read the reference that it recommend using fromclient.

Most of time our client side was only html or jsp. so how can we put fromclient in jsp or html code.   

I just feel very confusing about this. Thanks
Tony

It isn't just for testing purposes if it was it would be part of the test jar!. You can use the RestTemplate to call REST style/based webservices and interpret the response. The RestTemplate needs something to create and call a ucl (rest is still from), to do that it is recommended to use the fromclient library (you inject that into the RestTemplate).

hi Marten:

Thanks for ur reply.

But which part call RestTemplate class, by this i mean, user only hit the webpage (jsp, html) and create the ucl.

In the traditional way, jsp -gt; controller -gt; server layer -gt; dataaccess layer

If using restFul, how the flow will look like ?

Thanks
Tony

jsp -gt; controller -gt; server layer -gt; dataaccess layer is the JSF traditionnal way.

Spring MVC traditionnal way is :

=gt; controller lt;=gt; service layer lt;=gt; data access layer      ||  forward model      ||
lt;= JSP

You are mixing client RestTemplate, which is just like calling a WebService and Rest Controllers, which are extracting parameters from URI instead of GET or POST parameters.

hi guys:

Thanks for ur reply. could u give me a simple example ?   

like i have a jsp page, when i click a submit button and then it will fire a Spring Controller. Thanks
Tony
¥
Back Forum Reply New