DOC.getMimeType() is null

Hello Gurus,
Getting DOC.getMimeType() as null when using ORADOC after Import , Unable to find the document type.
Importing is done through a URL using ordsys.orddoc.import(), the filename is an ID, we call the document using that ID, will not know the filetype until Opened.
Any Suggestions.
Thank you

Sorry Its ORDDOC not ORADOC

Similar Messages

  • OrdDoc.getMimeType() null

    The following doc is loaded successfully and later added to the database successfully, but for some reason the mime type is always null. Any ideas?
    OrdDoc doc = (OrdDoc) rset.getORAData(1, OrdDoc.getORADataFactory());
    doc.loadDataFromFile(path + mf.getRef());
    System.out.println(doc.getMimeType()); // null

    Hi Mavris
    Thanks for the reply.
    In my example the reason i did not invoke setProperties() method is because the setProperties method exposed in OrdDoc class is not same as the setProperties method in OrdAudio or OrdImage.
    In OrdDoc class setProperties(byte[][] ctx,boolean setComments) takes two arguments where as setProperties() in OrdAudio and OrdImage does not take any arguments.
    byte[ ] ctx[ ] = new byte [4000][1];
    When i tried to use setProperties(ctx,true) in OrdDoc i was getting an error.
    Can you please tell if this is the correct way to invoke setProperties on OrdDoc in Java Program?
    Regarding the list of format that Intermedia Understands, the Appendices A, B and C in Intermedia Refererence talks only about Audio, Image and Video. It doesnt have any details about Document (pdf, txt, doc) files. Can you please tell where can i look for the list of formats that intermedia understands for OrdDoc?
    Since the dataType is OrdDoc in my table. How do i check the LOB length?
    I tried it using Intermedia Java API by calling getContentLength method after retreiving the OrdDoc column from resultset but it has a value of '0'. So am not sure why the document is not getting loaded.
    Please help me resolve this issue.
    Thanks

  • Getting null in document object Help me

    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                   DocumentBuilder builder = factory.newDocumentBuilder();
                   InputSource inputSource = new InputSource();
                   inputSource.setCharacterStream(new StringReader("<?xml version=\"1.0\"?><address></address>"));
                   System.out.println(inputSource);
                   Document doc = builder.parse(inputSource);
    Getting doc object as null. CAn anyone please find out what could be the error in my code?

    This works:
         * Get DOM document from a string containing XML.
         * @param inputStream InputStream to read XML content from.
         * @return DOM document or null if failed.
         * @throws Exception if failed.
        static public Document toDocument(InputStream inputStream) throws Exception {
            Document result = null;
            if (inputStream != null) {
                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    //            factory.setValidating(true);  //needs error handler
                factory.setNamespaceAware(true);
                DocumentBuilder db = factory.newDocumentBuilder();
                result = db.parse(new InputSource(inputStream));
            }//else: input unavailable
            return result;
        }//toDocument()

  • Error with - addStylesToDocument(doc); please help

    Hello, this is my unfinished code for a simple program I am writing. Basically I have a menu and buttons, and am looking to add a JTextPane. I think I have all the code there, except when compiling I am having an error with line addStylesToDocument(doc); if I comment this out then nothing happens but the program runs as normal (before I added the JTextPane code) the error I am getting is "non-static method addStylesToDocument(javax.swing.text.StyledDocument) cannot be referenced from a static context" this makes a little sence to me but not enough to be able to correct it as I am pretty much a beginner...
    If anyone has any suggestions to fix this I would appreciate your input.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.event.*;
    import javax.swing.*;
    import javax.swing.text.*;
    public class ShoppingCart extends JPanel
                            implements ActionListener {
        protected JButton bapple, borange, bbanana, bstrawberry, blemon, bgrape, b7, b8, b9, b10;
        public JMenuBar createMenuBar() {
         JMenuBar menuBar;
         JMenu menu, submenu;
         JMenuItem menuItem;
         JRadioButtonMenuItem rbMenuItem;
         JCheckBoxMenuItem cbMenuItem;
    menuBar = new JMenuBar();
    menuBar.setBackground(Color.white);
          menu = new JMenu("A Menu");
          menu.setBackground(Color.white);
            menu.setMnemonic(KeyEvent.VK_A);
            menu.getAccessibleContext().setAccessibleDescription(
                    "The only menu in this program that has menu items");
            menuBar.add(menu);
          //a group of JMenuItems
          menuItem = new JMenuItem("A text-only menu item",
                                     KeyEvent.VK_T);
            //menuItem.setMnemonic(KeyEvent.VK_T); //used constructor instead
             menuItem.setBackground(Color.white);
             menuItem.setAccelerator(KeyStroke.getKeyStroke(
                KeyEvent.VK_1, ActionEvent.ALT_MASK));
           menuItem.getAccessibleContext().setAccessibleDescription(
           "This doesn't really do anything");
            menu.add(menuItem);
            ImageIcon icon = createImageIcon("/orange.gif");
            menuItem = new JMenuItem ("Both text and icon", icon);
            menuItem.setMnemonic(KeyEvent.VK_B);
            menuItem.setBackground(Color.white);
          menu.add(menuItem);
          menuItem = new JMenuItem(icon);
          menuItem.setMnemonic(KeyEvent.VK_D);
          menuItem.setBackground(Color.white);
          menu.add(menuItem);
          //a group of radio button menu items
          menu.addSeparator();
          ButtonGroup group = new ButtonGroup();
          rbMenuItem = new JRadioButtonMenuItem("A radio button menu item");
          rbMenuItem.setSelected(true);
          rbMenuItem.setMnemonic(KeyEvent.VK_R);
          rbMenuItem.setBackground(Color.white);
          group.add(rbMenuItem);
          menu.add(rbMenuItem);
          //a group if check box menu items
          menu.addSeparator();
          cbMenuItem = new JCheckBoxMenuItem("A check box menu item");
          cbMenuItem.setMnemonic(KeyEvent.VK_C);
          cbMenuItem.setBackground(Color.white);
          menu.add(cbMenuItem);
          cbMenuItem = new JCheckBoxMenuItem("Another one");
          cbMenuItem.setMnemonic(KeyEvent.VK_H);
          cbMenuItem.setBackground(Color.white);
          menu.add(cbMenuItem);
          //a submenu
          menu.addSeparator();
          submenu = new JMenu("A submenu");
          submenu.setBackground(Color.white);
          submenu.setMnemonic(KeyEvent.VK_S);
          menuItem = new JMenuItem("An  item in the submenu");
          menuItem.setAccelerator(KeyStroke.getKeyStroke(
          KeyEvent.VK_2, ActionEvent.ALT_MASK));
          menuItem.setBackground(Color.white);
          submenu.add(menuItem);
          menuItem = new JMenuItem("Another item");
          menuItem.setBackground(Color.white);
          submenu.add(menuItem);
          menu.add(submenu);
          //Build second menu in the menu bar
          menu = new JMenu("Another Menu");
          menu.setBackground(Color.white);
          menu.setMnemonic(KeyEvent.VK_N);
          menu.getAccessibleContext().setAccessibleDescription(
          "This menu does nothing");
          menuBar.add(menu); 
    return menuBar;
        public ShoppingCart() {
            ImageIcon appleButtonIcon = createImageIcon("/apple.gif");
            ImageIcon orangeButtonIcon = createImageIcon("/orange.gif");
            ImageIcon bananaButtonIcon = createImageIcon("/banana.gif");
            ImageIcon strawberryButtonIcon = createImageIcon("/strawberry.gif");
            ImageIcon lemonButtonIcon = createImageIcon("/lemon.gif");
            ImageIcon grapeButtonIcon = createImageIcon("/grape.gif");
            bapple = new JButton(null,  appleButtonIcon);
            bapple.setVerticalTextPosition(AbstractButton.CENTER);
            bapple.setBackground(Color.white);
            bapple.setHorizontalTextPosition(AbstractButton.LEADING);
            bapple.setMnemonic(KeyEvent.VK_D);
            bapple.setActionCommand("apple");
            borange = new JButton(null, orangeButtonIcon);
            borange.setVerticalTextPosition(AbstractButton.BOTTOM);
            borange.setBackground(Color.white);
            borange.setHorizontalTextPosition(AbstractButton.CENTER);
            borange.setMnemonic(KeyEvent.VK_M);
            borange.setActionCommand("orange");
            bbanana = new JButton(null, bananaButtonIcon);
            bbanana.setBackground(Color.white);
            bbanana.setMnemonic(KeyEvent.VK_E);
            bbanana.setActionCommand("banana");
            bstrawberry = new JButton(null,  strawberryButtonIcon);
            bstrawberry.setVerticalTextPosition(AbstractButton.CENTER);
            bstrawberry.setBackground(Color.white);
            bstrawberry.setHorizontalTextPosition(AbstractButton.LEADING); //aka LEFT, for left-to-right locales
            bstrawberry.setActionCommand("strawberry");
            blemon = new JButton(null,  lemonButtonIcon);
            blemon.setBackground(Color.white);
            blemon.setVerticalTextPosition(AbstractButton.CENTER);
            blemon.setHorizontalTextPosition(AbstractButton.LEADING); //aka LEFT, for left-to-right locales
            blemon.setActionCommand("lemon");
            bgrape = new JButton(null,  grapeButtonIcon);
            bgrape.setBackground(Color.white);
            bgrape.setVerticalTextPosition(AbstractButton.CENTER);
            bgrape.setHorizontalTextPosition(AbstractButton.LEADING); //aka LEFT, for left-to-right locales
            bgrape.setActionCommand("grape");
            /*b7 = new JButton(null,  leftButtonIcon);
            b7.setVerticalTextPosition(AbstractButton.CENTER);
            b7.setHorizontalTextPosition(AbstractButton.LEADING); //aka LEFT, for left-to-right locales
            b8 = new JButton(null,  leftButtonIcon);
            b8.setVerticalTextPosition(AbstractButton.CENTER);
            b8.setHorizontalTextPosition(AbstractButton.LEADING); //aka LEFT, for left-to-right locales
            b9 = new JButton(null,  leftButtonIcon);
            b9.setVerticalTextPosition(AbstractButton.CENTER);
            b9.setHorizontalTextPosition(AbstractButton.LEADING); //aka LEFT, for left-to-right locales
            b10 = new JButton(null,  leftButtonIcon);
            b10.setVerticalTextPosition(AbstractButton.CENTER);
            b10.setHorizontalTextPosition(AbstractButton.LEADING); //aka LEFT, for left-to-right locales
            //Listen for actions on buttons
            bapple.addActionListener(this);
            borange.addActionListener(this);
            bbanana.addActionListener(this);
            bstrawberry.addActionListener(this);
            blemon.addActionListener(this);
            bgrape.addActionListener(this);
            bapple.setToolTipText("Apple.");
            borange.setToolTipText("Orange.");
            bbanana.setToolTipText("Banana.");
            bstrawberry.setToolTipText("Strawberry.");
            blemon.setToolTipText("Lemon.");
            bgrape.setToolTipText("Grape.");
           /* b7.setToolTipText("7");
            b8.setToolTipText("8");
            b9.setToolTipText("9");
            b10.setToolTipText("10");
            //Add Components to this container, using the default FlowLayout.
            add(bapple);
            add(borange);
            add(bbanana);
            add(bstrawberry);
            add(blemon);
            add(bgrape);
           /* add(b7);
            add(b8);
            add(b9);
            add(b10);*/
        public void actionPerformed(ActionEvent e) {
            if ("apple".equals(e.getActionCommand())) {
           String  input1 =  JOptionPane.showInputDialog( "How many apples would you like to purchase?" );
            int  number1 = Integer.parseInt( input1 );
             if ("orange".equals(e.getActionCommand())) {
           String  input2 =  JOptionPane.showInputDialog( "How many oranges would you like to purchase?" );
           int  number2 = Integer.parseInt( input2 );
               if ("banana".equals(e.getActionCommand())) {
           String  input3 =  JOptionPane.showInputDialog( "How many bananas would you like to purchase?" );
           int  number3 = Integer.parseInt( input3 );
             if ("strawberry".equals(e.getActionCommand())) {
           String  input4 =  JOptionPane.showInputDialog( "Enter weight of strawberries : " );
           int  number4 = Integer.parseInt( input4 );
             if ("lemon".equals(e.getActionCommand())) {
           String  input5 =  JOptionPane.showInputDialog( "How many lemons would you like to purchase?" );
           int  number5 = Integer.parseInt( input5 );
             if ("grape".equals(e.getActionCommand())) {
           String  input6 =  JOptionPane.showInputDialog( "Enter weight of grapes : " );
           int  number6 = Integer.parseInt( input6 );
        /** Returns an ImageIcon, or null if the path was invalid. */
        protected static ImageIcon createImageIcon(String path) {
            java.net.URL imgURL = ShoppingCart.class.getResource(path);
            if (imgURL != null) {
                return new ImageIcon(imgURL);
            } else {
                System.err.println("Couldn't find file: " + path);
                return null;
         * Create the GUI and show it.  For thread safety,
         * this method should be invoked from the
         * event-dispatching thread.
        private static void createAndShowGUI() {
    //Create and set up the window.
            JFrame frame = new JFrame("Shopping Cart");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Create and set up the content pane.
            ShoppingCart newContentPane = new ShoppingCart();
            newContentPane.setOpaque(true); //content panes must be opaque
            frame.setContentPane(newContentPane);
            newContentPane.setBackground(Color.white);
           frame.setJMenuBar(newContentPane.createMenuBar());
            //Display the window.
            frame.pack();
            frame.setVisible(true);
            String[] initString =
            { /* ...  fill array with initial text  ... */ };
            String[] initStyles =
            { /* ...  fill array with names of styles  ... */ };
            JTextPane textPane = new JTextPane();
            StyledDocument doc = textPane.getStyledDocument();
            addStylesToDocument(doc);
            //Load the text pane with styled text.
            try {
            for (int i=0; i < initString.length; i++) {
            doc.insertString(doc.getLength(), initString,
    doc.getStyle(initStyles[i]));
    } catch (BadLocationException ble) {
    System.err.println("Couldn't insert initial text into text pane.");
    }protected void addStylesToDocument (StyledDocument doc) {
    Style def=new StyleContext ().getStyle (StyleContext.DEFAULT_STYLE);
    Style heading = doc.addStyle ("bold", null);
    StyleConstants.setFontFamily (heading, "SansSerif");
    StyleConstants.setBold (heading, true);
    StyleConstants.setFontSize (heading,30);
    // * The next 3 don't work if that line is commented out
    StyleConstants.setAlignment (heading, StyleConstants.ALIGN_CENTER);
    StyleConstants.setSpaceAbove (heading, 10);
    StyleConstants.setSpaceBelow (heading, 10);
    public static void main() {
    //Schedule a job for the event-dispatching thread:
    //creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();

    CPie wrote:
    o..k.
    I see that you have run out of helpfulness for this session, What the ....? I just told you to add your jtextfield to a jpanel or some other visible component to be seen.
    it is getting late here I will take my business elsewhere tomorrow rather than waiting up for a response which shows you realllly need to find something better to do! And thanks for the help earlier. That was actually useful whereas this wasn't, I'm sure you knew that already,You know that we are all volunteers here. Any time spent here helping you is time away from our friends and families. A little more appreciation is definitely in order or go somewhere else and pay for your help.

  • Help. HTMLDocument.getElement(id) doesn't work, return me null.

    i think the method getElement(String id) would get me the whole tag with the specific id, but it returns me null value. The following is my html and a test program. What's wrong with it? Please Help. Thank you very much.
    here is my boo.html file
    <html>
    <body>
    <p id=abc> hello </p>
    </body>
    </html>
    here is my little test program
    import javax.swing.JEditorPane;
    import javax.swing.text.Element;
    import javax.swing.text.html.HTMLDocument;
    import javax.swing.text.html.HTMLEditorKit;
    import javax.swing.text.html.StyleSheet;
    public class Boo{
    private JEditorPane editorpane = new JEditorPane();
    private HTMLDocument doc;
    public Boo(){
         try{
    editorpane.setPage(getClass().getResource("boo.html"));
    } catch (Exception e) {e.printStackTrace();}
         doc = (HTMLDocument) editorpane.getDocument();
         System.out.println(doc);
         Element el = doc.getElement("abc");
         System.out.println(el);
    public static void main(String[] args) {
    Boo bo = new Boo();
    System.exit(0);
    here is the result:
    ey@troy:/work/ey> java -version
    java version "1.5.0"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
    Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)
    ey@troy:/work/ey> java Boo
    javax.swing.text.html.HTMLDocument@b753f8
    null

    thanks hiwa, i saw you replied my thread from javaworld as well.
    and i tried your code, which utilises a JFrame to make my program a GUI program. but it turns out still not working, still return me null value.
    and i tried the following code, which will definitely return me the right thing:
    try{
              editorpane.setPage("file:///work/ams/bightml.html");
                 doc = (HTMLDocument) editorpane.getDocument();
          } catch (Exception e) {e.printStackTrace();}
         System.out.println(doc);
         Element el = null;
         el = doc.getElement("D");
            int i=0;
         while (el == null){
              try{
                   Thread.sleep(i*500);
                   el = doc.getElement("D");
                   } catch (Exception e) {e.printStackTrace();}
                    i++;       
         System.out.println(el);From the code, the "bightml.html" is an html file which has a table with 1000 lines. and i tagged some of the <td> with IDs. i found out it will take more time for the program to locate the tag towards the end of the html.
    And i also find out: in the following codes, if you make the thread sleep some time after the first line, the result of the second line will give you more:
          doc = (HTMLDocument) editorpane.getDocument();
          System.out.println(doc.getText(0, doc.getLength()));and this also make me think, the " doc = (HTMLDocument) editorpane.getDocument();" is not thread save as well.
    anyone knows something about this?
    oh, did i mention my machine? it's a P4 2.4G running under Suse 9.1 with java 1.5.0_01.
    Thanks.

  • Processing 1.0 How to define CUSTOM paper size?

    Hi all,
    I'm working in processing and I'm looking for a way to define my own paper size.
    This is the most "cleanest" version of the script.
    In fact this part is as good as the exact script from seltar
    So the main focus right now would be the line between the
    four backslash lines.
    // Printer - Jpg and Text (more can easily be implemented)
    // PrintService http://java.sun.com/j2se/1.4.2/docs/api/javax/print/PrintService.html
    // DocFlavor http://java.sun.com/j2se/1.4.2/docs/api/javax/print/DocFlavor.html
    // PrintRequestAttributeSet http://java.sun.com/j2se/1.4.2/docs/api/javax/print/attribute/PrintRequestAttributeSet.html
    // Attribute http://java.sun.com/j2se/1.4.2/docs/api/javax/print/attribute/Attribute.html
    // Yonas Sandbæk - http://seltar.wliia.org
    import javax.print.*;
    import javax.print.attribute.*;
    import javax.print.attribute.standard.MediaSizeName;
    import javax.print.attribute.standard.MediaSize;
    import javax.print.DocFlavor;
    import javax.print.PrintService;
    import javax.print.PrintServiceLookup;
    import javax.print.ServiceUI;
    import javax.print.attribute.HashPrintRequestAttributeSet;
    import javax.print.attribute.PrintRequestAttributeSet;
    import javax.print.attribute.standard.MediaPrintableArea;
    import javax.print.attribute.standard.MediaSize;
    import javax.print.attribute.standard.*;
    import com.sun.image.codec.jpeg.*;
    PrintIt p = new PrintIt();
    void draw(){
    // blabla drawing
    if(keyPressed && key == 'p') p.printJpg(get(0,0,width,height));
    class PrintIt{
      PrintService[] services;
      PrintService service;
      DocFlavor docflavor;
      Doc myDoc;
      PrintRequestAttributeSet aset;
      DocPrintJob job;
      PrintIt(){
        myDoc = null;
        job = null;
        services = null;
        setService(PrintServiceLookup.lookupDefaultPrintService());
        setDocFlavor(DocFlavor.BYTE_ARRAY.AUTOSENSE);
        aset =  new HashPrintRequestAttributeSet();
        //aset.add(MediaSize.findMedia(0.5, 0.5, MediaSize.INCH));
        aset.add(MediaSize(10, 10, Size2DSyntax.MM));
      void setService(PrintService p)
        service = p;
      void setDocFlavor(DocFlavor d)
        docflavor = d; 
      void listPrinters(){
        services = PrintServiceLookup.lookupPrintServices(null, null);
        for (int i = 0; i < services.length; i++) {
         System.out.println(services.getName());
         DocFlavor[] d = services[i].getSupportedDocFlavors();
         for(int j = 0; j < d.length; j++)
         System.out.println(" "+d[j].getMimeType());
    services = null;
    // prints a given image
    void printJpg(PImage img){
    setDocFlavor(DocFlavor.BYTE_ARRAY.JPEG);
    print(bufferImage(img));
    // prints a given string
    void printString(String s){
    setDocFlavor(DocFlavor.BYTE_ARRAY.AUTOSENSE);
    print(s.getBytes());
    boolean print(byte[] b){
    if(!service.isDocFlavorSupported(docflavor)){
    println("MimeType: \""+docflavor.getMimeType()+"\" not supported by the currently selected printer");
    return false;
    boolean ret = true;
    try{
         myDoc = new SimpleDoc(b, docflavor, null);
    catch(Exception e){
         println(e);
         ret = false;
    job = service.createPrintJob();
    try {
         job.print(myDoc, aset);
    catch (PrintException pe) {
         println(pe);
         ret = false;
    return ret;
    // used with printJpg()
    byte[] bufferImage(PImage srcimg){
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    BufferedImage img = new BufferedImage(srcimg.width, srcimg.height, 2);
    img = (BufferedImage)createImage(srcimg.width, srcimg.height);
    for(int i = 0; i < srcimg.width; i++)
         for(int j = 0; j < srcimg.height; j++)
         int id = j*srcimg.width+i;
         img.setRGB(i,j, srcimg.pixels[id]);
    try{
         JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
         JPEGEncodeParam encpar = encoder.getDefaultJPEGEncodeParam(img);
         encpar.setQuality(1,false);
         encoder.setJPEGEncodeParam(encpar);
         encoder.encode(img);
    catch(FileNotFoundException e){
         System.out.println(e);
    catch(IOException ioe){
         System.out.println(ioe);
    return out.toByteArray();

    Hi all,
    I'm working in processing and I'm looking for a way to define my own paper size.
    This is the most "cleanest" version of the script.
    In fact this part is as good as the exact script from seltar
    So the main focus right now would be the line between the
    four backslash lines.
    // Printer - Jpg and Text (more can easily be implemented)
    // PrintService http://java.sun.com/j2se/1.4.2/docs/api/javax/print/PrintService.html
    // DocFlavor http://java.sun.com/j2se/1.4.2/docs/api/javax/print/DocFlavor.html
    // PrintRequestAttributeSet http://java.sun.com/j2se/1.4.2/docs/api/javax/print/attribute/PrintRequestAttributeSet.html
    // Attribute http://java.sun.com/j2se/1.4.2/docs/api/javax/print/attribute/Attribute.html
    // Yonas Sandbæk - http://seltar.wliia.org
    import javax.print.*;
    import javax.print.attribute.*;
    import javax.print.attribute.standard.MediaSizeName;
    import javax.print.attribute.standard.MediaSize;
    import javax.print.DocFlavor;
    import javax.print.PrintService;
    import javax.print.PrintServiceLookup;
    import javax.print.ServiceUI;
    import javax.print.attribute.HashPrintRequestAttributeSet;
    import javax.print.attribute.PrintRequestAttributeSet;
    import javax.print.attribute.standard.MediaPrintableArea;
    import javax.print.attribute.standard.MediaSize;
    import javax.print.attribute.standard.*;
    import com.sun.image.codec.jpeg.*;
    PrintIt p = new PrintIt();
    void draw(){
    // blabla drawing
    if(keyPressed && key == 'p') p.printJpg(get(0,0,width,height));
    class PrintIt{
      PrintService[] services;
      PrintService service;
      DocFlavor docflavor;
      Doc myDoc;
      PrintRequestAttributeSet aset;
      DocPrintJob job;
      PrintIt(){
        myDoc = null;
        job = null;
        services = null;
        setService(PrintServiceLookup.lookupDefaultPrintService());
        setDocFlavor(DocFlavor.BYTE_ARRAY.AUTOSENSE);
        aset =  new HashPrintRequestAttributeSet();
        //aset.add(MediaSize.findMedia(0.5, 0.5, MediaSize.INCH));
        aset.add(MediaSize(10, 10, Size2DSyntax.MM));
      void setService(PrintService p)
        service = p;
      void setDocFlavor(DocFlavor d)
        docflavor = d; 
      void listPrinters(){
        services = PrintServiceLookup.lookupPrintServices(null, null);
        for (int i = 0; i < services.length; i++) {
         System.out.println(services.getName());
         DocFlavor[] d = services[i].getSupportedDocFlavors();
         for(int j = 0; j < d.length; j++)
         System.out.println(" "+d[j].getMimeType());
    services = null;
    // prints a given image
    void printJpg(PImage img){
    setDocFlavor(DocFlavor.BYTE_ARRAY.JPEG);
    print(bufferImage(img));
    // prints a given string
    void printString(String s){
    setDocFlavor(DocFlavor.BYTE_ARRAY.AUTOSENSE);
    print(s.getBytes());
    boolean print(byte[] b){
    if(!service.isDocFlavorSupported(docflavor)){
    println("MimeType: \""+docflavor.getMimeType()+"\" not supported by the currently selected printer");
    return false;
    boolean ret = true;
    try{
         myDoc = new SimpleDoc(b, docflavor, null);
    catch(Exception e){
         println(e);
         ret = false;
    job = service.createPrintJob();
    try {
         job.print(myDoc, aset);
    catch (PrintException pe) {
         println(pe);
         ret = false;
    return ret;
    // used with printJpg()
    byte[] bufferImage(PImage srcimg){
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    BufferedImage img = new BufferedImage(srcimg.width, srcimg.height, 2);
    img = (BufferedImage)createImage(srcimg.width, srcimg.height);
    for(int i = 0; i < srcimg.width; i++)
         for(int j = 0; j < srcimg.height; j++)
         int id = j*srcimg.width+i;
         img.setRGB(i,j, srcimg.pixels[id]);
    try{
         JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
         JPEGEncodeParam encpar = encoder.getDefaultJPEGEncodeParam(img);
         encpar.setQuality(1,false);
         encoder.setJPEGEncodeParam(encpar);
         encoder.encode(img);
    catch(FileNotFoundException e){
         System.out.println(e);
    catch(IOException ioe){
         System.out.println(ioe);
    return out.toByteArray();

  • Problem with InterMedia ClipBoard

    Hi
    i am trying to use the Code wizard to create the Get_object , put_object, insert_row procedures for inserting/updating BLOB data into oracle database
    However the code editior gives an error
    The code generated is as follows and the error is as follows
    I am not able to figure out why it should give an error at this location though.
    Please can some one help
    The code is as follows
    procedure INSERT_CONTENT_ROW
    in_ID in varchar2,
    in_AUTHOR in varchar2,
    in_CONTENT_NAME in varchar2,
    out_rowid out varchar2
    as
    begin
    insert into CONTENTS ( ID, AUTHOR, CONTENT_NAME, DOCS ) values ( in_ID, in_AUTHOR, in_CONTENT_NAME, .BLOB ( ) ) returning rowid into out_rowid;
    end;
    ----------The error generated in code Editior is as below----
    WM-00521: OCI returned OCI_SUCCESS_WITH_INFO; ORA-24344: message not available
    Line: 10, Column: 105: PLS-00103: Encountered the symbol "." when expecting one of the following:
    ( - + mod not null others <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count current exists max min prior sql stddev sum variance
    execute cast trim forall
    <a string literal with character set specification>
    <a number> <a single-quoted SQL string>
    The symbol "<an identifier>" was substituted for "." to continue.
    When I run the same code in SQL*Plus this is the error I get
    procedure INSERT_CONTENT_ROW
    ERROR at line 1:
    ORA-00900: invalid SQL statement
    Now i am new to Intermedia and the BLOB usage so could not figure out much
    I would also be gla if someone can refer me to some good reference material on the Intermedia standard procedures, functions and other developer related material.
    By the way, the config is as follows:
    oracle8.1.5/InterMedia Web agent/clipBoard, Win NT, Apache1.3.9
    Thank you
    -nandeep

    Hi
    When I try to generate procedures with code generator in Intermedia Clip Borad I get errors as listed against each of the procedure
    1. GET_CONTENT_DOC
    --to retrive documents from document column
    --which is a BLOB type column:
    --By the way the documents column name is DOCS in the database
    procedure GET_CONTENT_DOC
    ord_procedure_path in varchar2,
    http_if_modified_since in varchar2,
    http_status out varchar2,
    http_last_modified out varchar2,
    ord_content_type out varchar2,
    ord_content_length out number,
    ord_content_blob out blob
    as
    db_mod_date date;
    begin
    /* get the content, content type, last-modified date from the object. */
    select
    t.DOCS.GetContent(),
    t.DOCS.GetMimeType(),
    t.DOCS.GetUpdateTime()
    into
    ord_content_blob,
    ord_content_type,
    db_mod_date
    from CONTENTS t
    where
    t.ID = ord_procedure_path
    and rownum = 1;
    /* if we didn't know the content type, it's just bits */
    if ord_content_type is null
    then
    ord_content_type := '/x-unknown';
    end if;
    /* figure out the length */
    ord_content_length := dbms_lob.getlength( ord_content_blob );
    /* figure out the http status and last modified date */
    http_status := ordwebutl.cache_status(
    db_mod_date, http_if_modified_since, http_last_modified );
    end;
    ERROR is a s follows:
    WM-00521: OCI returned OCI_SUCCESS_WITH_INFO; ORA-24344: message not available
    Line: 17, Column: 9: PLS-00201: identifier 'T.DOCS' must be declared
    Line: 16, Column: 5: PL/SQL: SQL Statement ignored
    2. PUT_CONTENT_DOC
    -- to insert a document
    procedure PUT_CONTENT_DOC
    ord_procedure_path in varchar2,
    http_status out varchar2,
    ord_content_blob out blob
    as
    begin
    /* set the blob to empty before we return a handle to it */
    /* and set the content type from the one passed in */
    update CONTENTS t
    set t.DOCS = .BLOB ( )
    where
    t.ID = ord_procedure_path
    and rownum = 1;
    /* now select the blob we're going to update */
    select t.DOCS.GetContent()
    into ord_content_blob
    from CONTENTS t
    where
    t.ID = ord_procedure_path
    and rownum = 1
    for update;
    /* return http status OK */
    http_status := 200;
    end;
    ERROR is as follows:
    MWM-00521: OCI returned OCI_SUCCESS_WITH_INFO; ORA-24344: message not available
    Line: 13, Column: 18: PLS-00103: Encountered the symbol "." when expecting one of the following:
    ( - + mod null <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count current max min prior sql stddev sum variance execute
    cast trim forall
    <a string literal with character set specification>
    <a number> <a single-quoted SQL string>
    The symbol "<an identifier>" was substituted for "." to continue.
    The INSERT_DOCUMENT got created thru SQL*Plus. However I have NOT changed the .BLOB to EMPTY_BLOB() and I am still not sure whether it will work and whether I have to change it empty_blob()( iguess technically I should )
    thank u
    -nandeep
    null

  • Unknown problem with JSP, JavaScript - Pls help

    Hi Friends,
    I am facing a strange problem. Explained it below. Kindly help me as it is really affecting my work. Thanks in advance.
    I am working on building a web application using jsp, servlet, ejb. the IDE used is WSAD 5.1.2.
    I have the below :
    1 JSP - Input page - for user input entry
    2. Java script1 - For all client side validations
    Java script2 - For handling the data submission to servlet (as selected by user)
    Javascript3 - Header & Menu Bar
    3 Servlet - This actually retrieves the values from the hidden parameters, sets them in session and redirects the control back to the jsp.
    Logic for one small iteration : Two drop downs are there. On selecting the first drop down the second drop down should be populated and the first drop down should display the user selected value.
    1. When the user selects the first drop down onchange() event gets fired which calls a method in the javascript.
    2. In the javascript I set the value of a hidden form field to the selected combo index and submit the form to the servlet
    3. In the servlet, I retrieve the hidden request parameter (Index),
    set the index in session. Do my business logic based on the value of the index. Set the collection (to be displayed) in second drop down in session.
    4. Send the response back to the JSP.
    5. In the JSP, we have a method which is called during the onload() event of the body
    6. This method sets the user selected values in appropriate controls(by taking from session)
    Problem faced: I have a javascript which creates the menu bar for my application and this i've included it in my jsp. I dont know whats wrong with this javascript, when it is commented out the page works perfectly fine. Both the user selected value and the collection are loaded exactly as expected. But when it is included the collection is loaded in the second drop down but the selected index of the first drop down is not set - the drop down gets reset to the default value.
    Also on body load of my jsp, I call a javascript method which sets the current date in one text field of my form. Even this is not working fine when I include this javascript. I don't see any script error in this javascript in my browser though. Strange but guess something basic :(
    I'm sure there is nothing to do with session. I've tried printing the entire flow. The Servlet sets the values correctly in session and they are also correctly available in the JSP page. The JSP also gets loaded with the user selected values but something happens on page load which clears the values to default.
    Am also confused in what way javascript is related to this, coz when I remove it things are working fine.
    Am really helpless here pls do the needful. any help is appreciated.
    Header.js [which includes the menu bar code]
    document.write("<!-- COMMON HEADER CODE -->")
    document.write("     <table id='mplPageHeader' cellspacing='0' cellpadding='2' border='0'>")
    document.write("          <tr> ")
    document.write("               <td rowspan='2' bgcolor='#FFFFFF' width='1%'>")
    document.write("                    <a href='http://www.web.com' target='_top'>")
    document.write("                         <img src='./images/ford.gif' alt='BLogistics' border='0'>")
    document.write("                    </a>     ")
    document.write("               </td>")
    document.write("               <td rowspan='2' class='appTitle' title='Mp' width='1%'>MP&L</td>")
    document.write("               <td class='appTitle' title='M R'>M R</td>")
    document.write("               <td class='pageIdentifier'>"+' '+"</td>");
    document.write("          </tr>")
    document.write("          <tr>")
    document.write("               <td class='pageTitle' nowrap></td>");
    document.write("               <td class='dateInfo' nowrap>Thu Jan 22 2004 12:24 PM</td>")
    document.write("          </tr>")
    document.write("     </table>")
    document.write("<!-- Display Menu Items -->")
    document.write("<div id='navigationMenu'>")
    document.write("     <script type='text/javascript' src='./javascript/MRmenuItem.js'></script>")
    document.write("     <script type='text/javascript' src='./javascript/menuScript.js'></script>")
    document.write("</div>")-------------------------------------------------------
    Menu Bar Code
    var AgntUsr=navigator.userAgent.toLowerCase();
    var AppVer=navigator.appVersion.toLowerCase();
    var DomYes=document.getElementById?1:0,NavYes=AgntUsr.indexOf("mozilla")!=-1&&AgntUsr.indexOf("compatible")==-1?1:0,ExpYes=AgntUsr.indexOf("msie")!=-1?1:0,Opr=AgntUsr.indexOf("opera")!=-1?1:0;
    var DomNav=DomYes&&NavYes?1:0,DomExp=DomYes&&ExpYes?1:0;
    var Nav4=NavYes&&!DomYes&&document.layers?1:0,Exp4=ExpYes&&!DomYes&&document.all?1:0;
    var MacCom=(AppVer.indexOf("mac")!= -1)?1:0,MacExp4=(MacCom&&AppVer.indexOf("msie 4")!= -1)?1:0,Mac4=(MacCom&&(Nav4||Exp4))?1:0;
    var Exp5=AppVer.indexOf("msie 5")!= -1?1:0,Fltr=(AppVer.indexOf("msie 6")!= -1||AppVer.indexOf("msie 7")!= -1)?1:0,MacExp5=(MacCom&&Exp5)?1:0,PosStrt=(NavYes||ExpYes)&&!Opr?1:0;
    var RmbrNow=null,FLoc,ScLoc,DcLoc,SWinW,SWinH,FWinW,FWinH,SLdAgnWin,FColW,SColW,DColW,RLvl=0,FrstCreat=1,Ldd=0,Crtd=0,IniFlg,AcrssFrms=1,FrstCntnr=null,CurOvr=null,CloseTmr=null,CntrTxt,TxtClose,ImgStr,ShwFlg=0,M_StrtTp=StartTop,M_StrtLft=StartLeft,StaticPos=0,LftXtra=DomNav?LeftPaddng:0,TpXtra=DomNav?TopPaddng:0,FStr="",M_Hide=Nav4?"hide":"hidden",M_Show=Nav4?"show":"visible",Par=MenuUsesFrames?parent:window,Doc=Par.document,Bod=Doc.body,Trigger=NavYes?Par:Bod;
    var Ztop=100,InitLdd=0,P_X=DomYes?"px":"";
    var OpnTmr=null;
    if(PosStrt){if(MacExp4||MacExp5)LdTmr=setInterval("ChckInitLd()",100);
              else{if(Trigger.onload)Dummy=Trigger.onload;
                   if(DomNav)Trigger.addEventListener("load",Go,false);
                   else Trigger.onload=Go}}
    function ChckInitLd(){
         InitLdd=(MenuUsesFrames)?(Par.document.readyState=="complete"&&Par.frames[FirstLineFrame].document.readyState=="complete"&&Par.frames[SecLineFrame].document.readyState=="complete")?1:0:(Par.document.readyState=="complete")?1:0;
         if(InitLdd){clearInterval(LdTmr);Go()}}
    function Dummy(){return}
    function CnclSlct(){return false}
    function RePos(){
         FWinW=ExpYes?FLoc.document.body.clientWidth:FLoc.innerWidth;
         FWinH=ExpYes?FLoc.document.body.clientHeight:FLoc.innerHeight;
         SWinW=ExpYes?ScLoc.document.body.clientWidth:ScLoc.innerWidth;
         SWinH=ExpYes?ScLoc.document.body.clientHeight:ScLoc.innerHeight;
         if(MenuCentered.indexOf("justify")!=-1&&FirstLineHorizontal){
              ClcJus();
              var P=FrstCntnr.FrstMbr,W=Menu1[5],a=BorderBtwnMain?NoOffFirstLineMenus+1:2,i;
              FrstCntnr.style.width=NoOffFirstLineMenus*W+a*BorderWidthMain+P_X;
              for(i=0;i<NoOffFirstLineMenus;i++){
                   P.style.width=W-(P.value.indexOf("<")==-1?LftXtra:0)+P_X;               
                   if(P.ai&&!RightToLeft)
                        P.ai.style.left=BottomUp?W-BorderColor-2+P_X:W-Arrws[4]-2+P_X;
                        P=P.PrvMbr
         StaticPos=-1;
         ClcRl();
         if(TargetLoc)ClcTrgt();ClcLft();ClcTp();
         PosMenu(FrstCntnr,StartTop,StartLeft);
         if(RememberStatus)StMnu()}
    function NavUnLdd(){Ldd=0;Crtd=0;SetMenu="0"}
    function UnLdd(){
         NavUnLdd();
         if(ExpYes){var M=FrstCntnr?FrstCntnr.FrstMbr:null;
              while(M!=null){if(M.CCn){MakeNull(M.CCn);M.CCn=null}
                   M=M.PrvMbr}}
         if(!Nav4){LdTmr=setInterval("ChckLdd()",100)}}
    function UnLddTotal(){MakeNull(FrstCntnr);FrstCntnr=RmbrNow=FLoc=ScLoc=DcLoc=SLdAgnWin=CurOvr=CloseTmr=Doc=Bod=Trigger=null}
    function MakeNull(P){
         var M=P.FrstMbr,Mi;
         while(M!=null){Mi=M;
              if(M.CCn){MakeNull(M.CCn);M.CCn=null}
              M.Cntnr=null;M=M.PrvMbr;Mi.PrvMbr=null;Mi=null}
         P.FrstMbr=null}
    function ChckLdd(){
         if(!ExpYes){if(ScLoc.document.body){clearInterval(LdTmr);Go()}}
         else if(ScLoc.document.readyState=="complete"){if(LdTmr)clearInterval(LdTmr);Go()}}
    function NavLdd(e){if(e.target!=self)routeEvent(e);if(e.target==ScLoc)Go()}
    function ReDoWhole(){if(AppVer.indexOf("4.0")==-1)Doc.location.reload();else if(SWinW!=ScLoc.innerWidth||SWinH!=ScLoc.innerHeight||FWinW!=FLoc.innerWidth||FWinH!=FLoc.innerHeight)Doc.location.reload()}
    function Go(){
         if(!Ldd&&PosStrt){
              BeforeStart();
              Crtd=0;Ldd=1;
              FLoc=MenuUsesFrames?parent.frames[FirstLineFrame]:window;
              ScLoc=MenuUsesFrames?parent.frames[SecLineFrame]:window;
              DcLoc=MenuUsesFrames?parent.frames[DocTargetFrame]:window;
              if(MenuUsesFrames){
                   if(!FLoc){FLoc=ScLoc;if(!FLoc){FLoc=ScLoc=DcLoc;if(!FLoc)FLoc=ScLoc=DcLoc=window}}
                   if(!ScLoc){ScLoc=DcLoc;if(!ScLoc)ScLoc=DcLoc=FLoc}
                   if(!DcLoc)DcLoc=ScLoc}
              if(FLoc==ScLoc)AcrssFrms=0;
              if(AcrssFrms)FirstLineHorizontal=MenuFramesVertical?0:1;
              FWinW=ExpYes?FLoc.document.body.clientWidth:FLoc.innerWidth;
              FWinH=ExpYes?FLoc.document.body.clientHeight:FLoc.innerHeight;
              SWinW=ExpYes?ScLoc.document.body.clientWidth:ScLoc.innerWidth;
              SWinH=ExpYes?ScLoc.document.body.clientHeight:ScLoc.innerHeight;
              FColW=Nav4?FLoc.document:FLoc.document.body;
              SColW=Nav4?ScLoc.document:ScLoc.document.body;
              DColW=Nav4?DcLoc.document:ScLoc.document.body;
              if(TakeOverBgColor){
                   if(ExpYes&&MacCom)FColW.style.backgroundColor=AcrssFrms?SColW.bgColor:DColW.bgColor;
                   else FColW.bgColor=AcrssFrms?SColW.bgColor:DColW.bgColor}
              if(MenuCentered.indexOf("justify")!=-1&&FirstLineHorizontal)ClcJus();
              if(FrstCreat||FLoc==ScLoc)FrstCntnr=CreateMenuStructure("Menu",NoOffFirstLineMenus,null);
              else CreateMenuStructureAgain("Menu",NoOffFirstLineMenus);
              ClcRl();
              if(TargetLoc)ClcTrgt();ClcLft();ClcTp();
              PosMenu(FrstCntnr,StartTop,StartLeft);
              IniFlg=1;Initiate();Crtd=1;
              SLdAgnWin=ExpYes?ScLoc.document.body:ScLoc;SLdAgnWin.onunload=Nav4?NavUnLdd:UnLdd;
              if(ExpYes)Trigger.onunload=UnLddTotal;
              Trigger.onresize=Nav4?ReDoWhole:RePos;
              AfterBuild();
              if(RememberStatus)StMnu();
              if(Nav4&&FrstCreat){Trigger.captureEvents(Event.LOAD);Trigger.onload=NavLdd}
              if(FrstCreat)Dummy();FrstCreat=0;
              if(MenuVerticalCentered=="static"&&!AcrssFrms)setInterval("KeepPos()",250)     }}
    function KeepPos(){
         var TS=ExpYes?FLoc.document.body.scrollTop:FLoc.pageYOffset;
         if(TS!=StaticPos){var FCSt=Nav4?FrstCntnr:FrstCntnr.style;
              FrstCntnr.OrgTop=StartTop+TS;FCSt.top=FrstCntnr.OrgTop+P_X;StaticPos=TS}}
    function ClcRl(){
         StartTop=M_StrtTp<1&&M_StrtTp>0?M_StrtTp*FWinH:M_StrtTp;
         StartLeft=M_StrtLft<1&&M_StrtLft>0?M_StrtLft*FWinW:M_StrtLft}
    function ClcJus(){
         var a=BorderBtwnMain?NoOffFirstLineMenus+1:2,Sz=Math.round((PartOfWindow*FWinW-a*BorderWidthMain)/NoOffFirstLineMenus),i,j;
         for(i=1;i<NoOffFirstLineMenus+1;i++){j=eval("Menu"+i);j[5]=Sz}
         StartLeft=0}
    function ClcTrgt(){
         var TLoc=Nav4?FLoc.document.layers[TargetLoc]:DomYes?FLoc.document.getElementById(TargetLoc):FLoc.document.all[TargetLoc];
         if(DomYes){while(TLoc){StartTop+=TLoc.offsetTop;StartLeft+=TLoc.offsetLeft;TLoc=TLoc.offsetParent}}
         else{StartTop+=Nav4?TLoc.pageY:TLoc.offsetTop;StartLeft+=Nav4?TLoc.pageX:TLoc.offsetLeft}}
    function ClcLft(){
         if(MenuCentered.indexOf("left")==-1){
              var Sz=FWinW-(!Nav4?parseInt(FrstCntnr.style.width):FrstCntnr.clip.width);
              StartLeft+=MenuCentered.indexOf("right")!=-1?Sz:Sz/2;
              if(StartLeft<0)StartLeft=0}}
    function ClcTp(){
         if(MenuVerticalCentered!="top"&&MenuVerticalCentered!="static"){
              var Sz=FWinH-(!Nav4?parseInt(FrstCntnr.style.height):FrstCntnr.clip.height);
              StartTop+=MenuVerticalCentered=="bottom"?Sz:Sz/2;
              if(StartTop<0)StartTop=0}}
    function PosMenu(Ct,Tp,Lt){
         RLvl++;
         var Ti,Li,Hi,Mb=Ct.FrstMbr,CStl=!Nav4?Ct.style:Ct,MStl=!Nav4?Mb.style:Mb,PadL=Mb.value.indexOf("<")==-1?LftXtra:0,PadT=Mb.value.indexOf("<")==-1?TpXtra:0,MWt=!Nav4?parseInt(MStl.width)+PadL:MStl.clip.width,MHt=!Nav4?parseInt(MStl.height)+PadT:MStl.clip.height,CWt=!Nav4?parseInt(CStl.width):CStl.clip.width,CHt=!Nav4?parseInt(CStl.height):CStl.clip.height,CCw,CCh,STp,SLt;
         var BRW=RLvl==1?BorderWidthMain:BorderWidthSub,BTWn=RLvl==1?BorderBtwnMain:BorderBtwnSub;
         if(RLvl==1&&AcrssFrms)!MenuFramesVertical?Tp=BottomUp?0:FWinH-CHt+(Nav4?MacCom?-2:4:0):Lt=RightToLeft?0:FWinW-CWt+(Nav4?MacCom?-2:4:0);
         if(RLvl==2&&AcrssFrms)!MenuFramesVertical?Tp=BottomUp?SWinH-CHt+(Nav4?MacCom?-2:4:0):0:Lt=RightToLeft?SWinW-CWt:0;
         if(RLvl==2){Tp+=VerCorrect;Lt+=HorCorrect}
         CStl.top=RLvl==1?Tp+P_X:0;Ct.OrgTop=Tp;
         CStl.left=RLvl==1?Lt+P_X:0;Ct.OrgLeft=Lt;
         if(RLvl==1&&FirstLineHorizontal){Hi=1;Li=CWt-MWt-2*BRW;Ti=0}
         else{Hi=Li=0;Ti=CHt-MHt-2*BRW}
         while(Mb!=null){
              MStl.left=Li+BRW+P_X;
              MStl.top=Ti+BRW+P_X;
              if(Nav4)Mb.CLyr.moveTo(Li+BRW,Ti+BRW);
              if(Mb.CCn){if(RightToLeft)CCw=Nav4?Mb.CCn.clip.width:parseInt(Mb.CCn.style.width);
                   if(BottomUp)CCh=Nav4?Mb.CCn.clip.height:parseInt(Mb.CCn.style.height);
                   if(Hi){STp=BottomUp?Ti-CCh:Ti+MHt+2*BRW;SLt=RightToLeft?Li+MWt-CCw:Li}
                   else{SLt=RightToLeft?Li-CCw+ChildOverlap*MWt+BRW:Li+(1-ChildOverlap)*MWt;
                        STp=RLvl==1&&AcrssFrms?BottomUp?Ti-CCh+MHt:Ti:BottomUp?Ti-CCh+(1-ChildVerticalOverlap)*MHt+2*BRW:Ti+ChildVerticalOverlap*MHt+BRW}
                   PosMenu(Mb.CCn,STp,SLt)}
              Mb=Mb.PrvMbr;
              if(Mb){     MStl=!Nav4?Mb.style:Mb;PadL=Mb.value.indexOf("<")==-1?LftXtra:0;
                   PadT=Mb.value.indexOf("<")==-1?TpXtra:0;
                   MWt=!Nav4?parseInt(MStl.width)+PadL:MStl.clip.width;
                   MHt=!Nav4?parseInt(MStl.height)+PadT:MStl.clip.height;
                   Hi?Li-=BTWn?(MWt+BRW):(MWt):Ti-=BTWn?(MHt+BRW):MHt}}
         status="Ready";RLvl--}
    function StMnu(){
         if(!Crtd)return;
         var i,Pntr=FrstCntnr,Str=ScLoc.SetMenu?ScLoc.SetMenu:"0";
         while(Str.indexOf("_")!=-1&&RememberStatus==1){
              i=Pntr.NrItms-parseInt(Str.substring(0,Str.indexOf("_")));
              Str=Str.slice(Str.indexOf("_")+1);
              Pntr=Pntr.FrstMbr;
              for(i;i;i--)Pntr=Pntr.PrvMbr;
              if(Nav4)Pntr.CLyr.OM();
              else Pntr.OM();
              Pntr=Pntr.CCn}
         i=Pntr.NrItms-parseInt(Str);
         Pntr=Pntr.FrstMbr;
         for(i;i;i--)Pntr=Pntr.PrvMbr;
         if(RmbrNow!=null){SetItem(RmbrNow,0);RmbrNow.Clckd=0}
         if(Pntr!=null){SetItem(Pntr,1);Pntr.Clckd=1;
         if(RememberStatus==1){if(Nav4)Pntr.CLyr.OM();else Pntr.OM()}}
         RmbrNow=Pntr;
         ClrAllChlds(FrstCntnr.FrstMbr);
         Rmbr(FrstCntnr)}
    function Initiate(){
         if(IniFlg&&Ldd){Init(FrstCntnr);IniFlg=0;if(RememberStatus)Rmbr(FrstCntnr);if(ShwFlg)AfterCloseAll();ShwFlg=0}}
    function Rmbr(CntPtr){
         var Mbr=CntPtr.FrstMbr,St;
         while(Mbr!=null){
              if(Mbr.DoRmbr){
                   HiliteItem(Mbr);
                   if(Mbr.CCn&&RememberStatus==1){St=Nav4?Mbr.CCn:Mbr.CCn.style;St.visibility=M_Show;Rmbr(Mbr.CCn)}
                   break}
              else Mbr=Mbr.PrvMbr}}
    function Init(CPt){
         var Mb=CPt.FrstMbr,MCSt=Nav4?CPt:CPt.style;
         RLvl++;MCSt.visibility=RLvl==1?M_Show:M_Hide;CPt.Shw=RLvl==1?1:0;
         while(Mb!=null){if(Mb.Hilite)LowItem(Mb);if(Mb.CCn)Init(Mb.CCn);Mb=Mb.PrvMbr}
         RLvl--}
    function ClrAllChlds(Pt){
         var PSt,Pc;
         while(Pt){if(Pt.Hilite){Pc=Nav4?Pt.CLyr:Pt;if(Pc!=CurOvr){LowItem(Pt)}
              if(Pt.CCn){PSt=Nav4?Pt.CCn:Pt.CCn.style;if(Pc!=CurOvr){PSt.visibility=M_Hide;Pt.CCn.Shw=0}ClrAllChlds(Pt.CCn.FrstMbr)}
              break}
         Pt=Pt.PrvMbr}}
    function SetItem(Pntr,x){while(Pntr!=null){Pntr.DoRmbr=x;Pntr=Nav4?Pntr.CLyr.Ctnr.Cllr:Pntr.Ctnr.Cllr}}
    function GoTo(){
         var HP=Nav4?this.LLyr:this;
         if(HP.Arr[1]){status="";LowItem(HP);IniFlg=1;Initiate();
              HP.Arr[1].indexOf("javascript:")!=-1?eval(HP.Arr[1]):DcLoc.location.href=BaseHref+HP.Arr[1]}}
    function HiliteItem(P){
         if(Nav4){     if(P.ro)P.document.images[P.rid].src=P.ri2;
              else{     
                    P.bgColor = HighBgColor;
                   if(P.value.indexOf("<img")==-1){P.document.write(P.Ovalue);P.document.close()}}}
                   else{     
                        if(P.ro){var Lc=P.Lvl==1?FLoc:ScLoc;Lc.document.images[P.rid].src=P.ri2}
                        else{               
                             P.style.backgroundColor=HighBgColor;
                             P.style.color=FontHighColor;
         P.Hilite=1
    function LowItem(P){
         P.Hilite=0;
         if(P.ro){if(Nav4)P.document.images[P.rid].src=P.ri1;
              else{var Lc=P.Lvl==1?FLoc:ScLoc;Lc.document.images[P.rid].src=P.ri1}}
         else{
              if(Nav4){
                        P.bgColor=LowBgColor;
              if(P.value.indexOf("<img")==-1){P.document.write(P.value);P.document.close()}}
              else{
                        P.style.backgroundColor=LowBgColor;
                        P.style.color=FontLowColor;
    function OpenMenu(){
         if(!Ldd||!Crtd)return;
         if(OpnTmr)clearTimeout(OpnTmr);
         var P=Nav4?this.LLyr:this;
         if(P.NofChlds&&!P.CCn){
              RLvl=this.Lvl;
              P.CCn=CreateMenuStructure(P.MN+"_",P.NofChlds,P);
              var Ti,Li,Hi;
              var MStl=!Nav4?P.style:P;
              var PadL=P.value.indexOf("<")==-1?LftXtra:0;
              var PadT=P.value.indexOf("<")==-1?TpXtra:0;
              var MWt=!Nav4?parseInt(MStl.width)+PadL:MStl.clip.width;
              var MHt=!Nav4?parseInt(MStl.height)+PadT:MStl.clip.height;
              var CCw,CCh,STp,SLt;
              var BRW=RLvl==1?BorderWidthMain:BorderWidthSub;
              if(RightToLeft)CCw=Nav4?P.CCn.clip.width:parseInt(P.CCn.style.width);
              if(BottomUp)CCh=Nav4?P.CCn.clip.height:parseInt(P.CCn.style.height);
              if(RLvl==1&&FirstLineHorizontal){Hi=1;Li=(Nav4?P.left:parseInt(P.style.left))-BRW;Ti=0}
              else{Hi=Li=0;Ti=(Nav4?P.top:parseInt(P.style.top))-BRW}
              if(Hi){STp=BottomUp?Ti-CCh:Ti+MHt+2*BRW;SLt=RightToLeft?Li+MWt-CCw:Li}
              else{SLt=RightToLeft?Li-CCw+ChildOverlap*MWt+BRW:Li+(1-ChildOverlap)*MWt;
              STp=RLvl==1&&AcrssFrms?BottomUp?Ti-CCh+MHt:Ti:BottomUp?Ti-CCh+(1-ChildVerticalOverlap)*MHt+2*BRW:Ti+ChildVerticalOverlap*MHt+BRW}
              PosMenu(P.CCn,STp,SLt);
              RLvl=0}
         var CCnt=Nav4?this.LLyr.CCn:this.CCn,HP=Nav4?this.LLyr:this;
         CurOvr=this;IniFlg=0;ClrAllChlds(this.Ctnr.FrstMbr);
         if(!HP.Hilite)HiliteItem(HP);
         if(CCnt!=null&&!CCnt.Shw)RememberStatus?Unfld():OpnTmr=setTimeout("Unfld()",UnfoldDelay);
    //alert(HP.value);
         status=HP.value;
    function Unfld(){
         var P=CurOvr;
         var TS=ExpYes?ScLoc.document.body.scrollTop:ScLoc.pageYOffset,LS=ExpYes?ScLoc.document.body.scrollLeft:ScLoc.pageXOffset,CCnt=Nav4?P.LLyr.CCn:P.CCn,THt=Nav4?P.clip.height:parseInt(P.style.height),TWt=Nav4?P.clip.width:parseInt(P.style.width),TLt=AcrssFrms&&P.Lvl==1&&!FirstLineHorizontal?0:Nav4?P.Ctnr.left:parseInt(P.Ctnr.style.left),TTp=AcrssFrms&&P.Lvl==1&&FirstLineHorizontal?0:Nav4?P.Ctnr.top:parseInt(P.Ctnr.style.top);
         // TS != 0 is only needed if the menu DIVs are positioned relative to the body.
         // We've made them positioned relative to div#navigationMenu which causes
         // a problem if TS is based on how the body is scrolled.  So set TS to zero.
         // Note: the code below will adjust the final top offset based on the height of
         // the menu bar so the dropdown appears below (and not on top of) the nav bar.
         TS = 0;
         var CCW=Nav4?P.LLyr.CCn.clip.width:parseInt(P.CCn.style.width),CCH=Nav4?P.LLyr.CCn.clip.height:parseInt(P.CCn.style.height),CCSt=Nav4?P.LLyr.CCn:P.CCn.style,SLt=AcrssFrms&&P.Lvl==1?CCnt.OrgLeft+TLt+LS:CCnt.OrgLeft+TLt,STp=AcrssFrms&&P.Lvl==1?CCnt.OrgTop+TTp+TS:CCnt.OrgTop+TTp;
         if(!ShwFlg){ShwFlg=1;BeforeFirstOpen()}
         if(MenuWrap){
              if(RightToLeft){if(SLt<LS)SLt=P.Lvl==1?LS:SLt+(CCW+(1-2*ChildOverlap)*TWt);if(SLt+CCW>SWinW+LS)SLt=SWinW+LS-CCW}
              else{if(SLt+CCW>SWinW+LS)SLt=P.Lvl==1?SWinW+LS-CCW:SLt-(CCW+(1-2*ChildOverlap)*TWt);if(SLt<LS)SLt=LS}
              if(BottomUp){if(STp<TS)STp=P.Lvl==1?TS:STp+(CCH-(1-2*ChildVerticalOverlap)*THt);if(STp+CCH>SWinH+TS)STp=SWinH+TS-CCH+(Nav4?4:0)}
              else{if(STp+CCH>TS+SWinH)STp=P.Lvl==1?STp=TS+SWinH-CCH:STp-CCH+(1-2*ChildVerticalOverlap)*THt;if(STp<TS)STp=TS}}
         CCSt.top=STp+P_X;CCSt.left=SLt+P_X;
         if(Fltr&&MenuSlide){P.CCn.filters[0].Apply();P.CCn.filters[0].play()}
         CCSt.visibility=M_Show}
    function OpenMenuClick(){
         if(!Ldd||!Crtd)return;
         var HP=Nav4?this.LLyr:this;CurOvr=this;
         IniFlg=0;ClrAllChlds(this.Ctnr.FrstMbr);HiliteItem(HP);
    function CloseMenu(){
         if(!Ldd||!Crtd)return;
         status="";
         if(this==CurOvr){if(OpnTmr)clearTimeout(OpnTmr);if(CloseTmr)clearTimeout(CloseTmr);IniFlg=1;CloseTmr=setTimeout("Initiate(CurOvr)",DissapearDelay)}}
    function CntnrSetUp(W,H,NoOff,WMu,Mc){
         var x=BorderColor;
         this.FrstMbr=null;this.NrItms=NoOff;this.Cllr=Mc;this.Shw=0;
         this.OrgLeft=this.OrgTop=0;
         if(Nav4){if(x)this.bgColor=x;this.visibility="hide";this.resizeTo(W,H)}
         else{if(x)this.style.backgroundColor=x;this.style.width=W+P_X;this.style.height=H+P_X;
              if(!NavYes)this.style.zIndex=RLvl+Ztop;
              if(Fltr){FStr="";if(MenuSlide&&RLvl!=1)FStr=MenuSlide;if(MenuShadow)FStr+=MenuShadow;
                   if(MenuOpacity)FStr+=MenuOpacity;if(FStr!="")this.style.filter=FStr}}}
    function MbrSetUp(MbC,PrMmbr,WMu,Wd,Ht,Nofs){
         var Lctn=RLvl==1?FLoc:ScLoc,Tfld=this.Arr[0],t,T,L,W,H,S,a;
         this.PrvMbr=PrMmbr;this.Lvl=RLvl;this.Ctnr=MbC;this.CCn=null;this.ai=null;this.Hilite=0;this.DoRmbr=0;
         this.Clckd=0;this.OM=OpenMenu;this.style.overflow="hidden";
         this.MN=WMu;this.NofChlds=Nofs;
         this.style.cursor=(this.Arr[1]||(RLvl==1&&UnfoldsOnClick))?ExpYes?"hand":"pointer":"default";this.ro=0;
         if(Tfld.indexOf("rollover")!=-1){this.ro=1;this.ri1=Tfld.substring(Tfld.indexOf("?")+1,Tfld.lastIndexOf("?"));
              this.ri2=Tfld.substring(Tfld.lastIndexOf("?")+1,Tfld.length);this.rid=WMu+"i";
              Tfld="<img src=\""+this.ri1+"\" name=\""+this.rid+"\" width=\""+Wd+"\" height=\""+Ht+"\">"}
         this.value=Tfld;
         this.style.color=FontLowColor;
         this.style.fontFamily=FontFamily;
         this.style.fontSize = FontSize + "pt";
         this.style.fontWeight="normal";
         this.style.fontStyle="normal";
         this.style.backgroundColor=LowBgColor;
         if (WMu.length > 6)
         { MenuTextCentered = 'left';}
         else
         {MenuTextCentered = 'center';}     
         this.style.textAlign=MenuTextCentered;
         if(this.Arr[2])this.style.backgroundImage="url(\""+this.Arr[2]+"\")";
         if(Tfld.indexOf("<")==-1){this.style.width=Wd-LftXtra+P_X;this.style.height=Ht-TpXtra+P_X;this.style.paddingLeft=LeftPaddng+P_X;this.style.paddingTop=TopPaddng+P_X}
         else{this.style.width=Wd+P_X;this.style.height=Ht+P_X}
         if(Tfld.indexOf("<")==-1&&DomYes){t=Lctn.document.createTextNode(Tfld);this.appendChild(t)}
         else this.innerHTML=Tfld;
         if(this.Arr[3]){a=RLvl==1&&FirstLineHorizontal?BottomUp?9:3:RightToLeft?6:0;
              if(Arrws[a]!=""){S=Arrws[a];W=Arrws[a+1];H=Arrws[a+2];T=RLvl==1&&FirstLineHorizontal?BottomUp?2:Ht-H-2:(Ht-H)/2;L=RightToLeft?2:Wd-W-2;
                   if(DomYes){t=Lctn.document.createElement("img");this.appendChild(t);
                        t.style.position="absolute";t.src=S;t.style.width=W+P_X;t.style.height=H+P_X;t.style.top=T+P_X;t.style.left=L+P_X}
                   else{Tfld+="<div id=\""+WMu+"_im\" style=\"position:absolute; top:"+T+"; left:"+L+"; width:"+W+"; height:"+H+";visibility:inherit\"><img src=\""+S+"\"></div>";
                        this.innerHTML=Tfld;t=Lctn.document.all[WMu+"_im"]}
                   this.ai=t}}
         if(ExpYes){this.onselectstart=CnclSlct;this.onmouseover=RLvl==1&&UnfoldsOnClick?OpenMenuClick:OpenMenu;
              this.onmouseout=CloseMenu;this.onclick=RLvl==1&&UnfoldsOnClick&&this.Arr[3]?OpenMenu:GoTo}
         else{RLvl==1&&UnfoldsOnClick?this.addEventListener("mouseover",OpenMenuClick,false):this.addEventListener("mouseover",OpenMenu,false);
              this.addEventListener("mouseout",CloseMenu,false);
              RLvl==1&&UnfoldsOnClick&&this.Arr[3]?this.addEventListener("click",OpenMenu,false):this.addEventListener("click",GoTo,false)}}
    function NavMbrSetUp(MbC,PrMmbr,WMu,Wd,Ht,Nofs){
         var a;
         this.value=this.Arr[0];this.ro=0;
         if(this.value.indexOf("rollover")!=-1){
              this.ro=1;this.ri1=this.value.substring(this.value.indexOf("?")+1,this.value.lastIndexOf("?"));
              this.ri2=this.value.substring(this.value.lastIndexOf("?")+1,this.value.length);this.rid=WMu+"i";
              this.value="<img src=\""+this.ri1+"\" name=\""+this.rid+"\">"}
         CntrTxt="<div align=\""+MenuTextCentered+"\">";
         TxtClose="</font>"+ "</div>";
         if(LeftPaddng&&this.value.indexOf("<")==-1&&MenuTextCentered=="left")this.value="�\;"+this.value;
         this.Ovalue=this.value;
         this.value=this.value.fontcolor(FontLowColor);
         this.Ovalue=this.Ovalue.fontcolor(FontHighColor);
         this.value=CntrTxt+"<font face=\""+FontFamily+"\" point-size=\""+FontSize+"\">"+this.value+TxtClose;
         this.Ovalue=CntrTxt+"<font face=\""+FontFamily+"\" point-size=\""+FontSize+"\">"+this.Ovalue+TxtClose;
         this.CCn=null;this.PrvMbr=PrMmbr;this.Hilite=0;this.DoRmbr=0;this.Clckd=0;this.visibility="inherit";
         this.MN=WMu;this.NofChlds=Nofs;
         this.bgColor=LowBgColor;
         this.resizeTo(Wd,Ht);
         if(!AcrssFrms&&this.Arr[2])this.background.src=this.Arr[2];
         this.document.write(this.value);this.document.close();
         this.CLyr=new Layer(Wd,MbC);
         this.CLyr.Lvl=RLvl;this.CLyr.visibility="inherit";
         this.CLyr.onmouseover=RLvl==1&&UnfoldsOnClick?OpenMenuClick:OpenMenu;this.CLyr.onmouseout=CloseMenu;
         this.CLyr.captureEvents(Event.MOUSEUP);this.CLyr.onmouseup=RLvl==1&&UnfoldsOnClick&&this.Arr[3]?OpenMenu:GoTo;
         this.CLyr.OM=OpenMenu;
         this.CLyr.LLyr=this;this.CLyr.resizeTo(Wd,Ht);this.CLyr.Ctnr=MbC;
         if(this.Arr[3]){a=RLvl==1&&FirstLineHorizontal?BottomUp?9:3:RightToLeft?6:0;
              if(Arrws[a]!=""){this.CLyr.ILyr=new Layer(Arrws[a+1],this.CLyr);this.CLyr.ILyr.visibility="inherit";
                   this.CLyr.ILyr.top=RLvl==1&&FirstLineHorizontal?BottomUp?2:Ht-Arrws[a+2]-2:(Ht-Arrws[a+2])/2;
                   this.CLyr.ILyr.left=RightToLeft?2:Wd-Arrws[a+1]-2;this.CLyr.ILyr.width=Arrws[a+1];this.CLyr.ILyr.height=Arrws[a+2];
                   ImgStr="<img src=\""+Arrws[a]+"\" width=\""+Arrws[a+1]+"\" height=\""+Arrws[a+2]+"\">";
                   this.CLyr.ILyr.document.write(ImgStr);this.CLyr.ILyr.document.close()}}}
    function CreateMenuStructure(MNm,No,Mcllr){
         status="Building menu";RLvl++;
         var i,NOs,Mbr,W=0,H=0,PMb=null,WMnu=MNm+"1",MWd=eval(WMnu+"[5]"),MHt=eval(WMnu+"[4]"),Lctn=RLvl==1?FLoc:ScLoc;
         var BRW=RLvl==1?BorderWidthMain:BorderWidthSub,BTWn=RLvl==1?BorderBtwnMain:BorderBtwnSub;
         if(RLvl==1&&FirstLineHorizontal){
              for(i=1;i<No+1;i++){WMnu=MNm+eval(i);W=eval(WMnu+"[5]")?W+eval(WMnu+"[5]"):W+MWd}
              W=BTWn?W+(No+1)*BRW:W+2*BRW;H=MHt+2*BRW}
         else{for(i=1;i<No+1;i++){WMnu=MNm+eval(i);H=eval(WMnu+"[4]")?H+eval(WMnu+"[4]"):H+MHt}
              H=BTWn?H+(No+1)*BRW:H+2*BRW;W=MWd+2*BRW}
         if(DomYes){var MbC=Lctn.document.createElement("div");MbC.style.position="absolute";MbC.style.visibility="hidden";Lctn.document.getElementById("navigationMenu").appendChild(MbC)}
         else{if(Nav4)var MbC=new Layer(W,Lctn);
              else{WMnu+="c";Lctn.document.body.insertAdjacentHTML("AfterBegin","<div id=\""+WMnu+"\" style=\"visibility:hidden; position:absolute;\"><\/div>");
                   var MbC=Lctn.document.all[WMnu]}}
         MbC.SetUp=CntnrSetUp;MbC.SetUp(W,H,No,MNm+"1",Mcllr);
         if(Exp4){MbC.InnerString="";
              for(i=1;i<No+1;i++){WMnu=MNm+eval(i);MbC.InnerString+="<div id=\""+WMnu+"\" style=\"position:absolute;\"><\/div>"}
              MbC.innerHTML=MbC.InnerString}
         for(i=1;i<No+1;i++){WMnu=MNm+eval(i);NOs=eval(WMnu+"[3]");
              W=RLvl==1&&FirstLineHorizontal?eval(WMnu+"[5]")?eval(WMnu+"[5]"):MWd:MWd;
              H=RLvl==1&&FirstLineHorizontal?MHt:eval(WMnu+"[4]")?eval(WMnu+"[4]"):MHt;
              if(DomYes){Mbr=Lctn.document.createElement("div");     Mbr.style.position="absolute";Mbr.style.visibility="inherit";MbC.appendChild(Mbr)}
              else Mbr=Nav4?new Layer(W,MbC):Lctn.document.all[WMnu];
              Mbr.Arr=eval(WMnu);                    
              Mbr.SetUp=Nav4?NavMbrSetUp:MbrSetUp;Mbr.SetUp(MbC,PMb,WMnu,W,H,NOs);
              if(NOs&&!BuildOnDemand){Mbr.CCn=CreateMenuStructure(WMnu+"_",NOs,Mbr)}
              PMb=Mbr}
         MbC.FrstMbr=Mbr;
         RLvl--;
         return(MbC)}
    function CreateMenuStructureAgain(MNm,No){
         if(!BuildOnDemand){
              var i,WMnu,NOs,PMb,Mbr=FrstCntnr.FrstMbr;RLvl++;
              for(i=No;i>0;i--){WMnu=MNm+eval(i);NOs=eval(WMnu+"[3]");PMb=Mbr;if(NOs)Mbr.CCn=CreateMenuStructure(WMnu+"_",NOs,Mbr);Mbr=Mbr.PrvMbr}
              RLvl--}
         else{     var Mbr=FrstCntnr.FrstMbr;
              while(Mbr){Mbr.CCn=null;Mbr=Mbr.PrvMbr}}}

    Hi thanks...As you said I am performing only on onload event..only thing i am confused is if i remove the javacript MRHeader.js everything works fine...am totally confused...pls help
    Here is my JSP code for my input page
    <%@page import="java.util.*" %>
    <%@page import="com.ford.mr.*" %>
    <HTML>
    <HEAD>
    <link href="./css/mplstyle.css" rel="STYLESHEET" type="text/css">
    <title>Input Frame</title>
    <link type="text/css" rel="STYLESHEET" href="./css/classic.css">
    <STYLE>
        .vis1 { visibility:visible }
        .vis2 { visibility:hidden }
    </STYLE>
    <%--
    MRIFValidation.js contains the java script for the following requirement:
    1. Setting the current date in date to compare
    2. All input frame client validations.
    E.g Plant id should not be empty.
    --%>
    <script type="text/javascript" src="./javascript/MRIFValidation.js"> </script>
    <%--
    MRR2HandleDropdown.js is the javascript for the input frame server side actions
    It has many functions related to drop down populating and rendering the data
    to user from server.
    --%>
    <script language="javascript" src="./javascript/MRR2HandleDropdown.js"> </script>
    <%--
    MRheader.js is the javascript which displays the header for our application
    plus it has an internal call to MRMenuItem.js and menuscript.js which
    builds the menu bar for our application
    Issue is here - On commenting the below the previously entered user
    inputs are displayed correctly. Else they are not displayed.
    --%>
    <script language="javascript" src="./javascript/MRheader.js"> </script>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    <!--
    a:visited {
         color: #0000FF;
    .style1 {font-weight: bold}
    .style2 {color: #FF0000}
    body {
         background-color: #FFFFFF;
    -->
    </style>
    <%--
    Declaring all the JSP variables used in the page
    These variables are used for holding the session parameters
    and are used while setting the selected values in the screen.
    --%>
    <%!      
         // HTTPSession object
         HttpSession sess;
         // To hold session Variables //
         // Selected plant index
         String plantIndex;
         // Selected supplier index
         String supplierIndex;
         // Selected part index
         String partIndex;
         // List of plant codes
         Vector plantCodes = new Vector();
         // List of supplier codes
         Vector supplierCodes = new Vector();
         // List of part codes
         Vector partCodes = new Vector();
         // To hold the part description for the selected part
         String partDescription;
         // List of release numbers matching the selected plant, supplier & part
         Vector releaseNumbers = new Vector();
         // Type of release - Weekly / Daily
         String releaseType;
         // Selected release1 index
         String release1Index;
         // Selected release2 index
         String release2Index;
         // Holds the issue date 1 corresponding to release 1 selected
         String issueDate1;
         // Holds the issue date 2 corresponding to release 2 selected
         String issueDate2;
         // List of matching release numbers to the entered issue date1 (Might be one or two
         // in case if amended release exist)
         Vector matchingRelease1Number = new Vector();
         // List of matching release numbers to the entered issue date2 (Might be one or two
         // in case if amended release exist)
         Vector matchingRelease2Number = new Vector();
         // Size of matchingRelease1Number collection
         int matchingRelease1Size = 0;
         // Size of matchingRelease2Number collection
         int matchingRelease2Size = 0;
         // Boolean flags to hold if amended release exists in the release numbers
         // matching the issue dates entered by user.
         boolean amendedRelease1Exist;
         boolean amendedRelease2Exist;
         String pageName = "";
    %>
    <%--
    The below code does the following:
    1. Fetches the various values available in session
    2. Stores the same in various JSP variables for access within the page
    --%>
    <%
    System.out.println("In input frame page");
    sess = request.getSession(true);
         if(sess != null) {
              System.out.println("Session id in input frame: "+ sess.getId());
              plantIndex = (String) sess.getAttribute("selectedPlantIndex");
              supplierIndex = (String) sess.getAttribute("selectedSupplierIndex");
              partIndex = (String) sess.getAttribute("selectedPartIndex");
              //plantCodes = (Vector) sess.getAttribute("plantCodes");
              supplierCodes = (Vector) sess.getAttribute("supplierCodes");
              partCodes = (Vector) sess.getAttribute("partCodes");
              partDescription = (String) sess.getAttribute("partDescription");
              releaseNumbers = (Vector) sess.getAttribute("releaseNumbers");
              releaseType = (String) sess.getAttribute("releaseType");
              release1Index = (String) sess.getAttribute("selectedRelease1Index");
              release2Index =(String)  sess.getAttribute("selectedRelease2Index");
              issueDate1 = (String) sess.getAttribute("issueDate1");
              issueDate2 = (String) sess.getAttribute("issueDate2");
              matchingRelease1Number = (Vector) sess.getAttribute("correspondingRelease1Number");
              matchingRelease2Number = (Vector) sess.getAttribute("correspondingRelease2Number");
              System.out.println("Displaying values in session *******************");
              Enumeration enum = sess.getAttributeNames();
              while(enum.hasMoreElements()) {
                   String elementName = (String) enum.nextElement();
                   System.out.println("element:"+ elementName+": Value: "+ sess.getAttribute(elementName));
              System.out.println("Plant Index JSP variable:"+ plantIndex);
    %>
    <%--
    This code is used for getting the plant codes from
    the DB. Currently it is hardcoded.
    --%>
    <%
    MRR2GetPlantCodes obj = new MRR2GetPlantCodes();
    plantCodes = obj.getPlantCodes();
    %>
    <%--
    The below two blocks are used to iterate through matchingRelease1Number & matchingRelease2Number
    and checks if it has amended release. If yes, sets a boolean flag.
    matchingRelease1Number & matchingRelease2Number are two collections which
    contains the release number(s) matching the inputted issue date
    --%>
    <%
    // Code to set boolean flag amendedRelease1Exist
    if(matchingRelease1Number != null) {
         Iterator relIter = matchingRelease1Number.iterator();
         while(relIter.hasNext()) {
              if( ((String)relIter.next()).endsWith("A") ) {                    
                   amendedRelease1Exist = true;
    // Code to set boolean flag amendedRelease2Exist
    if(matchingRelease2Number != null) {
         Iterator relIter = matchingRelease2Number.iterator();
         while(relIter.hasNext()) {
              if( ((String)relIter.next()).endsWith("A") ) {                    
                   amendedRelease2Exist = true;
    %>
    <%--
    The below script has one method fillDropDown which is used for setting the
    values of the various I/P controls to user selected values:
    It sets the below selected values:
    1. Plant Index, Supplier Index, Part Index, Part description
    2. Release Type (Daily / weekly)
    3. Release 1 Index, Release 2 Index
    4. Issue date1 & Issue date2
    --%>
    <script language="javascript">
    function fillDropDown(field) {
         with(field) {
              var partD = "<%=partDescription%>"
              <% System.out.println("Loading the index values in input frame......");%>
              // inputform.country.selectedIndex = inputform.hiddencountry.value
              // Loading plant Index, supplier Index, part index and part description to selected values
              <% if(plantIndex != null && !plantIndex.equals("")) {%>
                   inputframe.plant.selectedIndex = "<%=Integer.parseInt(plantIndex)%>"               
              <% System.out.println("Selected Plant Index after loading:"+plantIndex);} %>
              <% if(supplierIndex != null && !supplierIndex.equals("")) { System.out.println("****Supplier Index not equals null..."+Integer.parseInt(supplierIndex)); %>
                   inputframe.supplier.selectedIndex = "<%=Integer.parseInt(supplierIndex)%>"
              <% } %>
              <% if(partIndex != null && !partIndex.equals("")) { %>
                   inputframe.part.selectedIndex = "<%=Integer.parseInt(partIndex)%>"
              <% } %>
              <% if(partDescription != null && !partDescription.equals("")) { %>
                   document.getElementById("partDescription").innerHTML = partD
              <%     } %>
              // Making the default release type selection as done by user
              <% if(releaseType != null && !"".equals(releaseType)) {
                        if("daily".equals(releaseType)) {%>
                             inputframe.release[0].checked = "checked"
                        <%     //isDaily = true;
                        } else { %>
                             inputframe.release[1].checked = "checked"
                        <%     //isWeekly = true;
                   } %>
              <%--
                   The below code is used to fetch the session variable issueDate1
                   & issueDate2 (based on the release numbers selected)
                   and sets the same in two text fields.
               --%>          
              <% if(issueDate1 != null && !issueDate1.equals("")) { %>
                   inputframe.issueDate1.value = "<%=issueDate1%>"
              <% } %>
              <% if(issueDate2 != null && !issueDate2.equals("")) { %>
                   inputframe.issueDate2.value = "<%=issueDate2%>"
              <% } %>     
         <%--
              Loading release drop down with the value matching with the entered issue date.
              Scenario : User enters the issue date and the corresponding release number is
              selected in drop down.
              Logic 1:
              1. Pass the issue date entered by user and get the matching release numbers
              from EJB
              2. Compare this with the combo collection and get the perfect match.
              3. If more than one match is found take the one with amendment by default
              4. Else get the matching one
              5. Update the selected index of dropdown to this value
         --%>          
              if(inputframe.release1.options.length > 0) {
                   var matchingCombo1Index = 0
                   var comboValue               
                   var matchFound = "false"
                   var size
                   var amended = false;
                   var amendedReleaseExist = "<%=amendedRelease1Exist%>";
                   var firstValue = ""
                   var secondValue = ""
                   var amendedValue = ""
                   var j = 0
                <%                 
                     if(matchingRelease1Number != null && matchingRelease1Number.size() != 0) {
                          Iterator iter = matchingRelease1Number.iterator();                          
                        matchingRelease1Size = matchingRelease1Number.size(); %>
                        size = "<%=     matchingRelease1Size %>"
                        //alert("Size of collection to be matched:"+size)
                   <%     while(iter.hasNext()) {                         
                             //String matchFound1 = "false";
                             String relValue = (String)iter.next();%>
                             //alert("Collection value under iteration:"+ "<%=relValue%>")                         
                             amended = "<%=relValue.endsWith("A")%>"
                             if(amended) {
                                  amendedValue = "<%=relValue%>"
                             //alert("Collection value under iteration ends with A:"+amended)
                             var comb = "<%=relValue%>"
                             j = j + 1
                             for(var i = 0; i < inputframe.release1.options.length; i++) {
                                  //      breaking the for loop when matchingCombo1Index is set greater than 0
                                  /*if(matchFound == true) {
                                       break
                                  comboValue = inputframe.release1.options.value                              
                                  //alert("Combo value:->"+comboValue)
                                  //alert("rel value in comparison:"+ comb);
                                  if(comboValue == comb) {
                                       if(size == 1) {
                                            matchFound = "true";
                                       if(size == 2) {
                                            if(j == 1)
                                                 firstValue = comb
                                            if(j == 2)
                                                 secondValue = comb
                                            // The below if block shall be also kept as if((amended||(!amendedReleaseExist)==true)
                                            // The below one perfectly works fine
                                            if(amended || !amendedReleaseExist) {
                                                 matchFound = "true";
                                  if(matchFound == "true") {
                                       matchingCombo1Index = i
                                       // alert("Matching combo index set to:"+ matchingCombo1Index)                                   
                                       inputframe.release1.selectedIndex = matchingCombo1Index
                                       if(size == 2)
                                            document.getElementById('errorArea').innerHTML = "There are"
                                                 + " two release numbers for the particular Issue date."
                                                 +" Please select either one of the release numbers ("+firstValue+ " or "+secondValue+" )."
                                                 +" Default selection in the Release drop down is "+ amendedValue+ "."
                                       matchingCombo1Index = 0;
                                       matchFound = "false";
                                       // Breaking the for loop
                                       break;                                   
                        <%                          
                        sess.removeAttribute("correspondingRelease1Number") ;
                   }%>
                   // Setting the selected release 1 index based on the logic done above.
                   if(matchingCombo1Index == 0) {
                        <% if(release1Index != null && !release1Index.equals("")) { matchingRelease1Number = null;%>
                                  inputframe.release1.selectedIndex = "<%=Integer.parseInt(release1Index)%>"
                        <% } %>
              <%--
                   Performing the above logic to select Release2 value
                   when the user enters issue date2
              --%>
              if(inputframe.release2.options.length > 0) {
                   var matchingCombo2Index = 0
                   var comboValue
                   var matchFound = "false"
                   var size
                   var amended = false;
                   var amendedReleaseExist = "<%=amendedRelease2Exist%>";
                   var firstValue = ""
                   var secondValue = ""
                   var amendedValue = ""
                   var j = 0
              <%               
                   if(matchingRelease2Number != null && matchingRelease2Number.size() != 0) {
                        Iterator iter = matchingRelease2Number.iterator();                         
                        matchingRelease2Size = matchingRelease2Number.size(); %>
                        size = "<%=     matchingRelease2Size %>"
                        //alert("Size of collection to be matched:"+size)
                   <%     while(iter.hasNext()) {
                             String matchFound1 = "false";
                             String relValue = (String)iter.next();%>
                             //alert("Collection value under iteration:"+ "<%=relValue%>")                         
                             amended = "<%=relValue.endsWith("A")%>"                         
                             if(amended) {
                                  amendedValue = "<%=relValue%>"
                             //alert("Collection value under iteration ends with A:"+amended)
                             var comb = "<%=relValue%>"
                             j = j + 1
                             for(var i = 0; i < inputframe.release2.options.length; i++) {
                                  //      breaking the for loop when matchingCombo2Index is set greater than 0
                                  /*if(matchFound == true) {
                                       break
                                  comboValue = inputframe.release2.options[i].value                              
                                  //alert("Combo value:->"+comboValue)
                                  //alert("rel value in comparison:"+ comb);
                                  if(comboValue == comb) {
                                       if(size == 1) {
                                            matchFound = "true";
                                       if(size == 2) {
                                            if(j == 1)
                                                 firstValue = comb
                                            if(j == 2)
                                                 secondValue = comb
                                            // The below if block shall be also kept as if((amended||(!amendedReleaseExist)==true)
                                            // The below one perfectly works fine
                                            if(amended || !amendedRelease2Exist) {
                                                 matchFound = "true";
                                  if(matchFound == "true") {
                                       matchingCombo2Index = i
                                       // alert("Matching combo index set to:"+ matchingCombo2Index)                                   
                                       inputframe.release2.selectedIndex = matchingCombo2Index
                                       if(size == 2)
                                            document.getElementById('errorArea').innerHTML = "There are"
                                                 + " two release numbers for the particular Issue date."
                                                 +" Please select either one of the release numbers ("+firstValue+ " or "+secondValue+" )."
                                                 +" Default selection in the Release drop down is "+ amendedValue+ "."
                                       matchingCombo2Index = 0;
                                       matchFound = "false";
                                       // Breaking the for loop
                                       break;                                   
                        <%                          
                        sess.removeAttribute("correspondingRelease2Number") ;
                   }%>
                   // Loading the selected release2 value in drop down
                   if(matchingCombo2Index == 0) {
                        <% if(release2Index != null && !release2Index.equals("")) { matchingRelease2Number = null;%>
                                  inputframe.release2.selectedIndex = "<%=Integer.parseInt(release2Index)%>"
                        <% } %>
         } // end of WITH
              Logic 2: Not used
              1. Pass the issue date entered by user and get the matching release numbers
              2. Get the release numbers from session.
              3. if release type is daily get the daily release numbers else get weekly release numbers
              4. Compare the matching release numbers with daily / weekly release numbers collection
              5. Find the match and update the selected index of drop down to this value
    }// end of function
    </script>
    </HEAD>
    <%-- Calling the two methods onload event of body --%>
    <BODY onload="setCurrentDate(this);fillDropDown(this)">

  • How to get a value from Specific XML Node

    Hi all,
    I'm just trying to introduce to XMLType and see the potencialities of that.
    DB version:
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    PL/SQL Release 10.2.0.5.0 - Production
    CORE     10.2.0.5.0     Production
    TNS for IBM/AIX RISC System/6000: Version 10.2.0.5.0 - Productio
    NLSRTL Version 10.2.0.5.0 - Production
    I'm a table with just one CLOB field:
    CREATE TABLE asm_test
    (doc XMLType NOT NULL)
    XMLTYPE doc STORE AS CLOB;
    Then i've inserted the following XML data:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ReceiptDesc>
    <appt_nbr>2142473</appt_nbr>
    - <Receipt>
    <dc_dest_id>401</dc_dest_id>
    <po_nbr>2142473</po_nbr>
    <document_type>P</document_type>
    <asn_nbr />
    - <ReceiptDtl>
    <item_id>509720</item_id>
    <unit_qty>83.0000</unit_qty>
    <receipt_xactn_type>R</receipt_xactn_type>
    + <receipt_date>
    <year>2012</year>
    <month>09</month>
    <day>17</day>
    <hour>15</hour>
    <minute>33</minute>
    <second>49</second>
    </receipt_date>
    <receipt_nbr>6902340</receipt_nbr>
    <container_id>1</container_id>
    <to_disposition>ATS</to_disposition>
    <user_id>NTCPO01</user_id>
    <catch_weight />
    </ReceiptDtl>
    - <ReceiptDtl>
    <item_id>509740</item_id>
    <unit_qty>17.0000</unit_qty>
    <receipt_xactn_type>R</receipt_xactn_type>
    + <receipt_date>
    <year>2012</year>
    <month>09</month>
    <day>17</day>
    <hour>15</hour>
    <minute>33</minute>
    <second>49</second>
    </receipt_date>
    <receipt_nbr>6902344</receipt_nbr>
    <container_id>1</container_id>
    <to_disposition>ATS</to_disposition>
    <user_id>NTCPO01</user_id>
    <catch_weight />
    </ReceiptDtl>
    </Receipt>
    </ReceiptDesc>
    And then i have started to make some tests to retrieve data from.
    SELECT EXTRACTVALUE(doc, '/ReceiptDesc/appt_nbr') FROM asm_test; -- got the correct value 2142473
    SELECT EXTRACTVALUE(doc, '/ReceiptDesc/Receipt/dc_dest_id') FROM asm_test; ---- got the correct value 401
    select count(*) from asm_jam_test d where (d.doc.getClobVal()) like '%NTCPO01%'; -- got 1
    But i need to find a Specific data from XML (the main goal is to update a value inside XML).
    If i try this:
    select extract(doc, '/ReceiptDesc/Receipt/ReceiptDtl/item_id/text()').getstringVal() from asm_test                     
    where existsNode(doc,'/ReceiptDesc/Receipt/ReceiptDtl/receipt_nbr') = 1;
    got: 509720509740 -- which are the concatenate of 2 Item_ids
    when i try to find out the Item_id of specific receipt_nbr i got a NULL response.
    select extract(doc, '/ReceiptDesc/Receipt/ReceiptDtl/item_id/text()').getstringVal()
    from  asm_test                     
    where existsNode(doc,'/ReceiptDesc/Receipt/ReceiptDtl/receipt_nbr') = 1 and
    extract(doc,'/ReceiptDesc/Receipt/ReceiptDtl/receipt_nbr/text()').getstringVal() = '6902340';
    What i'm doing wrong or which is the best way to get data from XML?
    Many thanks in advance

    Hi,
    Thanks for providing db version and sample data in the first place.
    Don't forget to use the &#x7B;code} tags to preserve formatting.
    Also, when posting XML, do not copy/paste directly from your browser as it retains +/- signs and therefore needs extra processing on our side.
    select count(*) from asm_jam_test d where (d.doc.getClobVal()) like '%NTCPO01%'; -- got 1No, don't do it like that.
    Use existsNode() function in this situation :
    SQL> select count(*)
      2  from asm_test
      3  where existsNode(doc, '/ReceiptDesc/Receipt/ReceiptDtl[user_id="NTCPO01"]') = 1
      4  ;
      COUNT(*)
             1
    when i try to find out the Item_id of specific receipt_nbr i got a NULL response.Yes, that's because this :
    extract(doc,'/ReceiptDesc/Receipt/ReceiptDtl/receipt_nbr/text()').getstringVal()returns :
    69023406902344So obviously it cannot be equal to '6902340'.
    When you have to deal with repeating nodes individually, use XMLTable function to break the structure into relational rows and columns.
    The resultset you'll get acts as a virtual table (or inline view) you can then manipulate with SQL operations :
    SQL> select x.*
      2  from asm_test t
      3     , xmltable(
      4         '/ReceiptDesc/Receipt/ReceiptDtl'
      5         passing t.doc
      6         columns item_id     varchar2(15) path 'item_id'
      7               , receipt_nbr varchar2(15) path 'receipt_nbr'
      8       ) x
      9  ;
    ITEM_ID         RECEIPT_NBR
    509720          6902340
    509740          6902344
    Now, you can just add a WHERE clause to filter the RECEIPT_NBR you require :
    SQL> select x.item_id
      2  from asm_test t
      3     , xmltable(
      4         '/ReceiptDesc/Receipt/ReceiptDtl'
      5         passing t.doc
      6         columns item_id     varchar2(15) path 'item_id'
      7               , receipt_nbr varchar2(15) path 'receipt_nbr'
      8       ) x
      9  where x.receipt_nbr = '6902340'
    10  ;
    ITEM_ID
    509720
    That can also be achieved with EXTRACTVALUE and a single XPath expression (assuming RECEIPT_NBR is unique) :
    SQL> select extractvalue(
      2           doc
      3         , '/ReceiptDesc/Receipt/ReceiptDtl[receipt_nbr="6902340"]/item_id'
      4         ) as item_id
      5  from asm_test
      6  ;
    ITEM_ID
    509720

  • Multiple HighlightPainters for the same JEditorPane

    Hey Everyone,
    I'm having a problem having highligts of multiple colors for the same text component.
    Basically I have a set of results in a separate panel for a search on the text in a JEditorPane. I want the text corresponding to all the search results to be highlighted one color as soon as the search is done, and when one specific search result is clicked on, have the highlight for that result's text change to a different color.
    My current implementation is trying to do this by setting highlights for all the search results, and then when a result is clicked on, setting another highlight with another highlight painter of a different color. Unfortunately, this causes only the second higlight color to be displayed, even though when I look at the editorpane's highlights i can see all of them are being stored.
    Is there something I'm misunderstanding about Highlights?
    Thanks for any help,
    Phil.

    This example shows some ways of playing with attributes and highlights:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.text.*;
    public class TextPaneAttributes extends JFrame
         JTextPane textPane;
         JScrollPane scrollPane;
         Highlighter.HighlightPainter cyanPainter;
         Highlighter.HighlightPainter redPainter;
         public TextPaneAttributes()
              textPane = new JTextPane();
              textPane.setMargin( new Insets(20, 20, 20, 20) );
              StyledDocument doc = textPane.getStyledDocument();
              DefaultHighlighter highlighter = (DefaultHighlighter)textPane.getHighlighter();
              cyanPainter = new DefaultHighlighter.DefaultHighlightPainter( Color.cyan );
              redPainter = new DefaultHighlighter.DefaultHighlightPainter( Color.red );
              //  Set alignment to be centered for all paragraphs
              MutableAttributeSet standard = new SimpleAttributeSet();
              StyleConstants.setAlignment(standard, StyleConstants.ALIGN_CENTER);
              doc.setParagraphAttributes(0, 0, standard, true);
              //  Define a keyword attribute
              MutableAttributeSet keyWord = new SimpleAttributeSet();
              StyleConstants.setForeground(keyWord, Color.red);
              StyleConstants.setFontSize(keyWord, 24);
              StyleConstants.setStrikeThrough(keyWord, true);
              //  Define superscript attribute
              MutableAttributeSet superscript = new SimpleAttributeSet();
              StyleConstants.setSuperscript(superscript, true);
              //  Add initial text
              textPane.setText( "one\ntwo\nthree \nfour\nfive\nsix\nseven\neight\n" );
              //  Change attributes on some keywords
              doc.setCharacterAttributes(0, 3, keyWord, false);
              doc.setCharacterAttributes(20, 4, keyWord, false);
              //  Highlight some text
              try
                   textPane.getHighlighter().addHighlight( 4, 7, cyanPainter );
                   textPane.getHighlighter().addHighlight( 25, 28, cyanPainter );
                   textPane.getHighlighter().addHighlight( 35, 40, cyanPainter );
                   textPane.getHighlighter().addHighlight( 15, 20, redPainter );
              catch(BadLocationException ble) {}
              //  Add some text
              try
                   doc.insertString(0, "Start of text\n", null );
                   doc.insertString(doc.getLength(), "End of text\n", keyWord );
                   doc.insertString(doc.getLength(), "2", null );
                   doc.insertString(doc.getLength(), "1", superscript );
              catch(Exception e) {}
              //  Add text pane to frame
              scrollPane = new JScrollPane( textPane );
              scrollPane.setPreferredSize( new Dimension( 200, 200 ) );
    //          scrollPane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
              getContentPane().add( scrollPane );
              //  Create a Button panel
              JPanel buttons = new JPanel();
              getContentPane().add(buttons, BorderLayout.SOUTH);
              //  Add a Bold button
              JButton bold = new JButton( new StyledEditorKit.BoldAction() );
              buttons.add( bold );
              //  Add Right Alignment button
              JButton right = new JButton( new StyledEditorKit.AlignmentAction("Align Right", StyleConstants.ALIGN_RIGHT) );
              buttons.add( right );
              //  Add Remove Highlight button
              JButton remove = new JButton("Remove Highlight");
              buttons.add( remove );
              remove.addActionListener( new ActionListener()
                   public void actionPerformed(ActionEvent e)
                        int offset = textPane.getSelectionStart();
                        Highlighter.Highlight[] highlights = textPane.getHighlighter().getHighlights();
                        for (int i = 0; i < highlights.length; i++)
                             Highlighter.Highlight h = highlights;
                             DefaultHighlighter.DefaultHighlightPainter thePainter =
                                  (DefaultHighlighter.DefaultHighlightPainter)h.getPainter();
                             if (offset >= h.getStartOffset()
                             && offset <= h.getEndOffset())
                                  textPane.getHighlighter().removeHighlight(h);
         public static void main(String[] args)
              TextPaneAttributes frame = new TextPaneAttributes();
              frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
              frame.pack();
              frame.setVisible(true);

  • How to make one file?

    I have basically 2 problems here
    a)When I do generate a signature using the enduser's privatekey,,I will be ending up with two files one signature file and other the original document,,I need one file which contains the signature as well as the original doc in readable format and also i can authenticate doc using the same signature presemt in that file.
    b)In PKI scenario shud i encrypt the doc(data) without signature or shud i encrypt the doc as well as the signature also?
    c)If i have the signature as separate entity how can i find out publickey attributes or any information of the public key using the signature that is there?
    Plz do repond asap with exaples if possible,
    thnx in advnce
    Subhash

    Yup...I need one more help i.e I was able to encrypt/decrypt using assymtric and symetric,,the flow was like this...I had a key pair...
    I generate a DES key then I create a cipher by the data string,,then i used to encrypt the des key and store it in the database...then again at the server i used to decrypt the symmetric key using the private key from the key pair and then descrypt the data...it was all well and fine..
    now instaed of string i tried MSword of MSEXCELL i wasnt able to do at ll..some suggested to do padding so i tried des/cbc/pkcs5padding...it was encryting well but again i was stuck while decrypting,,it was asking for IV parametr and all,,i tried a lot but wasnt out of it...
    now my question is shud i include the getIv byte even in the encrypted file also...???
    i wud like to paste the code,,plz help me...
    encryption part is
    import java.io.*;
    import java.security.*;
    import java.security.spec.*;
    import java.security.spec.X509EncodedKeySpec;
    import java.security.interfaces.RSAPrivateKey;
    import java.security.interfaces.RSAPrivateCrtKey;
    import java.security.interfaces.RSAKey;
    import java.io.*;
    import java.util.*;
    import java.io.BufferedInputStream;
    import java.io.DataInputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.sql.*;
    import java.math.BigInteger;
    import java.security.cert.CertificateFactory;
    import java.security.cert.X509Certificate;
    import java.security.interfaces.RSAPrivateKey;
    import java.security.interfaces.RSAPublicKey;
    import java.security.Key;
    import java.security.KeyFactory;
    import java.security.Security;
    import java.security.spec.KeySpec;
    import java.security.spec.PKCS8EncodedKeySpec;
    import javax.crypto.Cipher;
    import javax.crypto.KeyGenerator;
    import javax.crypto.SecretKey;
    import javax.crypto.SecretKeyFactory;
    import javax.crypto.spec.DESKeySpec;
    import org.bouncycastle.jce.provider.BouncyCastleProvider;
    public class FileEncrypt
    byte[] encryptedDESKey;
    // encryptPart variables
    KeyGenerator kg;
    Key key;
    Cipher cipher;
    RSAPublicKey rsaPublicKey;
    Cipher encryptCipher;
    // decryptedPart variables
    RSAPrivateKey priv;
    Cipher decryptCipher;
    byte[] decryptedDESKey;
    SecretKeyFactory skf;
    DESKeySpec desKeySpec;
    SecretKey sk;
    Cipher desCipher;
    public static void main(String args[]){
         String path = "C://USB//test.doc";
         String fileName = "C://USB//ENCtest.doc";
    FileEncrypt pk1 = new FileEncrypt();
    String encryptedPassword = pk1.encryptPart(path,fileName);
         Connection con = null;
    Statement stmt = null;
    ResultSet rs = null;
    //XlEncrypt tt = new XlEncrypt();
    TxtFile profile = new TxtFile();
    try{
    DriverManager.registerDriver (profile.getDriver());
    con =DriverManager.getConnection (profile.getURLName(), profile.getUserName(), profile.getPassword());
    stmt = con.createStatement();
    con =DriverManager.getConnection (profile.getURLName(), profile.getUserName(), profile.getPassword());
    stmt = con.createStatement();
    stmt.executeUpdate("insert into test (pki) values('"+encryptedPassword+"')");
    }catch (SQLException e) {
    System.out.println (e.getMessage() + "Problem in getting connections");
    private String encryptPart(String path,String fileName){   
    Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
    try{
    // create des key
    kg = KeyGenerator.getInstance("DES");
    key = kg.generateKey();
    // encrypt some data
    //cipher = Cipher.getInstance("DES/ECB/PKCS5Padding");
    cipher = Cipher.getInstance("DES");
    cipher.init(Cipher.ENCRYPT_MODE,key);
    //read in cert from file and get public key and decrypt des key
    rsaPublicKey = getRSAPublicKey("buyer");
    encryptCipher= Cipher.getInstance("RSA","BC");
    encryptCipher.init(Cipher.ENCRYPT_MODE,rsaPublicKey);
    encryptedDESKey = encryptCipher.doFinal(key.getEncoded());
         FileEncrypt tt = new FileEncrypt();
    String sd = tt.hexEncode(encryptedDESKey);
    int c;
    FileInputStream fis = new FileInputStream(path);
    StringBuffer fileBuffer = new StringBuffer();
    while((c=fis.read())!=-1){
    fileBuffer.append((char)c);
    String fileString = fileBuffer.toString();
    byte[] encword = cipher.doFinal(fileString.getBytes());
    String outFile = tt.hexEncode(encword);
    DataOutputStream out2 = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(fileName)));
    out2.writeBytes(outFile);
    out2.close();
    return sd;
    }catch(Exception e)
    System.out.println("<ERROR>\nIn encryptPart\n"+e.toString()+"\n</ERROR>");
    return null;
    /** This array is used to convert from bytes to hexadecimal numbers */
    static final char[] digits = { '0', '1', '2', '3', '4', '5', '6', '7',
    '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
    * A convenience method to convert an array of bytes to a String. We do
    * this simply by converting each byte to two hexadecimal digits. Something
    * like Base 64 encoding is more compact, but harder to encode.
    public static String hexEncode(byte[] bytes) {
    StringBuffer s = new StringBuffer(bytes.length * 2);
    for(int i = 0; i < bytes.length; i++) {
    byte b = bytes;
    s.append(digits[(b & 0xf0) >> 4]);
    s.append(digits[b & 0x0f]);
    return s.toString();
    * A convenience method to convert in the other direction, from a string
    * of hexadecimal digits to an array of bytes.
    public static byte[] hexDecode(String s) throws IllegalArgumentException {
    try {
    int len = s.length();
    byte[] r = new byte[len/2];
    for(int i = 0; i < r.length; i++) {
    int digit1 = s.charAt(i*2), digit2 = s.charAt(i*2 + 1);
    if ((digit1 >= '0') && (digit1 <= '9')) digit1 -= '0';
    else if ((digit1 >= 'a') && (digit1 <= 'f')) digit1 -= 'a' - 10;
    if ((digit2 >= '0') && (digit2 <= '9')) digit2 -= '0';
    else if ((digit2 >= 'a') && (digit2 <= 'f')) digit2 -= 'a' - 10;
    r[i] = (byte)((digit1 << 4) + digit2);
    return r;
    catch (Exception e) {
    throw new IllegalArgumentException("hexDecode(): invalid input");
    // encryptPart private method
    private RSAPublicKey getRSAPublicKey(String userName){
    try{
    FileInputStream fis = new FileInputStream("C:/certificates/buyer/buyer.crt");
    BufferedInputStream bis = new BufferedInputStream(fis);
    CertificateFactory cf = CertificateFactory.getInstance("X.509");
    X509Certificate cert = null;
    while(bis.available() > 0){
    cert = (X509Certificate)cf.generateCertificate(bis);
    return (RSAPublicKey)cert.getPublicKey();
    catch(Exception e){
    System.out.println("<ERROR>\nTrying to get Public Key from cert\n"+e.toString()+"\n</ERROR>");
    return null;
    decryption part is
    import java.io.*;
    import java.security.*;
    import java.security.spec.*;
    import java.security.spec.X509EncodedKeySpec;
    import java.security.interfaces.RSAPrivateKey;
    import java.security.interfaces.RSAPrivateCrtKey;
    import java.security.interfaces.RSAKey;
    import java.io.*;
    import java.util.*;
    import java.io.BufferedInputStream;
    import java.io.DataInputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.sql.*;
    import java.math.BigInteger;
    import java.security.cert.CertificateFactory;
    import java.security.cert.X509Certificate;
    import java.security.interfaces.RSAPrivateKey;
    import java.security.interfaces.RSAPublicKey;
    import java.security.Key;
    import java.security.KeyFactory;
    import java.security.Security;
    import java.security.spec.KeySpec;
    import java.security.spec.PKCS8EncodedKeySpec;
    import javax.crypto.Cipher;
    import javax.crypto.KeyGenerator;
    import javax.crypto.SecretKey;
    import javax.crypto.SecretKeyFactory;
    import javax.crypto.spec.DESKeySpec;
    import java.io.*;
    import javax.crypto.*;
    import javax.crypto.spec.*;
    import java.security.*;
    import java.security.spec.*;
    import org.bouncycastle.jce.provider.BouncyCastleProvider;
    public class FileDecrypt
    byte[] encryptedDESKey;
    // encryptPart variables
    KeyGenerator kg;
    Key key;
    Cipher cipher;
    RSAPublicKey rsaPublicKey;
    Cipher encryptCipher;
    // decryptedPart variables
    RSAPrivateKey priv;
    Cipher decryptCipher;
    byte[] decryptedDESKey;
    SecretKeyFactory skf;
    DESKeySpec desKeySpec;
    SecretKey sk;
    Cipher desCipher;
    public static void main(String args[]){
         String inputFile = "C://Usb//ENCtest.doc";
         Connection con = null;
    Statement stmt = null;
    ResultSet rs = null;
         TxtFile profile = new TxtFile();
         String var="";
         try {
    DriverManager.registerDriver (profile.getDriver());
    con =DriverManager.getConnection (profile.getURLName(), profile.getUserName(), profile.getPassword());
    stmt = con.createStatement();
    con =DriverManager.getConnection (profile.getURLName(), profile.getUserName(), profile.getPassword());
    stmt = con.createStatement();
    rs = stmt.executeQuery("select pki from test");
    if(rs.next()){
    var = rs.getString("pki");
    }catch (SQLException e) {
    System.out.println (e.getMessage() + "Problem in getting connections");
         System.out.println(var);
         String encSymKey = var;
         FileDecrypt tpk = new FileDecrypt();
    String decryptedPassword = tpk.decryptPart(inputFile,encSymKey);
    //return decryptedPassword;     
    private String decryptPart(String inputFile,String encSymKey)
    try{   
    // get private key from file
    priv = getRSAPrivateKey();
    // decrypted des key
    int c;
    Security.addProvider(new BouncyCastleProvider());
    FileDecrypt t1 = new FileDecrypt();
    byte[] encryptedDESKey1 = t1.hexDecode(encSymKey);
    decryptCipher = Cipher.getInstance("RSA","BC");
    decryptCipher.init(Cipher.DECRYPT_MODE,priv);
    decryptedDESKey = decryptCipher.doFinal(encryptedDESKey1);
    // convert bytes back to des key
    skf = SecretKeyFactory.getInstance("DES");
    desKeySpec = new DESKeySpec(decryptedDESKey);
    sk = skf.generateSecret(desKeySpec);
    // decrypt the encrypted password
    //desCipher = desCipher.getInstance("DES/ECB/PKCS5Padding");
    desCipher = desCipher.getInstance("DES");
                   desCipher.init(Cipher.DECRYPT_MODE,sk);     
    //desCipher.init(Cipher.DECRYPT_MODE,sk);
    FileDecrypt obj1 = new FileDecrypt();
    FileInputStream fis = new FileInputStream(inputFile);
    StringBuffer encryptedFile = new StringBuffer();
    while((c=fis.read())!=-1){
    encryptedFile.append((char)c);
    String encFile = encryptedFile.toString();
    System.out.println(encFile);
    byte[] jk =obj1.hexDecode(encFile);
    String encVar = new String(desCipher.doFinal(jk));
    //String encVar = new String(desCipher.doFinal(jk));
    DataOutputStream out2 = new DataOutputStream(new BufferedOutputStream(new FileOutputStream("C:/usb/dectest.doc")));
    out2.writeBytes(encVar);
    out2.close();
    //System.out.println(new String(desCipher.doFinal(jk)));
    return new String("subhash");
    }catch(Exception e){
    System.out.println("<ERROR>\nIn decryptPart\n"+e.toString()+"\n</ERROR>");
    return null;
    // decryptPart private method
    private RSAPrivateKey getRSAPrivateKey()
    try{
    File keyFile = new File("C:/certificates/buyer/buyerkey.der");
    DataInputStream in = new DataInputStream(new FileInputStream(keyFile));
    byte [] fileBytes = new byte[(int) keyFile.length()];
    in.readFully(fileBytes);
    in.close();
    KeyFactory kf = KeyFactory.getInstance("RSA");
    KeySpec ks = new PKCS8EncodedKeySpec(fileBytes);
    return (RSAPrivateKey)kf.generatePrivate(ks);
    }catch(Exception e){
    System.out.println("<ERROR>\nTrying to get Private Key from file\n"+e.toString()+"\n</ERROR>");
    return null;
    /** This array is used to convert from bytes to hexadecimal numbers */
    static final char[] digits = { '0', '1', '2', '3', '4', '5', '6', '7',
    '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
    * A convenience method to convert an array of bytes to a String. We do
    * this simply by converting each byte to two hexadecimal digits. Something
    * like Base 64 encoding is more compact, but harder to encode.
    public static String hexEncode(byte[] bytes) {
    StringBuffer s = new StringBuffer(bytes.length * 2);
    for(int i = 0; i < bytes.length; i++) {
    byte b = bytes[i];
    s.append(digits[(b & 0xf0) >> 4]);
    s.append(digits[b & 0x0f]);
    return s.toString();
    * A convenience method to convert in the other direction, from a string
    * of hexadecimal digits to an array of bytes.
    public static byte[] hexDecode(String s) throws IllegalArgumentException {
    try {
    int len = s.length();
    byte[] r = new byte[len/2];
    for(int i = 0; i < r.length; i++) {
    int digit1 = s.charAt(i*2), digit2 = s.charAt(i*2 + 1);
    if ((digit1 >= '0') && (digit1 <= '9')) digit1 -= '0';
    else if ((digit1 >= 'a') && (digit1 <= 'f')) digit1 -= 'a' - 10;
    if ((digit2 >= '0') && (digit2 <= '9')) digit2 -= '0';
    else if ((digit2 >= 'a') && (digit2 <= 'f')) digit2 -= 'a' - 10;
    r[i] = (byte)((digit1 << 4) + digit2);
    return r;
    }catch (Exception e) {
    throw new IllegalArgumentException("hexDecode(): invalid input");
    plz do reply asap,,
    bye
    Subhash

  • Sending a dom via http Post

    Hi,
    for some reason unknown to me whenever I try to send a dom via http Post I get the following error:
    org.xml.sax.SAXParseException: The root element is required in a well-formed document.
    This is the source code:
    package com.cyberrein.payunion.transaction;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    //xml lib
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    //weblogic xml lib
    import weblogic.apache.xerces.dom.DocumentImpl;
    import weblogic.apache.xml.serialize.DOMSerializer;
    import weblogic.apache.xml.serialize.XMLSerializer;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    public class Xmltest extends HttpServlet {
    //Initialize global variables
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    //Process the HTTP Request
    public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // Retrieve transaction data from HttpServletRequest.
    try {
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    dbf.setValidating(false);
    DocumentBuilder db = dbf.newDocumentBuilder();
    Document docIn = db.parse(request.getInputStream());
    String code = "XX";
    String tranID = "000000";
    String message = "This Card Is Invalid. Transaction Discontinued";
    //Output dom
    Document docOut = new DocumentImpl();
    Element e = (Element)docOut.createElement("TransactionResponseData");
    e.setAttribute("Code", code);
    e.setAttribute("TransactionID", tranID);
    e.setAttribute("Message", message);
    docOut.appendChild(e);
    FileOutputStream fos;
    fos = new FileOutputStream("/victory");
    DOMSerializer serX = new XMLSerializer(fos,null);
    serX.serialize(docIn);
    DOMSerializer ser = new XMLSerializer(response.getOutputStream(), null);
         ser.serialize(docOut);
         } catch (Throwable e) {e.printStackTrace();}
    //Get Servlet information
    public String getServletInfo() {
    return "com.cyberrein.payunion.transaction.Xmltest Information";
    package com.cyberrein.payunion.transaction;
    import org.w3c.dom.*;
    import org.apache.xerces.*;
    import org.apache.xerces.dom.*;
    import org.apache.xerces.parsers.*;
    import org.apache.xml.serialize.*;
    import org.xml.sax.*;
    import java.net.*;
    import java.io.*;
    public class CardClient {
    private String sURI;
    public BufferedReader in
    = new BufferedReader(new InputStreamReader(System.in));
    public CardClient(String serverURI) {
    sURI = serverURI;
    public Document test(){
    Document docIn = null;
    try
    //XML Document impl
         docIn = new DocumentImpl();
    //Create the root element
         Element t = docIn.createElement("TransactionData");
    Element k = docIn.createElement("Payunion.com");
    k.appendChild( docIn.createTextNode("North American server") );
    t.appendChild(k);
    //Set attributes
    t.setAttribute("cardnumber", "4444444444444444");
    t.setAttribute("amount", "3000.67");
    t.setAttribute("name", "tolu agbeja");
    t.setAttribute("cvv2", "001");
    t.setAttribute("pu_number", "ejs:pupk:23456");
    t.setAttribute("expirydate", "0903");
    t.setAttribute("address", "100 peachtree industrial");
    t.setAttribute("zipcode", "30329");
    docIn.appendChild(t);
    catch (Throwable te)
    te.printStackTrace();
    return docIn;
    public Document sendRequest(Document doc) {
         Document docOut = null;
         try {
         URL url = new URL("http://" + sURI);
         HttpURLConnection conn = (HttpURLConnection) url.openConnection();
    conn.setRequestMethod("POST");
         conn.setDoInput(true);
         conn.setDoOutput(true);
         OutputStream out = conn.getOutputStream();
    BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
    XMLSerializer ser = new XMLSerializer( out, new OutputFormat("xml", "UTF-8", false) );
    ser.serialize(doc);
    while(!br.ready()){}
         DOMParser parser = new DOMParser();
         parser.parse(new InputSource(br));
         docOut = parser.getDocument();
    catch (Throwable et)
         et.printStackTrace();
         return docOut;
    public static void main(String []args)
    CardClient c = new CardClient("cyber1:7001/xmltest");
    try
    Document doc = c.sendRequest(c.test());
    Element responseMessage = (Element)doc.getElementsByTagName("TransactionResponseData").item(0);
    String message = responseMessage.getAttribute("Message");
    String tranID = responseMessage.getAttribute("TransactionID");
    String code = responseMessage.getAttribute("Code");
    System.out.println(message);
    System.out.println("");
    System.out.println("The Response Code Is: "+code);
    System.out.println("");
    System.out.println("The Transaction ID Is: "+tranID);
    catch(Exception ex)
    ex.printStackTrace();
    All comments will be appreciated!!

    Hi, thanks for your reply i knew the FileUplaod was the way forward.
    I read topics advising to use the FileUpload and tried the following but it did not seem to work ( i get an HTTP Internal Server error when i try that):
    try
    DiskFileUpload upload = new DiskFileUpload();
    boolean isMultipart = FileUpload.isMultipartContent(request);
    if( isMultipart )
    List items = upload.parseRequest( request );
    Iterator iter = items.iterator();
    while( iter.hasNext() )
    FileItem fileItem = ( FileItem ) iter.next();
    File uploadedFile = new File("myreceivedfile.zip");
    fileItem.write( uploadedFile );
    }catch (Exception e)
    System.out.println("RECEIVER: " + e.getMessage());
    Also DiskFileUpload,isMultipartContent and parseRequest have a line going through the middle (horizontal middle).
    Edited by: Overmars08 on Jun 23, 2009 5:35 AM
    Edited by: Overmars08 on Jun 23, 2009 5:36 AM

  • Java.lang.ClassNotFoundException: oracle.xml.parser.v2.XMLParseException

    Hi there Masters
    I am new in Java and I would need your help please..
    I am calling a function in Java passing 1 parameter and returning an XML back but at the point of execution I get an error below... At the end I have attached my java code...PLEASE HELP
    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/xml/parser/v2/XMLParseException
         at oracle.xdb.XMLTypeFactory.create(XMLTypeFactory.java:78)
         at oracle.sql.OPAQUE.toClass(OPAQUE.java:328)
         at oracle.sql.OPAQUE.toJdbc(OPAQUE.java:278)
         at oracle.sql.OPAQUE.toJdbc(OPAQUE.java:259)
         at oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:190)
         at oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:117)
         at oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:1578)
         at oracle.jdbc.driver.OracleCallableStatementWrapper.getObject(OracleCallableStatementWrapper.java:815)
         at hospitaltool.RunAsnIn.runAsnIn(RunAsnIn.java:41)
         at hospitaltool.HospitalTool.main(HospitalTool.java:38)
    Caused by: java.lang.ClassNotFoundException: oracle.xml.parser.v2.XMLParseException
         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
         ... 10 more
    =====================JAVA CODE====================================
    package hospitaltool;
    import java.sql.*;
    import oracle.jdbc.*;
    import oracle.xdb.XMLType;
    public class RunAsnIn {
    public void runAsnIn(Connection con, Boolean fam) throws SQLException {
    System.out.println("RunASNIn Section");
    String messStatus;
    int numRecs = 0; //to hold the number of Records processed
    int totRecs = 0; //to hold the number of total records processed
    ResultSet rs = null;
    Statement stmt = null;
    stmt = con.createStatement();
    //Delete all already caused messages
    try {
    rs = stmt.executeQuery("DELETE FROM asnin WHERE message_num IN(SELECT message_num FROM asnin MINUS SELECT message_num FROM hospital WHERE family = 'ASNIn')");
    //Select all the uncaused messages
    rs = stmt.executeQuery("SELECT message_num FROM hospital WHERE family = 'ASNIn' and rownum <= 1 MINUS SELECT message_num FROM asnin");
    //Go thru the uncaused messages
    } catch (Exception e) {
    while (rs.next()) {
    String messageNum = rs.getString(1);
    // System.out.println("tableName=" + messageNum);
    System.out.println(messageNum);
    //Get the XMLDoc
    XMLType xml = null;
    //Get the XML Doc
    CallableStatement cs1 = null;
    //CallableStatement proc = con.prepareCall("? {call rmsauto.hospitaltool.getmessagedoc(?)}");
    try {
    cs1 = con.prepareCall("{? = call rmsauto.hospitaltool.getmessagedoc(?)}");
    cs1.registerOutParameter(1, OracleTypes.OPAQUE, "SYS.XMLTYPE");
    cs1.setString(2, messageNum);
    cs1.execute();
    } catch (Exception e) {
    xml = (XMLType) cs1.getObject(1);
    System.out.println(xml.getStringVal());
    }

    I did google this and found that I needed a specific jar file called xmlparserv2.jar and I did download it and loaded it on as part of my Libraries the I got a new error... I am using NetBeans
    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/xml/binxml/BinXMLMetadataProvider
         at oracle.xdb.XMLTypeFactory.create(XMLTypeFactory.java:78)
         at oracle.sql.OPAQUE.toClass(OPAQUE.java:328)
         at oracle.sql.OPAQUE.toJdbc(OPAQUE.java:278)
         at oracle.sql.OPAQUE.toJdbc(OPAQUE.java:259)
         at oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:190)
         at oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:117)
         at oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:1578)
         at oracle.jdbc.driver.OracleCallableStatementWrapper.getObject(OracleCallableStatementWrapper.java:815)
         at hospitaltool.RunAsnIn.runAsnIn(RunAsnIn.java:41)
         at hospitaltool.HospitalTool.main(HospitalTool.java:38)
    Caused by: java.lang.ClassNotFoundException: oracle.xml.binxml.BinXMLMetadataProvider
         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
         ... 10 more
    Java Result: 1

  • XML over HTTP

    Hi,
    I found the code below in the question of the week archive (http://developer.java.sun.com/developer/qow/archive/84/) and was wondering could anyone tell me what I need to do to get it running. I have JDK1.3, the xerces parser and Tomcat.
    It's a basic Java technology framework for getting an applet to send an XML message (Document) to a Servlet, and get another XML message (Document) back in response.
    import org.w3c.dom.*;
    import org.apache.xerces.*;
    import org.apache.xerces.dom.*;
    import org.apache.xerces.parsers.*;
    import org.apache.xml.serialize.*;
    import org.xml.sax.*;
    import java.net.*;
    import java.io.*;
    class XmlBridge {  
    private String sURI;
    public XmlBridge(String serverURI) {      
         sURI = serverURI;
    public Document sendRequest(Document doc) {
         Document docOut = null;      
         try {
         URL url = new URL("http://" + sURI);
         HttpURLConnection conn =
         (HttpURLConnection)
         url.openConnection();
         conn.setDoInput(true);
         conn.setDoOutput(true);
         OutputStream out =
         conn.getOutputStream();
         XMLSerializer ser =
              new XMLSerializer(out,
              new OutputFormat("xml",
              "UTF-8", false));
         ser.serialize(doc);
         out.close();
         DOMParser parser = new DOMParser();
         parser.parse(new
         InputSource(conn.getInputStream()));
         docOut = parser.getDocument();
         } catch (Throwable e) {
         e.printStackTrace();
         return docOut;
    public static void main(String[] args) {
         try {  // Build up an XML Document
         Document docIn = new DocumentImpl();
         Element e =
         docIn.createElement("Order");
         e.appendChild(docIn.createElement(
         "Type"));
         e.appendChild(docIn.createElement(
         "Amount"));
         docIn.appendChild(e);
         // Send it to the Servlet
         XmlBridge a =
         new XmlBridge(args[0]);
         Document docOut =
         a.sendRequest(docIn);
         // Debug - write the sent
         //Document to stdout
         XMLSerializer ser =
         new XMLSerializer(System.out,
         null);
         ser.serialize(docOut);
         } catch (Throwable e) {
         e.printStackTrace();
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import org.w3c.dom.*;
    import org.xml.sax.*;
    import org.apache.xerces.*;
    import org.apache.xerces.dom.*;
    import org.apache.xerces.parsers.*;
    import org.apache.xml.serialize.*;
    public abstract class XmlServlet
    extends GenericServlet {    
    protected abstract Document
    doRequest(Document req);
    public XmlServlet() {}
    public void service(ServletRequest
    req, ServletResponse res)
    throws ServletException {
         try {
         DOMParser parser =
         new DOMParser();
         parser.parse(new InputSource(
         req.getInputStream()));
         Document docOut =
         doRequest(
         parser.getDocument());
         XMLSerializer ser =
              new XMLSerializer(
              res.getOutputStream(),
              new OutputFormat("xml",
              "UTF-8", false));
         ser.serialize(docOut);     
         res.getOutputStream().close();
         } catch (Throwable e) {        
         e.printStackTrace();

    Check out JDOM, it's gonna be rolled into the core Java soon, see the link below:
    http://www.jdom.org
    It's very cool and simplifies just about everything to do with XML...
    You can then write an XML file to a HTTP connection easily...and have the other end read it in easily...

  • SAXParseException from parser.parse()

    Hi,
    I am using xml on http sample code with xerces-123 and I get I get
    "SAXParseException: The root element is required in a well-formed document."
    on the parser.parse(...) line. Yes, the XML is well-formed. I also try to
    use a well-formated xml file, but that exception is still there.
    import org.w3c.dom.*;
    import org.apache.xerces.*;
    import org.apache.xerces.dom.*;
    import org.apache.xerces.parsers.*;
    import org.apache.xml.serialize.*;
    import org.xml.sax.*;
    import java.net.*;
    import java.io.*;
    class XmlBridge {
    private String sURI;
    public XmlBridge(String serverURI) {
    sURI = serverURI;
    public Document sendRequest(Document doc) {
    Document docOut = null;
    try {
    URL url = new URL("http://" + sURI);
    HttpURLConnection conn =
    (HttpURLConnection)
    url.openConnection();
    conn.setDoInput(true);
    conn.setDoOutput(true);
    OutputStream out =
    conn.getOutputStream();
    XMLSerializer ser =
    new XMLSerializer(out,
    new OutputFormat("xml",
    "UTF-8", false));
    ser.serialize(doc);
    out.close();
    DOMParser parser = new DOMParser();
    parser.parse(new
    InputSource(conn.getInputStream()));
    docOut = parser.getDocument();
    } catch (Throwable e) {
    e.printStackTrace();
    return docOut;
    public static void main(String[] args) {
    try {  // Build up an XML Document
    Document docIn = new DocumentImpl();
    Element e =
    docIn.createElement("Order");
    e.appendChild(docIn.createElement(
    "Type"));
    e.appendChild(docIn.createElement(
    "Amount"));
    docIn.appendChild(e);
    // Send it to the Servlet
    XmlBridge a =
    new XmlBridge(args[0]);
    Document docOut =
    a.sendRequest(docIn);
    // Debug - write the sent
    //Document to stdout
    XMLSerializer ser =
    new XMLSerializer(System.out,
    null);
    ser.serialize(docOut);
    } catch (Throwable e) {
    e.printStackTrace();
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import org.w3c.dom.*;
    import org.xml.sax.*;
    import org.apache.xerces.*;
    import org.apache.xerces.dom.*;
    import org.apache.xerces.parsers.*;
    import org.apache.xml.serialize.*;
    public abstract class XmlServlet
    extends GenericServlet {
    protected abstract Document
    doRequest(Document req);
    public XmlServlet() {}
    public void service(ServletRequest
    req, ServletResponse res)
    throws ServletException {
    try {
    DOMParser parser =
    new DOMParser();
    //problem here
    parser.parse(new InputSource(
    req.getInputStream()));
    Document docOut =
    doRequest(
    parser.getDocument());
    XMLSerializer ser =
    new XMLSerializer(
    res.getOutputStream(),
    new OutputFormat("xml",
    "UTF-8", false));
    ser.serialize(docOut);
    res.getOutputStream().close();
    } catch (Throwable e) {
    e.printStackTrace();
    I use VCafe to bebug the xmlservlet. For some reason in line
    parser.parse(new InputSource(req.getInputStream())), parse() method is
    frozen and stop running. Is anyone has some solution or experience on this
    problem. Any help will be appreciated.
    DJ

    I fix this problem by upgrade to sp8. But why?
    "Cameron Purdy" <[email protected]> wrote in message
    news:[email protected]...
    1. It will freeze if it can't read from the input stream. Read is a
    blocking call.
    2. It may be in your code since it calls you for each piece. Use
    Ctrl-Break to get a thread dump (kill -3 on Unix).
    Cameron Purdy
    Tangosol, Inc.
    http://www.tangosol.com
    +1.617.623.5782
    WebLogic Consulting Available
    "David Jian" <[email protected]> wrote in message
    news:[email protected]...
    Hi,
    I am using xml on http sample code with xerces-123 and I get I get
    "SAXParseException: The root element is required in a well-formeddocument."
    on the parser.parse(...) line. Yes, the XML is well-formed. I also try
    to
    use a well-formated xml file, but that exception is still there.
    import org.w3c.dom.*;
    import org.apache.xerces.*;
    import org.apache.xerces.dom.*;
    import org.apache.xerces.parsers.*;
    import org.apache.xml.serialize.*;
    import org.xml.sax.*;
    import java.net.*;
    import java.io.*;
    class XmlBridge {
    private String sURI;
    public XmlBridge(String serverURI) {
    sURI = serverURI;
    public Document sendRequest(Document doc) {
    Document docOut = null;
    try {
    URL url = new URL("http://" + sURI);
    HttpURLConnection conn =
    (HttpURLConnection)
    url.openConnection();
    conn.setDoInput(true);
    conn.setDoOutput(true);
    OutputStream out =
    conn.getOutputStream();
    XMLSerializer ser =
    new XMLSerializer(out,
    new OutputFormat("xml",
    "UTF-8", false));
    ser.serialize(doc);
    out.close();
    DOMParser parser = new DOMParser();
    parser.parse(new
    InputSource(conn.getInputStream()));
    docOut = parser.getDocument();
    } catch (Throwable e) {
    e.printStackTrace();
    return docOut;
    public static void main(String[] args) {
    try {  // Build up an XML Document
    Document docIn = new DocumentImpl();
    Element e =
    docIn.createElement("Order");
    e.appendChild(docIn.createElement(
    "Type"));
    e.appendChild(docIn.createElement(
    "Amount"));
    docIn.appendChild(e);
    // Send it to the Servlet
    XmlBridge a =
    new XmlBridge(args[0]);
    Document docOut =
    a.sendRequest(docIn);
    // Debug - write the sent
    //Document to stdout
    XMLSerializer ser =
    new XMLSerializer(System.out,
    null);
    ser.serialize(docOut);
    } catch (Throwable e) {
    e.printStackTrace();
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import org.w3c.dom.*;
    import org.xml.sax.*;
    import org.apache.xerces.*;
    import org.apache.xerces.dom.*;
    import org.apache.xerces.parsers.*;
    import org.apache.xml.serialize.*;
    public abstract class XmlServlet
    extends GenericServlet {
    protected abstract Document
    doRequest(Document req);
    public XmlServlet() {}
    public void service(ServletRequest
    req, ServletResponse res)
    throws ServletException {
    try {
    DOMParser parser =
    new DOMParser();
    //problem here
    parser.parse(new InputSource(
    req.getInputStream()));
    Document docOut =
    doRequest(
    parser.getDocument());
    XMLSerializer ser =
    new XMLSerializer(
    res.getOutputStream(),
    new OutputFormat("xml",
    "UTF-8", false));
    ser.serialize(docOut);
    res.getOutputStream().close();
    } catch (Throwable e) {
    e.printStackTrace();
    I use VCafe to bebug the xmlservlet. For some reason in line
    parser.parse(new InputSource(req.getInputStream())), parse() method is
    frozen and stop running. Is anyone has some solution or experience onthis
    problem. Any help will be appreciated.
    DJ

Maybe you are looking for

  • Error in opening reports in OBIEE

    We are getting this error when opening reports in OBIEE State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. Unable to find library 'libclntsh.so.9.0'. [nQSError: 46029] Failed to load the DLL /u01/ap

  • Error message in Selection Screen

    Hi reference no (p_ref) is in my selection screen. If this field contains special characters (\ / : * ? " |, ) system must prompt  error message in selection screen. How to do this. Pls help me Regards Anbu

  • Why we need Custom controllers in Model Applications

    Hi Friends In Adaptive RFC Model Application we can use both the controllers for creating contex structure wat is the main aim for using custom controller it has any special feature in custom conrollers i read both the controllers have same functiona

  • Adobe Premiere CS6 'Create new Trimmed Project' Crash with .MXF files

    Yesterday I started to back up all our students work, and found that the "Create New Trimmed Project" no longer works in CS6 with .MFX files. Adobe Premiere CS6.0.3,  crashes when I try to "Create New Trimmed Project" under "Project Manager" This onl

  • How do I load extracted contacts to my iPhone?

    I load all my personal contacts because ones at work were sync'ed to my iPhone 5s.  I bought a program from iPubsoft to extract contacts from my iPhone.  I put the extract file into an html file.  How can I load this structure .html file back to my i