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!

Popular posts from this blog

My first serious Groovy class ..... decompiling java classes with closures

After I read the chapter 6 "closures" of the book Groovy and Grails Recipe, and I decided to use the power of closures of Groovy for resource (files) with other problem that I had, decompile in one step every class of jar library. Well, the purpose of this class is call an external java decompiler (jad) from a Groovy class and execute the command into directory where the jar file was decompressed. And by using the power of closures executes recursively into this directory until find the classes. Well, no more words, here the class package demo class Executor { // directory where the library(jar) was decompressed def path /** * Execute the decompilation of the classes into the directory defined in the path * @return */ def decompileClasses(){ def directory = new File(path) //make use of closures defined in the Object class directory.eachFileRecurse { def name = it.absolutePath //if the current resource hasn't a .class extension continues with

How to .. Integration Non-SAP J2EE-based Web Applications into SAP Portal with SSO Part 1

We are going to integrate Non-SAP J2EE-based Web Applications into the SAP Portal with Application Integrator and SSO. In this part, I will discuss the overall of these posts and configure the iView with Application Integrator Overview of Integration. To perform this integration must take into account the following steps: Deployment of the portal application for the creation of the system portal object Create and set the type of Application Integrator iView that will contain the applications to integrate. Installing SAPSSOEXT and SAPSECU libraries Deployment of the application gateway called SsoGatewayWeb Changing the target application. This integration has the following restrictions: It applies only for web applications based on J2EE Servlet. Depend exclusively on the sucessful load of the libraries supported by SAP (sapssoext and sapsecu) in both Windows and UNIX environments. The target application must have created a profile for the user id logged to the SAP portal, this sh

WebDynpro for Java: Tutorial of the Basic Usage of RoadMap Component

We will create a local Development component project of the type Web Dynpro as follow Our project will contain only 3 views with the purpose of show the basic usage of the roadMap object. After, we create our component controller RoadMap and the RoadMapView view as follow Now, we will create the 2 views more, the previous one will contain only the RoadMap Object (RoadMapView) used in all the project, the other ones show the flow between screens. Here the list of the 3 views: RoadMapView,  InitView, and ConfirmView. Now, we will add the component RoadMap object (it is on the Standar Complex Group) to the RoadMapView view, but first delete the default object added to the view, after we will need to add two steps (it could be more, depends of your logic) to our roadmap object. In order to do that we will use the Outline view of the NWDS. We add the two steps as follow The type steps to add at the RoadMap object will be ot the "RoadMapStep" type. The name of the steps are: Init