How to set the Xml Encoding ISO-8859-1 to Transformer or DOMSource

I have a xml string and it already contains an xml declaration with encoding="ISO-8859-1". (In my real product, since some of the element/attribute value contains a Spanish character, I need to use this encoding instead of UTF-8.) Also, in my program, I need to add more attributes or manipulate the xml string dynamically, so I create a DOM Document object for that. And, then, I use Transformer to convert this Document to a stream.
My problme is: Firstly, once converted through the Transformer, the xml encoding changed to default UTF-8, Secondly, I wanted to check whether the DOM Document created with the xml string maintains the Xml Encoding of ISO-8859-1 or not. So, I called Document.getXmlEncoding(), but it is throwing a runtime error - unknown method.
Is there any way I can maintain the original Xml Encoding of ISO-8859-1 when I use either the DOMSource or Transformer? I am using JDK1.5.0-12.
Following is my sample program you can use.
I would appreciate any help, because so far, I cannot find any answer to this using the JDK documentation at all.
Thanks,
Jin Kim
import java.io.*;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Attr;
import org.xml.sax.InputSource;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
public class XmlEncodingTest
    StringBuffer xmlStrBuf = new StringBuffer();
    TransformerFactory tFactory = null;
    Transformer transformer = null;
    Document document = null;
    public void performTest()
        xmlStrBuf.append("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n")
                 .append("<TESTXML>\n")
                 .append("<ELEM ATT1=\"Yes\" />\n")
                 .append("</TESTXML>\n");
        // the encoding is set to iso-8859-1 in the xml declaration.
        System.out.println("initial xml = \n" + xmlStrBuf.toString());
        try
            //Test1: Use the transformer to ouput the xmlStrBuf.
            // This shows the xml encoding result from the transformer which will change to UTF-8
            tFactory = TransformerFactory.newInstance();
            transformer = tFactory.newTransformer();
            StreamSource ss = new StreamSource( new StringBufferInputStream( xmlStrBuf.toString()));
            System.out.println("Test1 result = ");
            transformer.transform( ss, new StreamResult(System.out));
            //Test2: Create a DOM document object for xmlStrBuf and manipulate it by adding an attribute ATT2="No"
            DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = dfactory.newDocumentBuilder();
            document = builder.parse( new StringBufferInputStream( xmlStrBuf.toString()));
            // skip adding attribute since it does not affect the test result
            // Use a Transformer to output the DOM document. the encoding becomes UTF-8
            DOMSource source = new DOMSource(document);
            StreamResult result = new StreamResult(System.out);
            System.out.println("\n\nTest2 result = ");
            transformer.transform(source, result);
        catch (Exception e)
            System.out.println("<performTest> Exception caught. " + e.toString());
    public static void main( String arg[])
        XmlEncodingTest xmlTest = new XmlEncodingTest();
        xmlTest.performTest();
}

