Paging Using AJax
Hi,
I am trying to write a code for Paing using JSP, Ajax, Servlet.
I have problem with managing indexes.
Here what I have done...
I have created a js file which will send an ajax request to servlet.
request consists of startIndex, endIndex .
Using this values, servlet will fetch data & send back to js using JSON..
Problem I am facing with this solution is that.. I am not being able to index pages properly...
wht i do is, in js, i receive id of current page.consider page Factor is 3
if(currentPage==0)
startIndex=1;
endIndex=startIndex+2; //here 3 is page factor
else if(currentPage!=0)
startIndex=((currentPage-1)*3)+1;
endIndex=startIndex+2;
this works properly for even ranges...but whenever I found a NULL value in db, I am not able to generate next & prev indexes propely.
Also if anyone helps me in dividing pages into chunks i.e
<< 2 3... 4 5 6 >> , in such format.it will be very helpful...
Thanks,
Avdhoot G.
Hi Amir,
after some months I found a workaround that solves this issue: just add & after your query string value, it will separate your parameter value from other strings that may be added by sharepoint controls.
ie:
if your page is http://spsite/page.aspx?param=value
just call it like this http://spsite/page.aspx?param=value&
It works!
Ciao
Fabio
Similar Messages
-
How to use Ajax Get Multiple Values in Tabular form?
Hi All-
I am trying to use AJAX to get multiple values in tabular form by using Denes Kubicek's example in the following link -
http://apex.oracle.com/pls/otn/f?p=31517:239:9172467565606::NO:::
Basically, I want to use the drop down list to populate rest of the values on the form.
I have created the example(Ajax Get Multiple Values, application 54522) on Oracle site -
http://apex.oracle.com/pls/apex/f?p=4550:1:0:::::
Workspace: iConnect
login: demo
password: demo
I was able to duplicate his example on page 1 (home page).
However, I want to use system generate tabular form to finish this example, and was not able to populate the data correctly.
Page 2 (method 2) is the one that I am having trouble to populate the column values. When I checked application item values in Session, and the values seems to be populated correctly.
This is what I have done on this page:
1. Create an Application Process On Demand - Set_Multi_Items_Tabular2:
DECLARE
v_subject my_book_store.subject%TYPE;
v_price my_book_store.price%TYPE;
v_author my_book_store.author%TYPE;
v_qty NUMBER;
CURSOR cur_c
IS
SELECT subject, price, author, 1 qty
FROM my_book_store
WHERE book_id = :temporary_application_item2;
BEGIN
FOR c IN cur_c
LOOP
v_subject := c.subject;
v_price := c.price;
v_author := c.author;
v_qty := c.qty;
END LOOP;
OWA_UTIL.mime_header ('text/xml', FALSE);
HTP.p ('Cache-Control: no-cache');
HTP.p ('Pragma: no-cache');
OWA_UTIL.http_header_close;
HTP.prn ('<body>');
HTP.prn ('<desc>this xml genericly sets multiple items</desc>');
HTP.prn ('<item id="f04_' || :t_rownum || '">' || v_subject || '</item>');
HTP.prn ('<item id="f05_' || :t_rownum || '">' || v_price || '</item>');
HTP.prn ('<item id="f06_' || :t_rownum || '">' || v_author || '</item>');
HTP.prn ('<item id="f07_' || :t_rownum || '">' || v_qty || '</item>');
HTP.prn ('</body>');
END;
2. Create two application items - TEMPORARY_APPLICATION_ITEM2, T_ROWNUM2
3. Put the following in the Page Header:
<script language="JavaScript" type="text/javascript">
function f_set_multi_items_tabular2(pValue, pRow){
var get = new htmldb_Get(null,html_GetElement('pFlowId').value,
'APPLICATION_PROCESS=Set_Multi_Items_Tabular2',0);
if(pValue){
get.add('TEMPORARY_APPLICATION_ITEM2',pValue)
get.add('T_ROWNUM2',pRow)
}else{
get.add('TEMPORARY_APPLICATION_ITEM2','null')
gReturn = get.get('XML');
if(gReturn){
var l_Count = gReturn.getElementsByTagName("item").length;
for(var i = 0;i<l_Count;i++){
var l_Opt_Xml = gReturn.getElementsByTagName("item")[i];
var l_ID = l_Opt_Xml.getAttribute('id');
var l_El = html_GetElement(l_ID);
if(l_Opt_Xml.firstChild){
var l_Value = l_Opt_Xml.firstChild.nodeValue;
}else{
var l_Value = '';
if(l_El){
if(l_El.tagName == 'INPUT'){
l_El.value = l_Value;
}else if(l_El.tagName == 'SPAN' && l_El.className == 'grabber'){
l_El.parentNode.innerHTML = l_Value;
l_El.parentNode.id = l_ID;
}else{
l_El.innerHTML = l_Value;
get = null;
</script>
Add the follwing to the end of the above JavaScript:
<script language="JavaScript" type="text/javascript">
function setLOV(filter, list2)
var s = filter.id;
var item = s.substring(3,8);
var field2 = list2 + item;
f_set_multi_items_tabular2(filter, field2);
4. Tabular form query:
select
"BOOK_ID",
"BOOK",
"SUBJECT",
"PRICE",
"AUTHOR",
"QTY",
"BOOK_ID" BOOK_ID_DISPLAY
from "#OWNER#"."MY_BOOK_STORE"
5. In Book_ID_DISPLAY column attribute:
Add the following code to element attributes: onchange="javascript:f_set_multi_items_tabular2(this.value,'#ROWNUM#');"
Changed to -> onchange="javascript:setLOV(this,'f03');"
Now, T_ROWNUM2 returns value as f03_0001. But, TEMPORARY_APPLICATION_ITEM2 returns as [object HTMLSelectElement]...
Please help me to see how I can populate the data with this tabular form format. Thanks a lot in advanced!!!
Ling
Updated code in Red..Ling
Lets start with looking at what the javascript code is doing.
function f_set_multi_items_tabular(pValue, pRow){
/*This will initiate the url for the demand process to run*/
var get = new htmldb_Get(null,html_GetElement('pFlowId').value,
'APPLICATION_PROCESS=Set_Multi_Items_Tabular',0);
if(pValue){
/*If there is an value than submit item name with value*/
get.add('TEMPORARY_APPLICATION_ITEM',pValue)
get.add('T_ROWNUM',pRow)
}else{
/*Else set the item TEMPORARY_APPLICATION_ITEM to null*/
get.add('TEMPORARY_APPLICATION_ITEM','null')
/*Submit the url and te returned document is of type XML*/
gReturn = get.get('XML');
if(gReturn){
/*There is something returned*/
var l_Count = gReturn.getElementsByTagName("item").length;
/*For all elements of the tag item*/
for(var i = 0;i<l_Count;i++){
/*Get the item out of the XML*/
var l_Opt_Xml = gReturn.getElementsByTagName("item")[i];
/*Get the id of the item*/
var l_ID = l_Opt_Xml.getAttribute('id');
/*Get the element in the original page with the same id as
**the item we have in the XML produced by the ondemand process
var l_El = html_GetElement(l_ID);
/*Now get the value of the item form the XML*/
if(l_Opt_Xml.firstChild){
var l_Value = l_Opt_Xml.firstChild.nodeValue;
}else{
/*There is no value*/
var l_Value = '';
if(l_El){
/*There is an element with the same id as the item we are processing*/
if(l_El.tagName == 'INPUT'){
/*The element is an input item just set the value*/
l_El.value = l_Value;
}else if(l_El.tagName == 'SPAN' && l_El.className == 'grabber'){
/*If it is a span elment and has the class grabber
**Then set the innerHTML of the parent to the value
**and the id of the parent to the id
l_El.parentNode.innerHTML = l_Value;
l_El.parentNode.id = l_ID;
}else{
/*Else set the value as innerHTML*/
l_El.innerHTML = l_Value;
get = null;
Now where it went wrong in your initial post
The XML that was returned by your XML process would be something like
<body>
<desc>this xml genericly sets multiple items</desc>
<item id="f02_1">CSS Mastery</item>
<item id="f03_1">22</item>
<item id="f04_1">Andy Budd</item>
<item id="f05_1">1</item>
</body>
When you don't use apex_item to create your tabular form a item in the table will look like
<input id="f02_0001" type="text" value="CSS Mastery" maxlength="2000" size="16" name="f05" autocomplete="off">
Notice the id's f02_1 and f02_0001 don't match.
So to make it work the XML would have to look like
<body>
<desc>this xml genericly sets multiple items</desc>
<item id="f02_0001">CSS Mastery</item>
<item id="f03_0001">22</item>
<item id="f04_0001">Andy Budd</item>
<item id="f05_0001">1</item>
</body>
To do that simply use lpad in the ondemand process like
HTP.prn ('<item id="f02_' || lpad(:t_rownum,4,'0') || '">' || v_subject || '</item>');
HTP.prn ('<item id="f03_' || lpad(:t_rownum,4,'0') || '">' || v_price || '</item>');
HTP.prn ('<item id="f04_' || lpad(:t_rownum,4,'0') || '">' || v_author || '</item>');
HTP.prn ('<item id="f05_' || lpad(:t_rownum,4,'0') || '">' || v_qty || '</item>');
Keep in mind that the above is based on your original post and #ROWNUM# not being lpadded with zero's.
Nicolette -
Values having html tags not getting populated while using AJAX in APEX
Hi,
I am using AJAX to populate certain values in a tabular report.
I have a java script of this form (I have taken this example from Denes's example http://apex.oracle.com/pls/otn/f?p=31517:241:1400877312570049)
<script language="JavaScript" type="text/javascript">
function f_set_multi_items_tabular(pValue, pRow){
var get = new htmldb_Get(null,html_GetElement('pFlowId').value,
'APPLICATION_PROCESS=Set_Multi_Items_Tabular',0);
if(pValue){
get.add('TEMPORARY_APPLICATION_ITEM',pValue)
get.add('T_ROWNUM',pRow)
}else{
get.add('TEMPORARY_APPLICATION_ITEM','null')
gReturn = get.get('XML');
if(gReturn){
var l_Count = gReturn.getElementsByTagName("item").length;
for(var i = 0;i<l_Count;i++){
var l_Opt_Xml = gReturn.getElementsByTagName("item");
var l_ID = l_Opt_Xml.getAttribute('id');
var l_El = html_GetElement(l_ID);
if(l_Opt_Xml.firstChild){
var l_Value = l_Opt_Xml.firstChild.nodeValue;
}else{
var l_Value = '';
if(l_El){
if(l_El.tagName == 'INPUT'){
l_El.value = l_Value;
}else if(l_El.tagName == 'SPAN' && l_El.className == 'grabber'){
l_El.parentNode.innerHTML = l_Value;
l_El.parentNode.id = l_ID;
}else{
l_El.innerHTML = l_Value;
get = null;
</script>
And I have the application process as follows
BEGIN
OWA_UTIL.mime_header ('text/xml', FALSE);
HTP.p ('Cache-Control: no-cache');
HTP.p ('Pragma: no-cache');
OWA_UTIL.http_header_close;
HTP.prn ('<body>');
HTP.prn ('<desc>this xml genericly sets multiple items</desc>');
HTP.prn ('<item id="f05_000' || :T_ROWNUM || '">' || :TEMPORARY_APPLICATION_ITEM || '</item>');
HTP.prn ('</body>');
END;
If I have :TEMPORARY_APPLICATION_ITEM as 'Vikas' it gets displayed properly but if I have '<b>Vikas<b>' it shows null. if it has any HTML tags function l_Opt_Xml.firstChild.nodeValue is not working properly .Please tell me what modiifcation can I use in function l_Opt_Xml.firstChild.nodeValue to get Values with HTML tags also to get displayed.
Thanks,
VikasVikas,
Try escaping special characters: htf.escape_sc(:TEMPORARY_APPLICATION_ITEM)Regards,
Dan -
Help on jsp code to display data in same page using using ajax ?
Is there any jsp code to display in same page using using ajax ?
Re: need help on how to display data in same jsp page. Locking.
-
How can i upload file using ajax post request and jsp
Hi
this is my code files
addPhoto.jsp
<html>
<head>
<title>Add Photo</title>
<script>
var optionNo = 0;
var i=1;
var val=0;
var file = 0;
var exten = new Array(".jpg",".jpeg",".gif");
function addValues()
for(var i=0;i<5;i++)
optionNo += 1;
oNewOption = new Option();
oNewOption.text = optionNo;
oNewOption.value = optionNo;
addSelect.add(oNewOption);
function addBoxes()
var str = "";
var j=0;
val = document.getElementById('addSelect').value;
for(j=1; j<= val; j++)
str = str + '<font size=3>file:' + j + '</font>';
str = str + '<input type="file" id=filepath'+ j +' name=file'+ j + ' onchange="uploadFile(hidden'+ j + '.value)"><div id="result'+ j +'"></div>
str = str + '<input type="hidden" name="hidden' + j + '" value=' + j +'>';
document.getElementById('addPhoto').innerHTML = str;
function uploadFile(value)
var str = "filepath" + value;
file = value;
var param = document.getElementById(str).value;
var parameter = "filepath=" + param;
alert(parameter.length);
if(checkValidity(param))
var url = "uploadFile.jsp";
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
req.open("POST", url, true);
req.setRequestHeader("Content-type", "multipart/form-data");
//req.setRequestHeader("Content-length", parameter.length);
req.setRequestHeader("Connection", "close");
req.onreadystatechange = callback;
req.send(null);
else
document.getElementById("result" + file).innerHTML = "upload .jpeg,.jpg,.gif Files Only";
function callback() {
if (req.readyState == 4) {
updatepage(req.responseText);
function updatepage(str){
document.getElementById("result" + file).innerHTML = str;
function checkValidity(str)
var i=0;
var j=0;
var str1 = str.substring(str.lastIndexOf("."),str.length);
alert(str1);
for(i=0;i<exten.length;i++)
if(str1.search(exten) != -1)
j++;
break;
if(j>0)
return true;
else
return false;
</script>
</head>
<body onload="addValues()">
<h5>Add Photo(s)</h5>
<select id="addSelect" name="addSelect" onchange="addBoxes()">
<option id="select" selected>Select</option>
</select>
<div id="addPhoto"></div>
</body>
</html>
uploadFile.jsp
<%@page import="java.io.*"%>
<%
/*try
String contentType = request.getContentType();
System.out.println(request.getMethod());
System.out.println("Content type is :: " +contentType);
if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0))
DataInputStream in = new DataInputStream(request.getInputStream());
DataInputStream in1 = in;
int formDataLength = request.getContentLength();
System.out.println(formDataLength);
byte dataBytes[] = new byte[formDataLength];
int byteRead = 0;
int totalBytesRead = 0;
while (totalBytesRead < formDataLength)
byteRead = in1.read(dataBytes, totalBytesRead, formDataLength);
totalBytesRead += byteRead;
out.println("<br>totalBytesRead : " + totalBytesRead + " : formDataLength = " + formDataLength);
} catch(Exception e) {
e.printStackTrace();
try
String filePath = request.getParameter("filepath");
System.out.println(filePath);
File f= new File(filePath);
String path = f.getName();
String contentType = request.getContentType();
System.out.println(contentType);
//InputStream in = new FileInputStream(filePath);
DataInputStream in = new DataInputStream(request.getInputStream());
int formDataLength = request.getContentLength();
System.out.println(formDataLength);
byte[] buf = new byte[1024];
OutputStream out1 = new FileOutputStream("c:/docs/" + path);
int len;
while ((len = in.read(buf)) > 0) {
out1.write(buf, 0, len);
in.close();
out1.close();
out.write("File Uploaded SucssesFully");
catch(Exception e)
e.printStackTrace();
out.write("error while Writing File");
%>
the above code in request.getContentType() i am getting 0. I am not passing the content length. for the same application with out using Ajax i am
getting the size of file... it is very very urgent for me.. pls help me out on this...
Any one having the code on this pls mail me the code...
my mail id ... [email protected]
Regards
Ashok KumarSure, you can upload a file, using a form input element of type file. You pick this up with a servlet, though you need a special request wrapper to sort out the multi-part request you get back that way (there's a suitable package on jakarta.apache.org/commons)
The servlet decrypts the file and can pass the results to a JSP for display.
Don't try to do the complicated stuff in a JSP, it all gets incredibly messy, and that's not what JSPs are for. -
Error processing a page when using AJAX
hi apex forum.
I need your help with a problem that presents me with an application in apex 4.2.
I have developed a html screen, in which I have created a table that contains a detailed items and on which the user can enter some values. these data that user enters, I calculate a total at the end of the page. To view the current total of the entries , the user presses a button that uses AJAX (to avoid having to refresh the whole page) to calculate totals and at the same time, i call an AJAX process to add each record to an apex_collection , until here everything perfect.
The problem is that when I want to save the information to pass it from apex_collection to the database (by pressing a button and make the official insert), I must first have to refresh the page, if not do it this way, Apex generate an Error Message.
it's important to say that error does not apper, if before pressing the button, i first refresh the page. Any suggestions??
I think I should use some internally command to synchronize or update the page.... any suggestions are welcome.,
thanks in advance,Soooo...
What is the error you are seeing?
Is the multi-row process still there? What exactly happens on submit (computations, validations, processes)?
Have you tried to run with debug enabled and were you able to see where the error originates? -
Uploading a file to server using ajax and struts
My problem is i wrote a program to upload a file to the server using Ajax.
Here iam used Struts and Ajax.
The problem is when iam uploaded a file from my PC the file is uploading to the server in the upload folder located in the server my system.
Iam using Tomcat server 5.0
But when iam trying to access it through other system it is not doing so
Giving an internal server error i,e 500.
Iam putting the necessary documents for ur reference.
Plz help me soon .
My exact requirement is i have to upload a file to the upload folder located in the server.
And i have to get the path of that file and display the file path exactly below the browse button from where iam uploaded a file.
That should be done without page refresh and submit thats y iam used Ajax
Any help would greatly appreciated
Thanks and Regards
Meerasaaheb.
The action class is FilePathAction
package actions;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
public class FilePathAction extends Action{
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
String contextPath1 = "";
String uploadDirName="";
String filepath="";
System.out.println(contextPath1 );
String inputfile = request.getParameter("filepath");
uploadDirName = getServlet().getServletContext().getRealPath("/upload");
File f=new File(inputfile);
FileInputStream fis=null;
FileOutputStream fo=null;
File f1=new File(uploadDirName+"/"+f.getName());
fis=new FileInputStream(f);
fo=new FileOutputStream(f1);
try
byte buf[] = new byte[1024*8]; /* declare a 8kB buffer */
int len = -1;
while((len = fis.read(buf)) != -1)
fo.write(buf, 0, len);
catch(Exception e)
e.printStackTrace();
filepath=f1.getAbsolutePath();
request.setAttribute("filepath", filepath);
return mapping.findForward("filepath");
the input jsp is
filename.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript">
alertflag = false;
var xmlHttp;
function startRequest()
if(alertflag)
alert("meera");
xmlHttp=createXmlHttpRequest();
var inputfile=document.getElementById("filepath").value;
xmlHttp.open("POST","FilePathAction.do",true);
xmlHttp.onreadystatechange=handleStateChange;
xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlHttp.send("filepath="+inputfile);
function createXmlHttpRequest()
//For IE
if(window.ActiveXObject)
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
//otherthan IE
else if(window.XMLHttpRequest)
xmlHttp=new XMLHttpRequest();
return xmlHttp;
//Next is the function that sets up the communication with the server.
//This function also registers the callback handler, which is handleStateChange. Next is the code for the handler.
function handleStateChange()
var message=" ";
if(xmlHttp.readyState==4)
if(alertflag)
alert(xmlHttp.status);
if(xmlHttp.status==200)
if(alertflag)
alert("here");
document.getElementById("div1").style.visibility = "visible";
var results=xmlHttp.responseText;
document.getElementById('div1').innerHTML = results;
else
alert("Error loading page"+xmlHttp.status+":"+xmlHttp.statusText);
</script></head><body><form name="thumbs" enctype="multipart/form-data" method="post" action="">
<input type="file" name="filepath" id="filepath" onchange="startRequest();"/>
</form>
<div id="div1" style="visibility:hidden;">
</div></body></html>
The ajax response is catching in a dummy.jsp
<%=(String)request.getAttribute("filepath")%>
corresponding action mapping
<action path="/FilePathAction" type="actions.FilePathAction">
<forward name="filepath" path="/dummy.jsp"/>
</action>
So plz help me to upload a file to the server from any PC.
Iam searched alot but didnt get any solution.Plz help me soon if it possible so
Iam in great need.
I have worked alot but not worked out.
Any help greatly appreciated -
Getting an error while trying to use AJAX servlet in EP
Hi All,
This is my first time trying to develop a PAR file using AJAX. I have a project called NonEmployee and in it there is a class called NonEmployeeHiring which extends AbstractPortalComponent. I am trying to use AJAX, so that when users select a position from a drop down on the JSP, it send the request to a servlet called PositionDetailServlet, which does the processing and sens response back. However, I am getting a very weird error back in the response from servlet. Seems like it does not make upto the servlet and a part of the error that i am getting says,
No security zone - access is denied
com.sap.portal.system/applications/NonEmployee/components/PositionDetailServlet
This is only a part of the big page of error. My servlet is in src.core folder. Here is my portalapp.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<application>
<application-config>
<property name="startup" value="true"/>
<property name="ServicesReference" value="com.sap.portal.ivs.iviewservice,com.sap.portal.ivs.connectorservice,com.sap.portal.runtime.system.inqmy,com.sap.portal.pcd.glservice,com.sap.portal.ivs.systemlandscapeservice,com.sap.portal.pcmbuilderservice,usermanagement,com.sap.portal.ivs.logger,com.sap.portal.usermapping,landscape,jcoclient"/>
<property name="SharingReference" value="urlgenerator"/>
</application-config>
<application-config>
<property name="SharingReference" value="urlgenerator"/>
</application-config>
<components>
<component name="NonEmployeeHiring">
<component-config>
<property name="ClassName" value="NonEmployeeHiring"/>
<property name="SecurityZone" value="low_safety"/>
</component-config>
<component-profile>
<property name="SystemIdentifier" value="SAP_R3_HumanResources"/>
<property name="groupSubGroupForSalTypeValidation" value="A,01,AS,A,02,AS,A,03,HR,A,04,AS,A,05,HR,A,06,HR,A,07,HR,B,03,HR,B,04,AS,B,05,HR,B,06,HR,B,07,HR"/>
</component-profile>
</component>
<component name="PositionDetailServlet">
<component-config>
<property name="ClassName" value="com.grainger.portal.servlets.PositionDetailServlet"/>
<property name="ComponentType" value="servlet"/>
</component-config>
</component> </components>
<services/>
</application>
Any help will be greatly appreciated.
Thanks in advance,
PreetThanks a lot for replying and trying to help me guys. Here is what my new portalapp.xml looks like
<?xml version="1.0" encoding="ISO-8859-1"?>
<application>
<application-config>
<property name="startup" value="true"/>
<property name="ServicesReference" value="com.sap.portal.ivs.iviewservice,com.sap.portal.ivs.connectorservice,com.sap.portal.runtime.system.inqmy,com.sap.portal.pcd.glservice,com.sap.portal.ivs.systemlandscapeservice,com.sap.portal.pcmbuilderservice,usermanagement,com.sap.portal.ivs.logger,com.sap.portal.usermapping,landscape,jcoclient"/>
<property name="SharingReference" value="urlgenerator"/>
</application-config>
<application-config>
<property name="SharingReference" value="urlgenerator"/>
</application-config>
<components>
<component name="NonEmployeeHiring">
<component-config>
<property name="ClassName" value="NonEmployeeHiring"/>
<property name="SecurityZone" value="com.sap.portal.pdk/low_safety"/>
</component-config>
<component-profile>
<property name="SystemIdentifier" value="SAP_R3_HumanResources"/>
<property name="groupSubGroupForSalTypeValidation" value="A,01,AS,A,02,AS,A,03,HR,A,04,AS,A,05,HR,A,06,HR,A,07,HR,B,03,HR,B,04,AS,B,05,HR,B,06,HR,B,07,HR"/>
</component-profile>
</component>
<component name="PositionDetailServlet">
<component-config>
<property name="ClassName" value="com.grainger.portal.servlets.PositionDetailServlet"/>
<property name="SecurityZone" value="com.sap.portal.pdk/low_safety"/>
<property name="ComponentType" value="servlet"/>
</component-config>
</component>
<component name="PositionDetailServlet1">
<component-config>
<property name="ClassName" value="com.grainger.portal.servlets.PositionDetailServlet1"/>
<property name="SecurityZone" value="com.sap.portal.pdk/low_safety"/>
<property name="ComponentType" value="servlet"/>
</component-config>
</component>
</components>
<services/>
</application>
I created a new servlet called PositionDetailServlet1 and put it in src.api folder, thinking that that might help. But no luck at all. I am wondering if tehre is a global setting on the server for it to allow servlets to run. Just my guess.
Any help will be greatly appreciated. That is no issue.
Thanks,
Preet -
Use Ajax with OAF developed in JDeveloper 9i for Oracle Apps 11.5.10.2
Hi,
I am looking to use Ajax to have the same Google type functionality to be impelmented in OAF pages.
Example : Searching of employee names, organization etc.
JDeveloper version is 9i
Oracle Apps - 11.5.10.2
Please advice.
Thanks,
AnirbanI dont think thats possible using OAF. OAF is not designed with AJAX in mind.
-
Using AJAX to call a method of controller.
I am working with weblogic 10.2 .I need to call a method of the controller using Ajax (because i don't wan to refresh the whole page).
I am new to Ajax.
Can any one provide me the stub or prototype for calling a method of contoller from jsp using AJax.Another approach, if you would like to call a Pageflow action and then update only a portion of a portlet with the result, would be to use the Dynamic Content taglib.
http://download.oracle.com/docs/cd/E13155_01/wlp/docs103/javadocjsp/commonui/dc/tld-summary.html
Edited by: Brad Posner on Jan 12, 2009 10:42 AM -
Help required for using ajax in netweaver
Hi..
Can i Use Ajax for my netweaver applications?? If yes, then how?? Any pointers regarding that will be adequately rewarded points..
ThanksFor pure JavaScript enabled AJAX application, no problem. You just write the application as usual and send XMLHttpRequest with parameters to server, then update the web page with your JavaScript code;
I can show you some sample code here:
<script type="text/javascript">
function createXMLHttpRequest() {
var xmlHttp;
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
return xmlHttp;
function onclick_changeModelHouse(id) {
var xmlHttp = createXMLHttpRequest();
xmlHttp.onreadystatechange = function(){
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
// here you get your page component with id or any you like,
// then update it with data returned from the request you sent;
// Here I update one image url path;
var img = document.getElementById("houseModel");
// suppose you return the image file name;
img.innerHTML="<img src='images/" + xmlHttp.responseText + "'>";
xmlHttp.open("GET", "http://myserver:8080/myApp//AjaxImageService?model="+id, true);
xmlHttp.send(null);
</Script>
For some button in your page you add javascript code like
onClick="onclick_changeModelHouse(id)"
somthing.
You need develop servlet to response your request, and usually you need pass back your data in XML format, here I just use plain text for easy understanding. -
Using AJAX to load city, state, metro area based on zip code
I'm new to getting APEX to work with AJAX properly. I've been reading some tutorials and trying to apply what they do to my situation, but I'm running into a problem. I have a text field item for zip code. What I want to happen is that when someone enters in a zip code, I want to use AJAX to populate 3 different select lists (1 each for state, city, and metro area) and to populate a checkbox (of neighborhoods based on the zip code as well). I'm looking at the examples in:
http://www.oraclealchemist.com/wp-content/uploads/2006/11/s281946.pdf
and
http://apex.oracle.com/pls/otn/f?p=11933:63
But they all use examples where the value of a text field item is used to populate 1 select list. I can't figure out how to apply that methodology to populate 3 select lists and 1 checkbox item. I've got all my SELECT statements written to populate these fields based on the value of the zip code text field item, but don't know how to convert what I already have to use AJAX.
Here are my SELECT statements:
P2805_STATE lov:
===========================================================================================
SELECT INITCAP(GEO_DATA_STATE.STATEFULLNAME) d,GEO_DATA_STATE.STATE v
FROM GEO_DATA_STATE, GEO_DATA_ZIP
WHERE isPrimary = 'P' and
trim(upper(GEO_DATA_ZIP.STATE)) = trim(upper(GEO_DATA_STATE.STATE)) and
GEO_DATA_ZIP.ZIPCODE = :P2805_ZIPCODE
ORDER BY STATEFULLNAME
P2805_CITY lov:
===========================================================================================
SELECT UNIQUE (INITCAP(GEO_DATA_CITY.CITY)) d,GEO_DATA_CITY.CITY v
FROM GEO_DATA_STATE, GEO_DATA_ZIP, GEO_DATA_CITY
WHERE
trim(upper(GEO_DATA_ZIP.STATE)) = trim(upper(GEO_DATA_STATE.STATE)) and
trim(upper(GEO_DATA_ZIP.CITY)) = trim(upper(GEO_DATA_CITY.CITY)) and
GEO_DATA_ZIP.ZIPCODE = :P2805_ZIPCODE
ORDER BY GEO_DATA_CITY.CITY
P2805_METRO_AREA lov:
===========================================================================================
SELECT UNIQUE (INITCAP(GEO_DATA_METRO.METRO_AREA)) d,GEO_DATA_METRO.CODE v
FROM GEO_DATA_STATE, GEO_DATA_ZIP, GEO_DATA_METRO
WHERE
trim(upper(GEO_DATA_ZIP.STATE)) = trim(upper(GEO_DATA_STATE.STATE)) and
trim(upper(GEO_DATA_ZIP.METROCODE)) = trim(upper(GEO_DATA_METRO.CODE)) and
GEO_DATA_ZIP.ZIPCODE = :P2805_ZIPCODE
ORDER BY 1
P2805_NEIGHBORHOOD lov:
===========================================================================================
SELECT UNIQUE (INITCAP(GEO_DATA_HOOD.HOOD)) d,GEO_DATA_HOOD.HOOD v
FROM GEO_DATA_STATE, GEO_DATA_ZIP, GEO_DATA_METRO, GEO_DATA_HOOD
WHERE
trim(upper(GEO_DATA_ZIP.STATE)) = trim(upper(GEO_DATA_STATE.STATE)) and
trim(upper(GEO_DATA_ZIP.METROCODE)) = trim(upper(GEO_DATA_METRO.CODE)) and
GEO_DATA_HOOD.METRO_CODE = GEO_DATA_METRO.CODE and
GEO_DATA_ZIP.ZIPCODE = :P2805_ZIPCODE
ORDER BY 1Do all these statements need to go in 1 on-demand process? Where do I go from here?Andy, cool. This is starting to make more sense. THANKS A BUNCH! OK. I've gone ahead and modified the on demand process to suit my needs, so I have:
begin
owa_util.mime_header('text/xml', FALSE );
htp.p('Cache-Control: no-cache');
htp.p('Pragma: no-cache');
owa_util.http_header_close;
-- Building States list
htp.prn('<SELECT>');
FOR i in (
SELECT INITCAP(GEO_DATA_STATE.STATEFULLNAME) d, GEO_DATA_STATE.STATE v
FROM GEO_DATA_STATE, GEO_DATA_ZIP
WHERE isPrimary = 'P' and
trim(upper(GEO_DATA_ZIP.STATE)) = trim(upper(GEO_DATA_STATE.STATE)) and
GEO_DATA_ZIP.ZIPCODE = :P2805_ZIPCODE
ORDER BY STATEFULLNAME
LOOP
htp.prn('<OPTION VALUE=''' || i.v || '''>' || i.d || '</OPTION>');
END LOOP;
htp.prn('</SELECT>');
-- Building Cities list
htp.prn('<SELECT>');
FOR i in (
SELECT UNIQUE (INITCAP(GEO_DATA_CITY.CITY)) d, GEO_DATA_CITY.CITY v
FROM GEO_DATA_STATE, GEO_DATA_ZIP, GEO_DATA_CITY
WHERE
trim(upper(GEO_DATA_ZIP.STATE)) = trim(upper(GEO_DATA_STATE.STATE)) and
trim(upper(GEO_DATA_ZIP.CITY)) = trim(upper(GEO_DATA_CITY.CITY)) and
GEO_DATA_ZIP.ZIPCODE = :P2805_ZIPCODE
ORDER BY GEO_DATA_CITY.CITY
LOOP
htp.prn('<OPTION VALUE=''' || i.v || '''>' || i.d || '</OPTION>');
END LOOP;
htp.prn('</SELECT>');
-- Building Metro Area list
htp.prn('<SELECT>');
FOR i in (
SELECT UNIQUE (INITCAP(GEO_DATA_METRO.METRO_AREA)) d, GEO_DATA_METRO.CODE v
FROM GEO_DATA_STATE, GEO_DATA_ZIP, GEO_DATA_METRO
WHERE
trim(upper(GEO_DATA_ZIP.STATE)) = trim(upper(GEO_DATA_STATE.STATE)) and
trim(upper(GEO_DATA_ZIP.METROCODE)) = trim(upper(GEO_DATA_METRO.CODE)) and
GEO_DATA_ZIP.ZIPCODE = :P2805_ZIPCODE
ORDER BY 1
LOOP
htp.prn('<OPTION VALUE=''' || i.v || '''>' || i.d || '</OPTION>');
END LOOP;
htp.prn('</SELECT>');
-- Building Neighborhood list
htp.prn('<SELECT>');
FOR i in (
SELECT UNIQUE (INITCAP(GEO_DATA_HOOD.HOOD)) d, GEO_DATA_HOOD.HOOD v
FROM GEO_DATA_STATE, GEO_DATA_ZIP, GEO_DATA_METRO, GEO_DATA_HOOD
WHERE
trim(upper(GEO_DATA_ZIP.STATE)) = trim(upper(GEO_DATA_STATE.STATE)) and
trim(upper(GEO_DATA_ZIP.METROCODE)) = trim(upper(GEO_DATA_METRO.CODE)) and
GEO_DATA_HOOD.METRO_CODE = GEO_DATA_METRO.CODE and
GEO_DATA_ZIP.ZIPCODE = :P2805_ZIPCODE
ORDER BY 1
LOOP
htp.prn('<OPTION VALUE=''' || i.v || '''>' || i.d || '</OPTION>');
END LOOP;
htp.prn('</SELECT>');
end;It doesn't look like I would have to modify the appendToSelect function at all, correct? Is the checkbox that I need to populate handled the same way as these select lists? And it seems like I only need to make the 2 changes that you mentioned to get_AJAX_SELECT_XML function, right? So my javascript function should be like:
<script language="JavaScript1.1" type="text/javascript">
function get_AJAX_SELECT_XML(pThis,pSelect1,pSelect2,pSelect3,pSelect4){
if (document.getElementById('P2805_ZIPCODE').value.length == 5)
var l_Return = null;
var l_Select1 = $x(pSelect1);
var l_Select2 = $x(pSelect2);
var l_Select3 = $x(pSelect3);
var l_Select4 = $x(pSelect4);
var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=otn_Select_XML',0);
get.add('TEMPORARY_ITEM',pThis.value);
gReturn = get.get('XML');
var sels = gReturn.getElementsByTagName("select");
if(gReturn && l_Select1){
var l_Count = sels[0].getElementsByTagName("option").length;
l_Select1.length = 0;
for(var i=0;i<l_Count;i++){
var l_Opt_Xml = sels[0].getElementsByTagName("option");
appendToSelect(l_Select1, l_Opt_Xml.getAttribute('value'), l_Opt_Xml.firstChild.nodeValue)
if(gReturn && l_Select2){
var l_Count = sels[1].getElementsByTagName("option").length;
l_Select2.length = 0;
for(var i=0;i<l_Count;i++){
var l_Opt_Xml = sels[1].getElementsByTagName("option")[i];
appendToSelect(l_Select2, l_Opt_Xml.getAttribute('value'), l_Opt_Xml.firstChild.nodeValue)
if(gReturn && l_Select3){
var l_Count = sels[2].getElementsByTagName("option").length;
l_Select3.length = 0;
for(var i=0;i<l_Count;i++){
var l_Opt_Xml = sels[2].getElementsByTagName("option")[i];
appendToSelect(l_Select3, l_Opt_Xml.getAttribute('value'), l_Opt_Xml.firstChild.nodeValue)
if(gReturn && l_Select4){
var l_Count = sels[3].getElementsByTagName("option").length;
l_Select4.length = 0;
for(var i=0;i<l_Count;i++){
var l_Opt_Xml = sels[3].getElementsByTagName("option")[i];
appendToSelect(l_Select4, l_Opt_Xml.getAttribute('value'), l_Opt_Xml.firstChild.nodeValue)
get = null;
</script>
And then since all 4 items (3 select lists and 1 checkbox item) are populated based on the value inputted in the text field item, I would only need to add the following to the html form element attribute of my text field item, right?
onKeyUp="javascript:get_AJAX_SELECT_XML(this,'P2805_STATE','P2805_CITY','P2805_METRO_AREA','P2805_NEIGHBORHOOD');"Denes, thanks for the example. It seems like what I need to do is somewhere inbetween what you have and what's in the example on http://apex.oracle.com/pls/otn/f?p=11933:37. I have 3 select lists and 1 checkbox item that should all be populate depending on the value entered for the text item. Do I still need to split everything up then into a function and an on demand process for each select list and checkbox? -
Hi All,
Thanks for any help in advance.
I am trying to submit an item into the session by using AJAX iin version 4.1
I have a application process which is an on demand: run this application process when requested by a page process.
begin
:P4_FISCAL_YEAR2 := :AJAX_4_FISCAL_YEAR2;
end;then in the item :P4_FISCAL_YEAR2 have the html form element attributes set to:
(also the page item is set to None(Default) on page action when value changed.
onchange="selectChanged6(this)"and a page process
<script type="text/javascript">
function selectChanged6(filter)
var get = new htmldb_Get(null,$v('pFlowId'), 'APPLICATION_PROCESS=SET_4_FISCAL_YEAR2',0);
get.add('AJAX_4_FISCAL_YEAR2', filter.value);
var ret = get.get();
</script>The item doesnt seem to be submitting into the session and I cant figure out why, ThanksMarie,
I think I have acomplished what you are looking for but if your goal is quick response time then this can fluctuate since there is 1 ajax call made to set your item value and another ajax call for every chart you want to refresh.
This solution assumes the following:
1. all reports are in the same language and in english.
2. all reports are flash charts.
here is a demo: http://apex.oracle.com/pls/apex/f?p=43401:23:0
Go into your chart template and add the class refreshable_chart
<div class="rounded-corner-region refreshable_chart" id="#REGION_STATIC_ID#" #REGION_ATTRIBUTES#>
...Create the following dynamic action on your chart page:
Name: refresh_chart
Event: Change
Selection Type: Item(s)
Item(s): P4_FISCAL_YEAR2
True actions:
Sequence: 10
Action: execute pl/sql code
Code:
NULL;
{code}
Page Items to Submit: P4_FISCAL_YEAR2
Sequence: 20
Action: Execute JavaScript code
Affected Elements:
-- Type: jQuery Selector
-- jQuery Selector: .refreshable_chart
Code:
{code:javascript}
this.affectedElements.each(function(){
apex_RefreshFlashChart(&APP_PAGE_ID., this.id.substr(1), 'en');
{code}
Good Luck,
Tyson Jouglet
Edited by: Tyson Jouglet on Dec 14, 2011 10:33 AM -
Is it possible to create a tree with drag-and-drop functionality using ajax
I saw these samples;
Scott Spendolini's AJAX Select List Demo
http://htmldb.oracle.com/pls/otn/f?p=33867:1:10730556242433798443
Building an Ajax Memory Tree by Scott Spendolini
http://www.oracle.com/technology/pub/articles/spendolini-tree.html
Carl Backstrom ApEx-AJAX & DHTML examples;
http://htmldb.oracle.com/pls/otn/f?p=11933:5:8901671725714285254
Do you think is it possible to create a tree with drag-and-drop functionality using ajax and apex like this sample; http://www.scbr.com/docs/products/dhtmlxTree/
Thank you,
Kind regards.
TonguçHello,
Sure you can build it, I just don't think anyone has, you could also use their solution as well in an APEX page it's just a matter of integration.
Carl -
Cross browser issue using ajax report pull
Hi,
I have an application working using ajax report pull.
Entire application is based on ajax and its currently released.
Its performance is good. It works fine with mozilla but in ie,
links and buttons are not working.
my code is as follows:
var container = document.getElementById("divlayer");
container.innerHTML="";
var l_Val = document.getElementById('P15_ID').value;
var l_Val1 = document.getElementById('P15_REGION').value;
var l_Val2 = document.getElementById('P15_COUNTRY').value;
var get = new htmldb_Get(null,html_GetElement('pFlowId').value,null,10);
get.add('P15_GSI_PARTY_ID',l_Val);
get.add('P10_ID',l_Val);
get.add('P10_REGION',l_Val1);
get.add('P10_COUNTRY',l_Val2);
get.add('P10_ROWS',l_Val3);
get.add('P15_REGION',l_Val1);
get.add('P15_COUNTRY',l_Val2);
get.add('P15_ROWS',l_Val3);
gReturn = get.get(null,'<htmldb:BOX_BODY>','</htmldb:BOX_BODY>');
get = null;
document.getElementById("divlayer").style.visibility='visible';
document.getElementById("divlayer").style.display='block';
var elem = document.createElement('div');
elem.id='d1';
elem.innerHTML=gReturn;
container.appendChild(elem);
The links with doSubmit is not submitting to the same page in ie.
Please help me.
Thanks,
NivedithaHello Niveditha,
There're some differences in browsers... so yes it's possible that it doesn't work with the same code in another browser. The good news is that most of time there're workaround.
When I look at your code, you could already change document.getElementById() by $x(), which is doing the same, but comes from the APEX framework.
Do you have an idea where it fails in IE? Are you using the Developer Toolbar? Maybe that gives you more insights. You could also put some alert('hello 1'); in your code to see what's happening and how far it comes.
If you put it on apex.oracle.com we can have a look into more detail.
Dimitri
-- http://dgielis.blogspot.com
-- http://apex-evangelists.com
Maybe you are looking for
-
Not able to run the SSIS package in SQL Server Agent Job in SQL 2012
Hi, I scheduled a job (SQL SERVER AGENT) which will call my SSIS package. This package will execute 5 packages in loop. When I execute this job I am getting error as below ============================================================ Started : 12:30:
-
Importing flash with AS3 external files
developing a ui in flash for photo gallery which I am loading into dreamweaver. using as3 in flash to load external photo files so not all having to download on opening. have had no problem in dreamweaver with swfs with embedded jpgs. ui comes up in
-
Can You Convert .avi files to go onto itunes.
I was wondering if there is anyway to convert avi files to whatever file it needs to put on a ipod? Thanks!
-
I may scream if I don't find the answer! Just got my Iphone 3GS and trying to download Itunes. Run setup and at the end comes up the error that Itunes cannot install without Quicktime. Then the error that itunes was not able to configure as Quicktime
-
How to create slide shows in Elements 11?
Can't find how to create a slide show in Elements 11. Is it possible?