Ajax
Ajax
Thanks. Do you use either of the following formats:
1. ajaxRequest.open("POST", "/servlet/servletname", true);
2. ajaxRequest.open("POST", "http://192.168.50.51:8080/servlet/servletname", true);
Neither seems to work for me.
1. ajaxRequest.open("POST", "/servlet/servletname", true);
2. ajaxRequest.open("POST", "http://192.168.50.51:8080/servlet/servletname", true);
Neither seems to work for me.
No sorry. I'm not sure what Ajax client side javascript framework you are using. We have used Dojo in the past, but it really shouldn't matter.
Have your written Ajax clients for *any* Tomcat container? Try getting it working first to Tomcat on your desktop. If it works there, it should work when the server is on z/OS - unless your client-side framework requires a server side Java framework that isn't installed on your z/OS instance.
Have your written Ajax clients for *any* Tomcat container? Try getting it working first to Tomcat on your desktop. If it works there, it should work when the server is on z/OS - unless your client-side framework requires a server side Java framework that isn't installed on your z/OS instance.
Sorry, I did find an example, from the "JZOS Cookbook":
http://www.alphaworks.ibm.com/tech/zosj ... k/download
The example web app in this book has a Catalog Search web service that is front-ended with a Flex (Flash) application. But following is an example of a small DoJo client that implements a "live" dataset list picker combo-box thingy.
http://www.alphaworks.ibm.com/tech/zosj ... k/download
The example web app in this book has a Catalog Search web service that is front-ended with a Flex (Flash) application. But following is an example of a small DoJo client that implements a "live" dataset list picker combo-box thingy.
Code: Select all
<html>
<head>
<title>z/OS DSN Picker</title>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.4/dijit/themes/tundra/tundra.css"/>
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.4/dojo/dojo.xd.js" djConfig="parseOnLoad:true, isDebug: true" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.4/dijit/dijit.js" djConfig="parseOnLoad:true, isDebug: true" type="text/javascript"></script>
<script type="text/javascript">
dojo.require("dijit.form.ComboBox");
dojo.require("dojo.data.ItemFileReadStore");
</script>
<script type="text/javascript">
function doCbSearch(e) {
var fkey = dijit.byId("cbDsn").attr('displayedValue') + e.keyChar;
//console.debug("fkey=" + fkey + " key=" + e.charOrCode + "," + e.keyChar);
if ((e.keyChar == "") && (e.charOrCode != dojo.keys.BACKSPACE)) {
return; //Don't query unless a character or backspace has been entered
}
dijit.byId("cbDsn").store = new dojo.data.ItemFileReadStore({data: {items: []}});
var parms = new Object();
parms.filterkey = (e.charOrCode == dojo.keys.BACKSPACE) ? fkey.substring(0,fkey.length-1) : fkey;
if (fkey.indexOf(".") == -1) {
return; //Don't search until a complete HLQ is entered
}
parms.filterkey += (fkey[fkey.length-1] == ".") ? "**" : "*.**";
parms.workarealength = 1024;
dojo.xhrPost({
url: "api/catalogsearch",
load: handleResponse,
error: function(data, ioArgs) {alert("Error: "+data)},
content: parms,
handleAs: 'xml'
});
}
function handleResponse(data, ioArgs) {
var entries = new Array();
for (i=0; i<10; i++) { // take first 10 entries
var entry = data.getElementsByTagName("entry")[i];
if (entry == null) {
break;
}
entries[i] = {'dsn':dojo.attr(entry,"name")};
}
dijit.byId("cbDsn").store = new dojo.data.ItemFileReadStore({data: {items: entries}});
}
</script>
</head>
<body class="tundra">
DSN Picker: <input dojoType="dijit.form.ComboBox"
id="cbDsn"
searchAttr="dsn"
onKeyPress="doCbSearch"
searchDelay="300"
style="width: 44em"
highlightMatch="none"
autoComplete="false"/>
</body>
</html>