Thanks DrClap for your answer. With your information, I rewrote the sample program as in the following, and it works well now as I intended! About the UTF-8 and Spanish charaters, I think you are right. It looks like there can be many factors involved on this subject though - for example, the real character sets used to create an xml document, and the xml encoding information declared will matter. The special character I had a trouble was u00F3, and somehow, I found out that Sax Parser or even Document Builder parser does not like this character when encoding is set to "UTF-8" in the Xml document. My sample program below may not be a perfect example, but if you replaces ISO-8859-1 with UTF-8, and not setting the encoding property to the transfermer, you may notice that the special character in my example is broken in Test1 and Test2. In my sample, I decided to use ByteArrayInputStream instead of StringBufferInpuptStream because the documentation says StringBufferInputStream may have a problem with converting characters into bytes.
Thanks again for your help!
Jin Kim
import java.io.*;
import java.util.*;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Attr;
import org.xml.sax.InputSource;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
* XML encoding test for Transformer
public class XmlEncodingTest2
    StringBuffer xmlStrBuf = new StringBuffer();
    TransformerFactory tFactory = null;
    Document document = null;
    public void performTest()
        xmlStrBuf.append("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n")
                 .append("<TESTXML>\n")
                 .append("<ELEM ATT1=\"Resoluci�n\">\n")
                 .append("Special charatered attribute test")
                 .append("\n</ELEM>")
                 .append("\n</TESTXML>\n");
        // the encoding is set to iso-8859-1 in the xml declaration.
        System.out.println("**** Initial xml = \n" + xmlStrBuf.toString());
        try
            //TransformerFactoryImpl transformerFactory = new TransformerFactoryImpl();
            //Test1: Use the transformer to ouput the xmlStrBuf.
            tFactory = TransformerFactory.newInstance();
            Transformer transformer = tFactory.newTransformer();
            byte xmlbytes[] = xmlStrBuf.toString().getBytes("ISO-8859-1");
            StreamSource streamSource = new StreamSource( new ByteArrayInputStream( xmlbytes ));
            ByteArrayOutputStream xmlBaos = new ByteArrayOutputStream();
            Properties transProperties = transformer.getOutputProperties();
            transProperties.list( System.out); // prints out current transformer properties
            System.out.println("**** setting the transformer's encoding property to ISO-8859-1.");
            transformer.setOutputProperty("encoding", "ISO-8859-1");
            transformer.transform( streamSource, new StreamResult( xmlBaos));
            System.out.println("**** Test1 result = ");
            System.out.println(xmlBaos.toString("ISO-8859-1"));
            //Test2: Create a DOM document object for xmlStrBuf to add a new attribute ATT2="No"
            DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = dfactory.newDocumentBuilder();
            document = builder.parse( new ByteArrayInputStream( xmlbytes));
            // skip adding attribute since it does not affect the test result
            // Use a Transformer to output the DOM document.
            DOMSource source = new DOMSource(document);
            xmlBaos.reset();
            transformer.transform( source, new StreamResult( xmlBaos));
            System.out.println("\n\n****Test2 result = ");
            System.out.println(xmlBaos.toString("ISO-8859-1"));
            //xmlBaos.flush();
            //xmlBaos.close();
        catch (Exception e)
            System.out.println("<performTest> Exception caught. " + e.toString());
        finally
    public static void main( String arg[])
        XmlEncodingTest2 xmlTest = new XmlEncodingTest2();
        xmlTest.performTest();
}

