on 12-09-2014 12:32 PM
Hi Folks,'
I have a very common scenario to populate a drop down list according to the selection of parent drop down
For example I need to populate State drop down while selecting country.
I have already achieved this by invoking a MII transaction using Ajax/JSON calls. Transaction will invoke the SQL query and will return the result back to browser.
I am just wondering can't we do this via servlet in MII. I have copied the code below where I am invoking a servlet which will execute the SQL query. But I want to know how can I pass a parameter to the SQL query while invoking servlet. Is there any way to do?
function loadState()
{
var svltURL="/XMII/CM/GUI/Common/SERVLET/svltTemplate.irpt";
var qryActionType="Default/GUI/Queries/sqlGetState";
$.getJSON(svltURL,{QueryTemplate:qryActionType},function(result) {
var jsonobj = result;
for (i = 0; i < jsonobj.aaData.length; i++) {
var oActionType = document.getElementById("ddnType");
var newElement = document.createElement('option');
newElement.text = jsonobj.aaData[i][0];
newElement.value = jsonobj.aaData[i][0];
oActionType.options.add(newElement);
}
});
Here is the servlet code
<SERVLET NAME="Illuminator">
<HR>
Illuminator Content Here
<HR>
<PARAM NAME= "QueryTemplate" VALUE="{QueryTemplate}">
<PARAM NAME= "Stylesheet" VALUE="/XMII/CM/GUI/Common/XSLT/JQArrayFormat.xsl">
<PARAM NAME="Server" VALUE="{DataServer}">
<PARAM NAME= "Content-Type" VALUE="text/xml">
</SERVLET>
Thanks
Shaji
Hi Shaji,
If you want to assign the parameters to the query directly from applet/servlet tag, you can use
<Param name="Param.1" value={SomeValue}>
For js you can give, document.appletName.getQueryObject().serParam(index,value);
Hope this helps.
Best Regards,
Swaroop
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
6 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.