Skip to main content

How to use Static resource in shale for remoting access enhanced with AJAX

Yesterday I have found out how to use static resource in Shale framework.

I wanted to enhance the Use Case example of Shale using Prototype for AJAX support. Then I found out my problem with static resources in Shale framework was resolved with the next steps

1. In the web file descriptor (web.xml)

<context-param>
<param-name>
org.apache.shale.remoting.CLASS_RESOURCES
</param-name>
<param-value>
/static/*:org.apache.shale.remoting.impl.ClassResourceProcessor
</param-value>
</context-param>

<context-param>
<param-name>
org.apache.shale.remoting.DYNAMIC_RESOURCES
</param-name>
<param-value>
/dynamic/*:org.apache.shale.remoting.impl.MethodBindingProcessor
</param-value>
</context-param>

<context-param>
<param-name>

org.apache.shale.remoting.WEBAPP_RESOURCES
</param-name>
<param-value>
/webapp/*:org.apache.shale.remoting.impl.WebResourceProcessor
</param-value>
</context-param>


2. In your jsp files:


<script type="text/javascript" language="Javascript1.1"
src="<%= request.getContextPath() %>/webapp/resource/js/prototype-1.4.0.js.faces" >;

<script type="text/javascript" language="Javascript1.1">
// zipChanged(zip) is called when a selection is made
// from the zip code menu.

function zipChanged(zip) {
var url = '<%= request.getContextPath() %>' +
'/dynamic/remoting$business/objetoAjaxForZip.faces';

// Use Prototype's Ajax.Request for remoting
var pars = "zip=" + escape(zip);

var myAjax = new Ajax.Request(
url,
{
method: 'get',
parameters: pars,
onComplete: processZipCodeSelection
}
);

}
...
</script>


These step was based the next uri:

Click here

Comments

Anonymous said…
Your blog keeps getting better and better! Your older articles are not as good as newer ones you have a lot more creativity and originality now keep it up!