Similar Messages

  • How to set the charset encoding dynamically in JSP

    Is there any way to set the charset encoding dynamically in a JSP
    page?
    we are using weblogic 6.1 on HP unix.
    is there some way we can set the charset dynamically in the page directive
    <%@ page contentType="text/html;charset=Shift_JIS" %>
    and in MAET tag
    <meta http-equiv="Content-Type" content="text/html" charset="Shift_JIS">
    Saurabh Agarwal

    Dear Saurabh,
    I guess it is possible. Here is an example I have made some time ago :
    In my html page :
    <form name="form1" METHOD=POST Action=Lang ENCTYPE="application/x-www-form-urlencoded" >
    <p>
    <select name="code" size="1">
    <option value="big5">Chinese</option>
    <option value="ISO-2022-KR">Korean</option>
    <option value="x-euc-jp">Japanese</option>
    <option value="ISO-8859-1">Spanish</option>
    <option value="ISO-8859-5">Russian</option>
    <option value="ISO-8859-7">Greek</option>
    <option value="ISO-8859-6">Arabic</option>
    <option value="ISO-8859-9">French</option>
    <option value="ISO-8559-1">German</option>
    <option value="ISO-8859-4">Swedish</option>
    <option value="ISO-8859-8">Hebrew</option>
    <option value="ISO-8859-9">Turkish</option>
    </select>
    </p>
    <p>
    <textarea name="entree_text"></textarea>
    <input type="submit" name="Submit" value="Submit" >
    </p></form>
    and in my jsp :
    // Must set the content type first
    res.setContentType("text/html");
    code = req.getParameter("code");
    example = req.getParameter("entree_text");
    PrintWriter out = res.getWriter();
    // The Servlet send to the Browser the informations to format the language type
    out.println("<html><head><title>Hello World!</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset="+code+"\"></head>");
    // System recover the general Character encoding
    String reqchar = req.getCharacterEncoding();
    out.println("<body><h1>Hello MultiLingual World!</h1>");
    out.println("You have defined an ISO of : "+code);
    out.println("<BR>This is the code of the page that is displayed in this page<BR>");
    out.println("<BR>");
    out.println("<BR>");
    out.println("Character encoding of the page is : "+reqchar);
    out.println("<BR>This is the character code in the Servlet");
    out.println("<BR>");
    out.println("<BR>");
    out.println("<BR>");
    out.println("You have typed : "+example);
    out.println("<BR>");
    out.println("");
    out.println("</body></html>");
    I think starting from this example it is surely easy to modify dynamically the jsp.
    The other possibility would be to use the Weblogic Commerce and the LOCALIZE function, so that you'll have an automatic redirection to the right jsp-encoding depending on the customer's language.
    Feel free to reply on the forum for any related issue.
    Best regards
    Nohmenn BABAI
    BEA EMEA Technical Support Engineer
    "Saurabh" <[email protected]> a écrit dans le message de news: [email protected]...
    Is there any way to set the charset encoding dynamically in a JSP
    page?
    we are using weblogic 6.1 on HP unix.
    is there some way we can set the charset dynamically in the page directive
    <%@ page contentType="text/html;charset=Shift_JIS" %>
    and in MAET tag
    <meta http-equiv="Content-Type" content="text/html" charset="Shift_JIS">
    Saurabh Agarwal[att1.html]

  • How to set the XML tree to be collapsed by default at run time?

    I am developing a simple software in Java, to improve my programming skills, the output of this program is an XML file. I am very new to XML. My question is that, every time the XML file is opened the tree is in expanded form, which appears to be the default setting at run time. I want it to be fully collapsed when the XML file is opened. I have read about certain solutions to this problem by using XSL or CSS. I am not familiar with XSL at the moment so I have not explored it yet. Is there any other way around this problem.
    I would like someone to just point me in the right direction so that I can eventually get to the answer.
    Any help will be highly appreciated.
    Thankyou

    Bscript wrote:
    My question is that, every time the XML file is opened the tree is in expanded form, which appears to be the default setting at run time. I want it to be fully collapsed when the XML file is opened. If you are asking to control the XML display in text editor when the XML is opened, I think you can't control it through the java. How the individual editor shows the XML is their property. For example, if you open the file in notepad, you may not get the pretty XML however if you open if the file in XML editor like XMLSpy, you may get its hierarchical representation.

  • How to set the file.encoding in jvm?

    I have some error in showing Chinese by used servlet,
    some one tole me that I can change the file.encoding in jvm to zh_CN, how can I do that?

    Add the java argument in your servlet engine.
    e.g
    java -Dfile.encoding=ISO8859-1
    garycafe

  • How to define the right encoding ???

    Hello!
    How do I define the encoding for a custom document over generic exchange?
    I get a valid file over FTP into the out-queue (ISO-8859-1). I take it and send it to a vendor. Snooping the HTTP stream, I get utf-8 characters, which I send to my vendor - besides in the header encoding = iso-8859-1 and in the out-queue it was ISO-8859-1.
    Where is internally the encoding changed? Where/ How can I affect this?
    Thanks for help.
    Claudia

    B2B typically works with UTF-8 encoding. The moment message is retrieved from the queue it is converted to UTF-8. If you have any special requirement, please send me an e-mail.
    [email protected]
    We will help you.

  • How to set the encoding of an XML-document

    I need to change the encoding of an xml-document.
    When I convert the document into a string, UTF-8
    is used, I want to use ISO-8859-1.

    use this in your identity transform:
    transformer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");

  • Changing the xml encoding from UTF-8 to ISO-8859-1

    Hi,
    I have created an xml file in xMII transaction that I feed into a webservice as input. As of now, the data in the xml file is entirely english text (it would be changing to have European text soon).  I gave the encoding as UTF-8.
    I get an error on the webservice side(not xMII code) that the its not able to parse. The error is 'SaxParseException: Invalid 1 of 1-byte UTF-8 sequence). I know that an easy fix is if tI change the encoding to iso-8859-1.
    But the reference document doesnot let me put anythign other than UTF-8. Even if I put <?xml version="1.0" encoding="iso-8859-1"?> as the first line, when I save it and open it back, i see <?xml version="1.0" encoding="UTF-8"?>
    Is there any way to change the encoding? Or better still, anyway idea why this invalid sequence is coming from?
    Thanks,
    Ravi.

    Hi Ravi,
    We have encountered scenarios where we needed to take the <?xml version="1.0" encoding="UTF-8"?> out completely.  As xMII was providing the Web Service, it needed a workaround.
    In your case, it seems that you wish to pass it from xMII to an external Web Service provider.  One option might be to pass the XML document as string.
    Once you convert it to a string, it may escape all XMl characters (i.e. '<' into '&lt;').  You could perform a string manipulation and remove the <?xml version="1.0" encoding="UTF-8"?> from the string.  You may also need to play around with xmlDecode( string ) function in the Link Editor.
    I would suggest that before you try this option, create a string variable will the contents, but without the <?xml version="1.0" encoding="UTF-8"?> and try assigning it to the input.
    You may also wish to try a string variable that has <?xml version="1.0" encoding="iso-8859-1"?> as the first line.  If this works, you should be able to perform string manipulations to convert your XML document into this modified string.
    Cheers,
    Jai.

  • Encoding XML in ISO-8859-1 from a unicode system

    Hello
    I want to generate an XML with an encoding ISO-8859-1. I'm on a unicode platform.
    I've done the following program :
    It works well with the line 'encoding UTF-16.
    With the line encoding 'encoding ISO ...', I have special  characters in the sting xml_string.
    NB : The program works correctly on a non-unicode platform.
    Can you help me ?
    Thank you
    REPORT .
    DATA : xml_string TYPE string.
    DATA : BEGIN OF l_id,
             numero(10),
             systeme   TYPE gsval,
             date      TYPE d,
             heure     TYPE uzeit,
             type(7),
             nb_nid TYPE i,
           END OF l_id.
    DATA: ixml            TYPE REF TO if_ixml,
          streamfactory   TYPE REF TO if_ixml_stream_factory,
          encoding        TYPE REF TO if_ixml_encoding,
          ixml_ostream    TYPE REF TO if_ixml_ostream.
    START-OF-SELECTION.
      l_id-date    = sy-datum.
      l_id-heure   = sy-uzeit.
      l_id-type    = 'BATCH'.
      ixml = cl_ixml=>create( ).
      streamfactory = ixml->create_stream_factory( ).
      ixml_ostream = streamfactory->create_ostream_cstring( xml_string ).
      encoding = ixml->create_encoding( character_set = 'ISO-8859-1' byte_order = 0 ).
    encoding = ixml->create_encoding( character_set = 'UTF-16' byte_order = 0 ).
      ixml_ostream->set_encoding( encoding = encoding ).
      CALL TRANSFORMATION ztest_xml
            SOURCE id   = l_id
            RESULT XML ixml_ostream.
      BREAK-POINT.

    Forum rules say: no mail (we must share the solution)
    I didn't understand what was exactly his issue, and what he exactly meant by "then to convert with the good encoding".
    His first sentence means that he used the following program (using Xstring instead of string):
    REPORT .
    DATA : xml_xstring TYPE xstring.
    DATA : BEGIN OF l_id,
    numero(10),
    systeme TYPE gsval,
    date TYPE d,
    heure TYPE uzeit,
    type(7),
    nb_nid TYPE i,
    END OF l_id.
    DATA: ixml TYPE REF TO if_ixml,
    streamfactory TYPE REF TO if_ixml_stream_factory,
    encoding TYPE REF TO if_ixml_encoding,
    ixml_ostream TYPE REF TO if_ixml_ostream.
    START-OF-SELECTION.
    l_id-date = sy-datum.
    l_id-heure = sy-uzeit.
    l_id-type = 'BATCH'.
    ixml = cl_ixml=>create( ).
    streamfactory = ixml->create_stream_factory( ).
    ixml_ostream = streamfactory->create_ostream_xstring( xml_xstring ).
    encoding = ixml->create_encoding( character_set = 'ISO-8859-1' byte_order = 0 ).
    ixml_ostream->set_encoding( encoding = encoding ).
    CALL TRANSFORMATION id
    SOURCE id = l_id
    RESULT XML ixml_ostream.
    * in debug here, you'll see that xml_xstring contains
    * XML result in ISO-8859-1 encoding
    BREAK-POINT.

  • SSIS 2008 R2 : XML issue with ?xml version="1.0" encoding="iso-8859-1"?

    hi Friends,
    Please help me in below error , I am using XML data source with below encoding
    <?xml version="1.0" encoding="iso-8859-1"?>
    While generating xsd, i am getting below error. 
    '.', hexadecimal value 0x00, is an invalid character. Line 2, position 1.
    the xml is parsing correctly as i am using XML spy to check the xml.
    Any help is appritiated.
    Thanks in advance,
    Pari

    I think XMLSpy does something to swallow the null char.
    I'd inspect this file in a professional editor to determine whether (likely) a hex 0x00 is in the file.
    Arthur
    MyBlog
    Twitter

  • How to set the root path of XML document when calling Inserting procedure

    Hi,
    I was create a procedure to insert XML Document in to DBMS Tables, but i am not able to set the Start root element in calling procedure.
    My calling procedure is
    exec insXmldoc('pmc_sample.xml', 'pmc')
    When i am calling this procedure i got this error
    11:23:54 Error: ORA-29532: Java call terminated by uncaught Java exception: oracle.xml.sql.OracleXMLSQLException: Start of root element expected.
    ORA-06512: at "SYS.DBMS_XMLSAVE", line 65
    ORA-06512: at "SCOTT.INSPROC", line 8
    ORA-06512: at line 2
    I am checking my XML file using XML Validator. My XML file was parsed with out errors.
    Please give the solution,and tell me where i did wrong in my calling procedure.
    suppose i have this XML file in local E drive ,how to set the path for that XML file in my calling procedure.

    Hi, I am doing the code likthis,please give the solution.
    SQL> create or replace procedure insProc(xmlDoc IN CLOB, tableName IN VARCHAR2) is
    2 insCtx DBMS_XMLSave.ctxType;
    3 l_ctx dbms_xmlsave.ctxtype;
    4 rows number;
    5 begin
    6 insCtx := DBMS_XMLSave.newContext(tableName); -- get the context handle
    7 rows := DBMS_XMLSave.insertXML(insCtx,xmlDoc); -- this inserts the document
    8 DBMS_XMLSave.closeContext(insCtx); -- this closes the handle
    9 end;
    10 /
    Procedure created.
    SQL> begin
    2 insProc('/usr/tmp/ROWSET.xml', 'emp');
    3 end;
    4 /
    begin
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception: oracle.xml.sql.OracleXMLSQLException:
    Start of root element expected.
    ORA-06512: at "SYS.DBMS_XMLSAVE", line 65
    ORA-06512: at "SCOTT.INSPROC", line 7
    ORA-06512: at line 2
    Kishore B

  • How to set the selectedIndex when dataProvider is an XML object in DropDownList?

    dataProvider was an XML object
    How to set the selectedIndex when dataProvider is an XML object in DropDownList?
    I do this:
    <s:DropDownList id="dropDownList" requireSelection="true" selectedIndex="2"
                    labelField="lastName" dataProvider="{employeeService.lastResult.employees.employee}"/>
    But always the first item is selected whatever the value of selectedIndex equals to.

    if i understand correctly, you want the selectedindex to be 2 when the DropDownList  displays.
    It might be the case that the dataprovider is being sought after it's already selected its index (as the dataprovider isn't already determined to begin with), so currently it's
         - setting the selected index to default
         - setting the selected index to 2 (your command)
         - getting the dataprovider
         - setting the selected index to default
    try writing a function to set the DropDownList's selected index after it's received the information, or even just attach it to the employeeService result handler.
    for quick testing sake you could just add
    <s:DropDownList id="dropDownList" requireSelection="true" updateComplete="dropDownList.selectedIndex = 2"
                    labelField="lastName" dataProvider="{employeeService.lastResult.employees.employee}"/>
    to see if my theory is correct.

  • How to set the working directory for reports in linux

    Hi All,
    Can you anyone help me to set the working directory for oracle application server 10g reports? I am using RHEL4 and AS10g. Actually i want to run my reports from my define
    working directory. How can I do this?
    Thanks in advance
    Arif

    Hi,
    your rep_srv.conf should look like something like
    +<?xml version = '1.0' encoding = 'ISO-8859-1'?>+
    +<!DOCTYPE server PUBLIC "-//Oracle Corp.//DTD Reports Server Configuration //EN" "file:D:\oracle\FRHome_1/reports/dtd/rwserverconf.dtd">+
    +<server version="10.1.2.0.2">+
    +<!--Please do not change the id for reports engine.-->+
    +<!--The class specifies below is subclass of _EngineClassImplBase and implements EngineInterface.-->+
    +<cache class="oracle.reports.cache.RWCache">+
    +<property name="cacheSize" value="50"/>+
    +<!--property name="cacheDir" value="your cache directory"-->+
    +<!--property name="maxCacheFileNumber" value="max number of cache files"-->+
    +<!--property name="ignoreParameters" value="parameter names to be ignored in constructing cache key, separated by comma ','"-->+
    +</cache>+
    +<engine id="rwEng" class="oracle.reports.engine.EngineImpl" initEngine="1" maxEngine="3" minEngine="0" engLife="50" maxIdle="30" callbackTimeOut="90000" jvmOptions="-Xmx512M -Xss512K">+
    +<!--property name="sourceDir" value="your reports source directory"/-->+
    +<!--property name="tempDir" value="your reports temp directory"/-->+
    +<!--property name="keepConnection" value="yes"/-->+
    +</engine>+
    +...+
    some more definitions
    +..+
    +<!--pluginParam name="proxy" type="file">proxyinfo.xml</pluginParam-->+
    +<pluginParam name="xmlpds" type="file">xmlpds.conf</pluginParam>+
    +<pluginParam name="jdbcpds" type="file">jdbcpds.conf</pluginParam>+
    +<pluginParam name="textpds" type="file">textpds.conf</pluginParam>+
    *<environment id="APP1">*
    *+<envVariable name="REPORTS_PATH" value="/application1/reports"/>+*
    *+</environment>+*
    *+<environment id="APP2">+*
    *+<envVariable name="REPORTS_PATH" value="/application2/reports"/>+*
    +</environment>+
    +</server>+
    The environment ids you can choose yourself and you have to put them in there yourself too (here I put two environments for two different applications "1" and "2").
    If you call a report from Forms, then you have to code something like
    ADD_PARAMETER(p_list,'ENVID',TEXT_PARAMETER,'APP1');
    Details depend on how you call your reports, my example is for using a parameter list and calling a report out of application1
    Hope that helps.
    Volker

  • How to set the servlet context path manually in Tomcat web server.

    I tested some servlets by putting them in the folder , which the tomcats examples application uses (ie Tomcat 4.1\webapps\examples\WEB-INF\classes\) and it appeared to be working fine.
    I was calling the servlet like this : http://localhost:2006/examples/servlet/TestServlet
    But when I installed my own WAR file in the server , the servlet is not working now. now the new location of my servlets is : Tomcat 4.1\webapps\MyApp\WEB-INF\classes\
    and I'm trying to call the servlet like this : http://localhost:2006/MyApp/servlet/TestServlet
    The error , what i'm getting is :
    description :The requested resource (/MyApp/servlet/TestServlet) is not available.
    Some body please tell where I'm making the mistake ? I believe this may have something to do with the servlet context path setting. If anybody has any idea , how to set the path..will be much appreciated.

    Thanx for your reply , at first I was not using any web.xml(since not mandatory) but even after using the web.xml file the error is coming . Please have a look into the contents of the web.xml file and let me know if you find any problem...
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <servlet>
    <servlet-name>TestServlet</servlet-name>
    <servlet-class>TestServlet</servlet-class>
    </servlet>
    </web-app>
    one more thing I would like to tell you here. I was just looking into the configuration of Iplanet web server..I found that , there are options to set the servlet container path (like : - Prefix: /servlet
    Servlet Directory: /ecomm/iplanet/nes60/product/docs/container )
    so from here I came to know that "container " is the folder where we should put our servlets and it has URI as "servlet" but yet I'm not able to find any option in the Tomcat Web server to set the servlet container to any different directory.
    If you have any idea please let me know.

  • How to set the REPORTS_DEFAULT_DISPLAY

    how to set the REPORTS_DEFAULT_DISPLAY

    However, as I believe is expected, OS X (and Windows for that matter) will create files by default with character encoding of Cp1252 (Latin-1). That is, the FILE encoding in the file metadata - the Byte Order Mark I believe. The file itself, not the characters written to it.
    Apps like TextEdit and Mail have settings that let you determine the encoding of text produced. The default would normally depend on the character content of the file, ranging from ASCII for basic English to Windows Latin-1 (Win 1252) or ISO Latin -1 (ISO 8859-1) to UTF-8 for other content.
    Win 1252 is not ASCII, but has twice the number of characters in the latter.
    Byte Order Mark is something totally different --it's a particular character used to signal certain encodings.
    http://en.wikipedia.org/wiki/Byteordermark
    As a simple example, just `touch somefile` from terminal creates a file in Cp1252 -- I'm obtaining that info by opening in jEdit by the way (anyone know of something better?).
    For what Terminal does and how to change it, it might best to post in the Unix forum:
    http://discussions.apple.com/forum.jspa?forumID=735
    For problems with a FireFox plugin, it might be good to ask on their own forums as well.

  • How to set the table input in Query template?

    Hi all.
    I need to call a Bapi_objcl_change, with import parameter and a table as an input. I have done this, in BLS. I have set the table input in the
    form of xml. In BLS, I get the output(the value gets change in SAP R3, what i have given in BLS).  But if i set the same xml structure  in
    query template, I didn't get the output. Table input parameter does not take that xml source.  How to set the table input in Query template?
    can anyone help me?
    Regards,
    Hemalatha

    Hema,
    You probably need to XML encode the data so that it will pass properly and then xmldecode() it to set the BAPI input value.
    Sam

Maybe you are looking for