Regarding AJAX

while running a webapplication using AJAX I'm getting the following Exception;
java.lang.Throwable: [HTTP:101249][ServletContext(id=8142880,name=ajax-validation,context-path=/ajax-validation)]: Servlet class com.sun.j2ee.blueprints.bpcatalog.ajax.ValidationServlet for servlet ValidationServlet could not be loaded because the requested class was not found in the classpath D:\SF_finalbuild\WLSF_finalbuild\SFServerfinalbuild\.wlnotdelete\extract\SFServerfinalbuild_ajax-validation_ajax-validation\ajax-validation.war;D:\SF_finalbuild\WLSF_finalbuild\.\SFServerfinalbuild\.wlnotdelete\extract\SFServerfinalbuild_ajax-validation_ajax-validation\jarfiles\WEB-INF\lib\weblogic.jar;D:\SF_finalbuild\WLSF_finalbuild\.\SFServerfinalbuild\.wlnotdelete\extract\SFServerfinalbuild_ajax-validation_ajax-validation\jarfiles\_wl_cls_gen.jar;D:\SF_finalbuild\WLSF_finalbuild\.\SFServerfinalbuild\.wlnotdelete\extract\SFServerfinalbuild_ajax-validation_ajax-validation.
java.lang.UnsupportedClassVersionError: com/sun/j2ee/blueprints/bpcatalog/ajax/ValidationServlet (Unsupported major.minor version 49.0).
     at weblogic.servlet.internal.ServletStubImpl.prepareServlet(Lweblogic.servlet.internal.RequestCallback;)V(ServletStubImpl.java:834)
     at weblogic.servlet.internal.ServletStubImpl.getServlet(Lweblogic.servlet.internal.RequestCallback;)Ljavax.servlet.Servlet;(ServletStubImpl.java:535)
     at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;Lweblogic.servlet.internal.FilterChainImpl;)V(ServletStubImpl.java:373)
     at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(ServletStubImpl.java:315)
     at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run()Ljava.lang.Object;(WebAppServletContext.java:6718)
     at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Lweblogic.security.subject.AbstractSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(AuthenticatedSubject.java:321)
     at weblogic.security.service.SecurityManager.runAs(Lweblogic.security.acl.internal.AuthenticatedSubject;Lweblogic.security.acl.internal.AuthenticatedSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(SecurityManager.java:121)
     at weblogic.servlet.internal.WebAppServletContext.invokeServlet(Lweblogic.servlet.internal.ServletRequestImpl;Lweblogic.servlet.internal.ServletResponseImpl;)V(WebAppServletContext.java:3764)
     at weblogic.servlet.internal.ServletRequestImpl.execute(Lweblogic.kernel.ExecuteThread;)V(ServletRequestImpl.java:2644)
     at weblogic.kernel.ExecuteThread.execute(Lweblogic.kernel.ExecuteRequest;)V(ExecuteThread.java:219)
     at weblogic.kernel.ExecuteThread.run()V(ExecuteThread.java:178)
     at java.lang.Thread.startThreadFromVM(Ljava.lang.Thread;)V(Unknown Source)

hi benubach..... i hav done that also...
var asynObj = getXMLHTTPRequest();
asynObj.open("GET","/ProcessComp/AjaxChecklistDisplayServlet?&selected_process = " + selectedValue + "",true);
asynObj.onreadystatechange = Display_responseText;
asynObj.send(null);
this is my code for getting XMLHTTP object....Where getXMLHTTPRequest() function is like :
function getXMLHTTPRequest()
var temp = false;
try
temp = new ActiveXObject("Microsoft.XMLHTTP");
catch(err1)
temp = false;
return temp;
Still no luck .... Any guess

Similar Messages

  • AJAX In  Portal

    Hi All,
    In SAP netweaver 7.1, I want to apply the "SAP Netweaver Portal AJAX Look " which i saw in BLOG
    http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/16855. [original link is broken]
    I also saw in our Portal Themes when go for a edit , there is option of AJAX ..but dont knw how to apply it ..
    Please Guide me ( by document o)or provide me steps to apply it  .
    Regards,
    Arpit

    Hi.
    There is a special forum regarding Ajax Framework Page.
    As for your question, please refer to SAP Note 1166135.
    Best regards,
    Aliaksandr Zhukau

  • Does Ajax call reset session time?

    All,
    I got a general question regarding AJAX calls. When an Ajax call is made, does that reset session time? I mean, if I set session to expire after 30mins and does not make any server hits other than Ajax calls for 30min, would the session expire?
    Thanks in advance.
    Edited by: user2865915 on Jun 17, 2011 7:22 AM

    user2865915 wrote:
    All,
    I got a general question regarding AJAX calls. When an Ajax call is made, does that reset session time? I mean, if I set session to expire after 30mins and does not make any server hits other than Ajax calls for 30min, would the session expire?Session is kept alive because of HTTP calls made from the client. Ajax calls are also HTTP requests. So no, the session does not expire.

  • Using SPRY colapsible menus

    I have playing around with using the SCM on a website. Seems
    to be great idea to turn about thirty one paragraph pages into just
    one. I think I have run into a problem though. The site has to be
    searchable. I ran the Google search from WebAssist on a SCM page I
    put on my site and it didn't find any of the text I searched for.
    So from my experiment it looks as tough text in a SPRY is not
    searchable.

    "Chris Leeds, MVP - FrontPage"
    <[email protected]> wrote in message
    news:g6qqga$16u$[email protected]..
    > Its not just SPRY, it's all that asynchronous stuff (at
    least that's what
    > I've been finding).
    Adobe has confused an already confusing issue, perhaps
    purposely, regarding
    Ajax and Spry :-)
    Ajax simply means that you are using JavaScript in the
    browser to read an
    xml file and load parts of that file into the document -
    that's Adobe's spry
    Ajax Framework. Spry "widgets" are simple JavaScript UI
    elements: menus,
    collapsing panels, accordions, etc. One has nothing to do
    with the other
    beyond the fact that you can populate the content of a
    widget, if you want,
    with data from an xml file.
    The ironic part of all this, is that when using Ajax to
    display content, the
    entire xml file is downloaded by the browser, though its
    content remains
    inaccessible until it is fetched by JavaScript.
    Disable JavaScript in the browser, and all content in the xml
    file is
    inaccessible, even though the file was actually downloaded.
    Search bots see absolutely nothing - whether script is
    disabled or not.
    A widget (spry or PVII) alone, however, is fully accessible
    whether or not
    script is enabled to both humans and search bots.
    The moral:
    Using Ajax, as it is available in Dreamweaver, has a price to
    pay - and that
    price is accessibility. Using a static iframe would, in fact,
    be more
    accessible, and arguably more usable.
    Using server-side scripting (PHP, for example) to download
    all the data that
    is contained in an xml file, hiding it, then using
    client-side scripting to
    show what you want on user demand, is more accessible,
    easier, and has the
    added benefit of being able to be fully accessible to both
    humans and bots
    if JavaScript is disabled in the browser.
    Al Sparber - PVII
    http://www.projectseven.com
    Fully Automated Menu Systems | Galleries | Widgets
    http://www.projectseven.com/go/Elevators

  • Shuttle and AJaX

    Hello all,
    I have an interesting issue to do with population of a shuttle in 3.1 using AJaX. The session state of selected items is what's causing me dramas, details as follows:
    The left side of the shuttle is populated according to a series of cascading select lists with an optional 'filter' checkbox on each. So every time the value of a select is changed or a checkbox checked/unchecked the ajax process is fired to repopulate the list accordingly.
    My Javascript is:
    function get_ITEMS(){
    var l_Count = 0
    var l_Return = null;
    var l_Select = $x('P2_ITEMS_LEFT');
    var get = new htmldb_Get(null,$v('pFlowId'),
    'APPLICATION_PROCESS=BUILD_ITEMS_SEL',0);
    get.addParam('x01',$v('P2_PRODFILTER'));
    get.addParam('x02',$v('P2_WORKFILTER'));
    get.addParam('x03',$v('P2_COREFILTER'));
    get.addParam('x04',$v('P2_PRODUCT'));
    get.addParam('x05',$v('P2_WORK_TYPE'));
    get.addParam('x06',$v('P2_CORESYSTEM'));
    get.addParam('x07',$v('P2_DISCIPLINE'));
    gReturn = get.get('XML');
    if(gReturn && l_Select){
    l_Count = gReturn.getElementsByTagName("option").length;
    l_Select.length = 0;
    for(var k=0;k<l_Count;k++){
    var l_Opt_Xml = gReturn.getElementsByTagName("option")[k];
    appendToSelect(l_Select, l_Opt_Xml.getAttribute('value'),
    l_Opt_Xml.firstChild.nodeValue)
    get = null;
    and the application level process BUILD_ITEMS_SEL is:
    DECLARE
    v_doprod varchar2(3);
    v_dowork varchar2(3);
    v_docore varchar2(3);
    v_prod varchar2(30);
    v_work varchar2(30);
    v_core varchar2(30);
    v_disc varchar2(30);
    BEGIN
    v_doprod := wwv_flow.g_x01;
    v_dowork := wwv_flow.g_x02;
    v_docore := wwv_flow.g_x03;
    v_prod := wwv_flow.g_x04;
    v_work := wwv_flow.g_x05;
    v_core := wwv_flow.g_x06;
    v_disc := wwv_flow.g_x07;
    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('<select>');
    FOR rec IN (
    SELECT distinct(item) as "ITEM"
    FROM TBL_ROVE_GRADINGS
    WHERE bus_unit = :P2_BUSUNIT
    AND discipline = v_disc
    AND ((product = v_prod or product = 'all') or v_doprod = 'No')
    AND ((work_required = v_work or work_required = 'all') or v_dowork = 'No')
    AND ((core_system like '%'||v_core||'%' or core_system = 'all') or v_docore = 'No')
    order by item asc
    LOOP
    htp.prn('<option value="' || rec."ITEM"|| '">' || rec."ITEM"|| '</option>');
    END LOOP;
    htp.prn('</select>');
    END;
    This all works perfectly well. I can change my cascading selects, select items, refilter and select other items, the AJaX does its lovely stuff and I've got beautiful process flow. I can have the right-hand side populated from multiple different left-hand lists according to filtering choices.
    The problem is when I need to have the selected items remembered in session state. If I navigate away and then return my left-side has retained its session state (it's rebuilt onload from the currently selected cascading select values) but the right-hand side is blank.
    I've got a nasty suspicion that the core of the issue is because the left side may no longer have the values that the right-side session state is looking for to mark as 'selected'.
    Essentially, what I need is a solution that will 'force' the right-side to have the values previously selected for various filtered choices in the left.
    Any thoughts?
    Thanks :D

    Hello Frank,
    >> If I navigate away and then return my left-side has retained its session state
    I’m assuming that “navigate away” means redirecting from the page (without submitting it). In this case, the session state of the page is not saved, and none of the AJAX components you are using save it either, so you are left with a session state that represent page loading time.
    The addParam() method doesn’t save state. You should use the add() method, which do set session state. For example
    get.add(' P2_PRODFILTER',$v('P2_PRODFILTER'));This will save the session state for all your select lists. Of course, you will have to change the on-demand process accordingly.
    The second thing is to handle the shuttle value. You need to remember that for the APEX engine, a shuttle value is a colon-delimited string. You should generate this value in your on-demand process, and use the APEX_UTIL.SET_SESSION_STATE procedure to save it into session state. If you anticipate that this value will include options that don’t exist on your shuttle left side (left is relative, so let’s say your source column) you should set the LOV option of “Display Extra Values” to Yes.
    Regards,
    Arie.
    &diams; Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.
    &diams; Author of Oracle Application Express 3.2 – The Essentials and More

  • 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 '&lt;b&gt;Vikas&lt;b&gt;' 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,
    Vikas

    Vikas,
    Try escaping special characters: htf.escape_sc(:TEMPORARY_APPLICATION_ITEM)Regards,
    Dan

  • I want to create a Ajax based Chating application using java .

    hi . I want to create an chating Application , and ajax based chatting application using java as my server side language ..i have some idea about it .. but one thing that i m not understanding is that how i will communicate with other users because each user has its own session so what i will do to send one messge to all the users ???? . i m new to JavaEE and i have chosen this as my semester project .. i need some help regarding this .

    First get it working without AJAX.

  • Use of Ajax to update a particular div in my code....using columnchart

    Hi All,
    I am having two columncharts, say columnChart1 and columnChart2.
    I want to display the columnChart2 in the place of columnChart1 when I select one particluar checkbox.
    I tried to implement and i reached here, "I am able to modify the existing graph with text and numeric but if i tried to put the new graph, i am getting the attached screen"...
    Here is my part of code where i am trying to update the graph,
    var oCB=new sap.ui.commons.CheckBox("compare",
      text:"Compare with Previous Year",
      checked : false,
      change : function() {
      if(oCB.getChecked()){
      alert('YES');
      //postRequest(oBarChart1);
      loadXMLDoc();
      else{
      alert('NO')
    function loadXMLDoc()
      var arun=10;
      alert("arundj");
    var xmlhttp;
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    xmlhttp.onreadystatechange=function()
      alert("justoutside");
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
       alert("inside");
        document.getElementById("oColumnChart").innerHTML=oColumnChart1;
    xmlhttp.open("GET","",true);
    xmlhttp.send();
    there is no issue with the charts both are fine if I try to draw them separately. How to do this?
    Regards,
    Arun

    Hi Arun,
    If you would like to just change the content of the chart than I would recommend below solution.
    This way you don't have to worry about AJAX calls and UI takes care of them.
    var oModel = new sap.ui.model.json.JSONModel({
    data : [ {
    country : 'France',
    product : 'quadcopter',
    sales : 34
    country : 'USA',
    product : 'quadcopter',
    sales : 40
    country : 'China',
    product : 'tricopter',
    sales : 65
    country : 'France',
    product : 'tricopter',
    sales : 10
    country : 'China',
    product : 'quadcopter',
    sales : 50
    country : 'Germany',
    product : 'tricopter',
    sales : 15
    country : 'USA',
    product : 'tricopter',
    sales : 22
    country : 'USA',
    product : 'heli',
    sales : 96
    country : 'China',
    product : 'airplane',
    sales : 86
    country : 'France',
    product : 'airplane',
    sales : 76
    country : 'Germany',
    product : 'airplane',
    sales : 58
    country : 'USA',
    product : 'airplane',
    sales : 96
    country : 'China',
    product : 'heli',
    sales : 26
    country : 'France',
    product : 'heli',
    sales : 71
    country : 'Germany',
    product : 'heli',
    sales : 76
    data_new : [ {
    quantity : '10',
    product : 'quadcopter',
    sales : 34
    quantity : '16',
    product : 'quadcopter',
    sales : 40
    quantity : '20',
    product : 'tricopter',
    sales : 65
    quantity : '86',
    product : 'tricopter',
    sales : 10
    quantity : '91',
    product : 'quadcopter',
    sales : 50
    quantity : '45',
    product : 'tricopter',
    sales : 15
    quantity : '70',
    product : 'tricopter',
    sales : 22
    quantity : '37',
    product : 'heli',
    sales : 96
    quantity : '55',
    product : 'airplane',
    sales : 86
    quantity : '29',
    product : 'airplane',
    sales : 76
    quantity : '68',
    product : 'airplane',
    sales : 58
    quantity : '79',
    product : 'airplane',
    sales : 96
    quantity : '81',
    product : 'heli',
    sales : 26
    quantity : '69',
    product : 'heli',
    sales : 71
    quantity : '87',
    product : 'heli',
    sales : 76
    sap.ui.getCore().setModel(oModel);
    var dataset = new sap.viz.ui5.data.FlattenedDataset({
    dimensions : [ {
    axis : 1,
    name : 'Country',
    value : "{country}"
    axis : 2,
    name : 'Product',
    value : "{product}"
    measures : [ {
    name : 'Sales',
    value : '{sales}'
    data : {
    path : "/data"
    var dataset_new = new sap.viz.ui5.data.FlattenedDataset({
    dimensions : [ {
    axis : 1,
    name : 'product',
    value : "{product}"
    axis : 2,
    name : 'quantity',
    value : "{quantity}"
    measures : [ {
    name : 'Sales',
    value : '{sales}'
    data : {
    path : "/data_new"
    var oChart = new sap.viz.ui5.StackedColumn("chart", {
    width : "100%",
    height : "200px",
    title : {
    visible : true,
    text : 'Test Stacked Column Chart'
    var oCB = new sap.ui.commons.CheckBox("compare", {
    text : "Compare with Previous Year",
    checked : false,
    change : function() {
    if (oCB.getChecked()) {
    oChart.destroyDataset(dataset);
    oChart.setDataset(dataset_new);
    oChart.rerender();
    } else {
    oChart.destroyDataset(dataset_new);
    oChart.setDataset(dataset);
    oChart.rerender();

  • 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 Kumar

    Sure, 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.

  • 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

  • Can Web Performance Test work on AJAX or Javascript Project which will show only one URL for all the pages?

    Hi there,
    I'm working on testing a AJAX and JavaScript Project which has several pages but all in the same URL. I need to test some attribute on the page or parameter past by AJAX or Javascript. Can Web Performance Test work to get what I want?
    Thanks,
    

    Hello,
    Thank you for your post.
    Web performance test is used to test if a server responses correctly and the response is consistent with what we expected. And we test the response speed, the stability and scalability.
    The Web Performance Test Recorder records both AJAX requests and requests that were submitted from JavaScript, but
     web test does not execute JavaScript. I am afraid that you can’t use web test to test parameter past by AJAX or JavaScript.
    Please see:
    Web Performance Test Engine Overview
    About JavaScript and ActiveX Controls in Web Performance Tests
    From the first link, “Client-side scripting that sets parameter values or results in additional HTTP requests, such as AJAX, does affect the load on the server and might require you to manually modify the Web Performance Test to simulate the scripting.”
    If you want to execute the function typically performed by script in web test, you need to accomplish it in coded web performance test or a web performance test plugin. Please see:
     How to: Create a Coded Web Performance Test
    How to: Create a Web Performance Test Plug-In
    I am not sure what the ‘some attribute on the page’ is. If you mean that you want to test those controls on the page, you can do coded UI test, which can test that the user interface for an application functions correctly. The coded UI test performs actions
    on the user interface controls for an application and verifies that the correct controls are displayed with the correct values. You can refer to this article for detailed information about code UI test:
    Verifying Code by Using Coded User Interface Tests
    Best regards,
    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Windows authentication on every ajax call MVC

    I've created an MVC project with windows authentication.
    From my views, I use Jquery to retrieve data from the controller asynchronously in order to provide a better user experience and reduce loading times.
    These functions look like
    public JsonResult someFunction(string parameter)
    return Json(result, JsonRequestBehavior.AllowGet);
    Everythings works as I want in Chrome, where it prompts me for login when I open the page and no more for the duration of that session. However, in IE, it prompts me for login when I open the page, and on every single ajax call...
    Why is this happening and how can I avoid it?
    I need to use windows authentication and IE, I can't change that...

    Hello,
    In order to get your issue solved more efficiently and since this is a MVC issue, I would recommend you post this issue in
    http://forums.asp.net/1146.aspx/1?MVC forum to get supports.
    Thanks for your understanding.
    Regards,
    Carl
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Ajax script is not working in Safari 3-4

    Hi,
    I'm using Ajax script in a form to select the correct number of days depending on chosen year and month. Here is the script I'm using:
    <script language="JavaScript" type="text/javascript">
    var daysInMonth = new Array();
    function createXMLHttpRequest() {
    var obj = null;
    if(window.XMLHttpRequest){
    obj = new XMLHttpRequest();
    } else if(window.ActiveXObject){
    obj = new ActiveXObject("Microsoft.XMLHTTP");
    } else {
    alert('Problem creating the XMLHttpRequest object');
    return obj;
    var req = createXMLHttpRequest();
    function setYear(year) {
    var url = "sidor/setdate.php";
    req.open('POST', url);
    req.onreadystatechange = setDaysInMonth;
    req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    req.send("year="+year);
    function setMonth(month) {
    if (month == 0) {
    var x = document.getElementById('month');
    month = x.options[x.selectedIndex].value;
    var day = document.getElementById('day');
    day.options.length = parseInt(daysInMonth[month-1]);
    for(var i=1; i <= daysInMonth[month-1]; i++) {
    day.options[i-1].value = i;
    day.options[i-1].text = i;
    function setDaysInMonth() {
    if (req.readyState == 4) {
    if (req.status == 200) {
    daysInMonth = req.responseText.split(";");
    setMonth(0);
    } else {
    alert("Error!\nError code: " + req.status);
    setYear(<?=$year?>);
    </script>
    The above script is working fine in IE7, Opera 9.64 and FF 3.0.8 but not in Safari. When I chose year and month (other month then april) the number of days is not changed. If I reload page and the chose directly february month, number of days is then 28 + 2 rows in selectbox with 29 and 30 but these cant be chosed. The way it should be showned is just 1-28. Please help me if the script needs to be adjust!
    Regards(Per

    I dont have the debugging tools, where can I find that?
    Site where you can find the form: http://www.sodermanskajakuthyrning.se/index.php?show=6&go=sidor/boka.php&page_id =31&lang=eng

  • Setting values to Display Only item during AJAX request

    Hello,
    Good Morning!
    In a master-detail form, in the detail report, I am populating two columns SERVICE_TAX_PCT and SERVICE_TAX_AMOUNT by making an AJAX request after selection of ACCOUNT_CODE.  Values are populated with out any issue. 
    However, as soon as I make those two fields as Display Only, the values are not getting set.  Is there a way to set the values to a field in the same time it should be restricted for user to change it?
    (APEX 4.2.6)
    Thanks,
    -Anand

    Hi Anand,
    anand_gp wrote:
    Hello,
    Good Morning!
    In a master-detail form, in the detail report, I am populating two columns SERVICE_TAX_PCT and SERVICE_TAX_AMOUNT by making an AJAX request after selection of ACCOUNT_CODE.  Values are populated with out any issue.
    However, as soon as I make those two fields as Display Only, the values are not getting set.  Is there a way to set the values to a field in the same time it should be restricted for user to change it?
    (APEX 4.2.6)
    check the example
    Step 1: Edit your page
    under CSS->Inline put the code given below
    .row_item_disabled {
       cursor: default;
       opacity: 0.5;
       filter: alpha(opacity=50);
       pointer-events: none;
    Step 2 : I guess you have Javascript function similar like given below
    you have to extract rowid first, for which you want to set the percentage , see line 6
    and see line 18, for disabling the column of that row.
    <script type="text/javascript">
       function f_fetch_tax_percentage(pThis) {
       var ajaxRequest;
       var ajaxResult;
       var row_id = pThis.id.substr(4);
       var percentage    = 'f05_' + row_id;   // replace f05 with the rowid of percentage column
       ajaxRequest = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=TAX_DTLS',0);
       ajaxRequest.addParam('x01',$v(pThis));
       ajaxResult = ajaxRequest.get();
       if ( ajaxResult.length > 0 ) {
       // set percentage
       $('#'+percentage).val(parseFloat(ajaxResult));
       // disable percentage column
       $("#f05_" + row_id).attr("readonly", true).addClass('row_item_disabled');        
    </script>
    Hope this helps you,
    Regards,
    Jitendra

  • Memory leak issue in AJAX Truclinet protocol

    Hi,
    I am using LR 11.5 installed in 4GB RAM and it is a 32 bit machine. Observed below things when trying to exceute a test with Ajax Truclient script even with 1 user.
    1. Unable to run the test for longer duration
    2. Abnormal termination of mdrv process and observed mdrv process taking High Memory utilization during testing.
    3. Observed same thing when testing using different load generators other than loacl host.
    What is the rout cause for this abnormal termination and high memory utilization of mdrv process?.
    Is there any patch released to fix this issue?
    Plese suggest solution for this problem.
    Regards,
    Sree
    +[edited phone by moderator]

    Hi @Sreek666 ,
    Thank you for visiting the HP Support Forums. I needed to edit your post and remove the phone number. From our Rules of Participation:
    Protect privacy - yours and others'. Don't share anything about yourself that you would not want to see on a road-side billboard. Don't post contact or other personal information-your own or anyone else's-or any content that you receive in one-to-one communications without the author's consent. For example, don’t post your computer’s serial # or contact information publicly, and do not allow someone you don’t know to remotely take control of your computer.
    If you need people to contact you directly, either ask them to send you a private message or subscribe to the thread so you will be notified when there are replies. You may also click on your name anywhere in the forum and you will be taken to your profile page, where you can find a list of threads you have participated in.
    Sharing personal email addresses, telephone numbers, and last names is not allowed for your safety. If you have any questions feel free to send me a private message in reply.
    Thank you
    George
    I work for HP

Maybe you are looking for