A ChangeListener on a javabean with a JSlider

I'm trying to figure out event handling. ColorSelector and LabelSliderText are beans.
There are two instances of the ColorSelector bean in my JFrame, "foreground" and "background".
Whenever a slider is moved, that LabelSliderText instance will print out the value to the console. The problem with that is that there are six sliders, three in each ColorSelector.
What I really want to do is for each ColorSelector to grab the red, green, blue values from its LabelSliderText instances in order to create a Color. I'm thinking that this should occur not in LabelSliderText, where the listener is now, but in ColorSelector so that it can listen to its own beans.
How do these two beans interact? I want to put a listener on the JSlider, but not from LabelSliderText but actually from LabelSliderText, I think. Does this make sense?
I'm not quite sure how to move the listener from LabelSliderText to ColorSelector, if that would accomplish the purpose of grabbing the RGB values to create a Color.
thufir@arrakis:~/bcit3621$
thufir@arrakis:~/bcit3621$ cat lab2/src/a00720398/util/LabelSliderText.java
package a00720398.util;
public class LabelSliderText extends javax.swing.JPanel {
    /** Creates new form LabelSliderText */
    public LabelSliderText() {
        initComponents();
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
    private void initComponents() {//GEN-BEGIN:initComponents
bindingGroup = new org.jdesktop.beansbinding.BindingGroup();
jLabel1 = new javax.swing.JLabel();
jSlider1 = new javax.swing.JSlider();
jTextField1 = new javax.swing.JTextField();
setAutoscrolls(true);
jLabel1.setText("RGB");
add(jLabel1);
jSlider1.setMaximum(255);
jSlider1.setValue(0);
jSlider1.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
sliderMoved(evt);
        add(jSlider1);
        jTextField1.setMinimumSize(new java.awt.Dimension(600, 29));
        org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, jSlider1, org.jdesktop.beansbinding.ELProperty.create("${value}"), jTextField1, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);
        add(jTextField1);
        bindingGroup.bind();
    }//GEN-END:initComponents
    private void sliderMoved(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_sliderMoved
System.out.println(jSlider1.getValue());
}//GEN-LAST:event_sliderMoved
    public void setLabelText(String string){
        jLabel1.setText(string);
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JSlider jSlider1;
    private javax.swing.JTextField jTextField1;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration//GEN-END:variables
thufir@arrakis:~/bcit3621$
thufir@arrakis:~/bcit3621$ cat lab2/src/a00720398/util/ColorSelector.java
package a00720398.util;
public class ColorSelector extends javax.swing.JPanel {
    /** Creates new form ColorSelector */
    public ColorSelector() {
        initComponents();
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
    private void initComponents() {//GEN-BEGIN:initComponents
red = new a00720398.util.LabelSliderText();
green = new a00720398.util.LabelSliderText();
blue = new a00720398.util.LabelSliderText();
setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.Y_AXIS));
red.setLabelText("red");
add(red);
green.setLabelText("green");
add(green);
blue.setLabelText("blue");
add(blue);
}//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private a00720398.util.LabelSliderText blue;
    private a00720398.util.LabelSliderText green;
    private a00720398.util.LabelSliderText red;
    // End of variables declaration//GEN-END:variables
thufir@arrakis:~/bcit3621$ thanks,
Thufir

I think that I'm missing an ActionEvent, but maybe not.
/** handling of Customizer GUI actions */
   public void actionPerformed(ActionEvent e) {
     if (e.getSource()==applyButton) {
       myJavaBeanObj.setBlah(blahTextField.getText());
       support.firePropertyChange("blah",null,null);
   }The constructor you describe throws me off a bit. Does it matter that the listener is added from initComponents()? I don't see that it really would, but perhaps there's a subtlety I'm not seeing.
* LabelSliderText.java
* Created on July 13, 2008, 1:15 AM
package a00720398.util;
* @author  thufir
public class LabelSliderText extends javax.swing.JPanel {
    /** Creates new form LabelSliderText */
    public LabelSliderText() {
        initComponents();
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
    private void initComponents() {
        jLabel1 = new javax.swing.JLabel();
        jSlider1 = new javax.swing.JSlider();
        jTextField1 = new javax.swing.JTextField();
        setLayout(new java.awt.GridBagLayout());
        jLabel1.setText("jLabel1");
        add(jLabel1, new java.awt.GridBagConstraints());
        jSlider1.setMaximum(250);
        jSlider1.setValue(0);
        jSlider1.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                LabelSliderText.this.stateChanged(evt);
        /* post listener */
        add(jSlider1, new java.awt.GridBagConstraints());
        jTextField1.setText("jTextField1");
        add(jTextField1, new java.awt.GridBagConstraints());
    private void stateChanged(javax.swing.event.ChangeEvent evt) {
        getValue();
    public void setLabel(String string){
        jLabel1.setText(string);
    public int getValue(){
        return jSlider1.getValue();
    public void setValue(){
        //throw new UnsupportedOperationException("Not supported yet.");
        jSlider1.setValue(0);
    // Variables declaration - do not modify
    private javax.swing.JLabel jLabel1;
    private javax.swing.JSlider jSlider1;
    private javax.swing.JTextField jTextField1;
    // End of variables declaration
package a00720398.util;
import java.awt.*;
import javax.swing.event.*;
public class ColorChooser extends javax.swing.JPanel implements ChangeListener {
    private Color color = new Color(0, 0, 0);
    public ColorChooser() {
        initComponents();
    private void initComponents() {
        red = new a00720398.util.LabelSliderText();
        green = new a00720398.util.LabelSliderText();
        blue = new a00720398.util.LabelSliderText();
        setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.Y_AXIS));
        red.setLabel("red       ");
        add(red);
        green.setLabel("green     ");
        add(green);
        blue.setLabel("blue      ");
        add(blue);
    public void stateChanged(ChangeEvent evt) {
        sliderMoved(evt);
    private void sliderMoved(ChangeEvent evt) {
        color = new Color (red.getValue(), green.getValue(), blue.getValue());
        System.out.println(color);
    // Variables declaration - do not modify
    private a00720398.util.LabelSliderText blue;
    private a00720398.util.LabelSliderText green;
    private a00720398.util.LabelSliderText red;
    // End of variables declaration
}Thanks,
Thufir

Similar Messages

  • How to use a JavaBean with request scope from one page to other page

    Hi,
    I want to use in one jsp file a javabean with scope of request for it, I use:
       <jsp:useBean id="entry" class="jsps.SaleEntry" scope="request" />and after in that page I make operations with it using the jsp:setProperty and jsp:getProperty operations
    My question is that if I want to get the result of that javabean in the following page, Have I to record the javabean doing : request.setAttribute(""objectId",id) and then in the following jsp page I can rescue the object doing: SaleEntry sE=(SaleEntry) request.getAttribute("objectId") ???
    or in the contrary, only using jsp:setProperty the information is available to recover it in the following jsp doing : SaleEntry sE=(SaleEntry) request.getAttribute("objectId") because setProperty records the information without need of doing : request.setAttribute(""objectId",id). ????
    Thanks with anticipation and sorry if it is a silly question but I am beginner in the use of JavaBeans

    Thanks Anthony,
    I'm working with Tigi on the same project and now I can tell you that the problem is solved.
    request.getRequestDisptacher("/myServlet");hehe, you switched the 't' and the 'a'
    <%@ include file="/myServlet" %>this is the one we use :)
    But what is the difference between the first one and the last one? Now We are using the last one because that's the shortest :) not a pretty good reason huh :)
    cheers,
    Soep

  • Issue JavaBeans with Forms

    Hello Everyone,
    I would like to know if someone can tell me what i'm wrong.
    I have tryed JavaBean AWTFileDialog to see how it's works inside a Forms.
    When i click button, the FileDialog open, everything looks good.
    I try to create a JavaBean with Eclipse.
    My Code
    package oracle.forms.fd;
    import java.awt.Component;
    public clas myJB extends Component {
          public string getTextSample() {
               String sText = "";
               sText = "foobar";
               return sText;
    I export to jar file in my oracle form directory.
    edited my formweb.cfg file to add myJB jar file like i've done with AWTFileDialog.
    but when i try in my form, the return value are null
    my form code.
    When-new-form-instance trigger
    FBean.Register_Bean('CTRL.BEAN', 1, 'oracle.forms.fd.ADLog');
    and i have a button to get the value like this
    cV_co_retr := FBean.Invoke_Char('CTRL.BEAN', 1, 'getTextSample');
    what i've done wrong?
    I miss something?
    thanks for help.

    Hi, thanks again for your help.
    I use JRocket 1.6.14 R27.6.5 32 bit, my Forms Developer version is 11.1.1.2.0
    i would like to sign my jar file, but i really start with this kind of dev.
    i've take a look at this link
    http://docs.oracle.com/javase/tutorial/deployment/jar/signing.html
    when i try the
    jarsigner jar-file alias 
    i get this error about unable to load .keystore file (unable to find specified file)
    how i can create keystore file? with something like this ? https://www.sslshopper.com/article-most-common-java-keytool-keystore-commands.html
    keytool -genkey -alias mydomain -keyalg RSA -keystore keystore.jks -keysize 2048
    Does that mean i need to resign my jar on each domain?
    Thanks ..
    EDIT : I think i miss something, i have created my keystore file and compiler my jar with jar -cvf myjava.jar myjava.java
    Does it's possible it's because i don't have JInitiator? if i try with any other jar from this site http://forms.pjc.bean.over-blog.com/ all works good, if i try with my jar file, nothing woks.
    i have compiled created java from pjc.beans.over-blog and the jar stop working.
    so i'm really lost, what i'm doing wrong to create my jar file.
    i have tryed the 3 files given by FrancoisDegrelle to create keystroke at this link https://forums.oracle.com/thread/2154907 and it sound good, but my jar not working again.
    thanks
    Ce message a été modifié par : Neimad

  • Why JavaBeans with JSP

    Hi,
    I know its an easy question and probably a silly one to ask, but still please take time to answer this. Why do we use JavaBeans with JSP to make use of reusable code. Cant we use simple classes for this?
    Thanks in advance

    Hi,
    JavaBeans technology is the component architecture for the Java 2 Platform, Standard Edition (J2SE). Components (JavaBeans) are reusable software programs that you can develop and assemble easily to create sophisticated applications. By using Java beans, JSP allows you to keep much more of your code separate from the html than other html embedded languages. Java beans basically let you keep all the logic of your page (like the code to connect to a database, manipulate data etc�) in a separate file known as a Java bean. Then from within your html page - all you do is use one tag to 'use' the bean, and then a few other short tags to send data to and from the bean.
    the website http://java.sun.com/products/jsp/html/jsptut.html is a good start, simple and easy understand.
    Good luck!
    jmling

  • How to call a javabean with more argumets?

    I've create a javabean with more arguments,i've used fbean.add_arg:
    arglist := FBean.Create_Arglist;
    FBean.add_arg(arglist,'c:\dev10\esdir.fmb');
    FBean.add_arg(arglist,wdata);
    FBean.add_arg(arglist,wtime);
    wprova:=FBean.invoke_char('BEAN_IMAGE',1,'getDATA',arglist);
    but the javabean isn't invoked, where is my error?
    the javabean's code is:
    package oracle.forms.fd;
    import java.awt.Graphics;
    import java.awt.Image;
    import java.awt.Toolkit;
    import java.io.*;
    import java.net.URL;
    import java.sql.*;
    import java.lang.Long;
    import java.text.ParseException;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    import oracle.forms.properties.ID;
    import oracle.forms.ui.VBean;
    public class LeggiDir extends VBean
    private URL url;
    private Image img;
    public LeggiDir()
    super();
    System.out.println("prova");
    public void paint(Graphics g) {
    // draw the image
    g.drawImage(img, 0, 0, this);
    public void DisplayImage( String sFileName )
    // load image file
    System.out.println("prova 2");
    img = getImage(sFileName);
    repaint() ;
    public static Image getImage(String imageURL)
    // URL imageURL = null;
    boolean loadSuccess = false;
    Image img = null ;
    //JAR
    // imageURL = imageName;
    if (imageURL != null)
    try
    img = Toolkit.getDefaultToolkit().getImage(new java.net.URL(imageURL));
    loadSuccess = true;
    System.out.println("prova 3");
    return img ;
    catch (Exception ilex)
    System.out.println("Error loading image from JAR: " + ilex.toString());
    else
    System.out.println("Unable to find " + imageURL + " in JAR");
    if (loadSuccess == false)
    System.out.println("Error image " + imageURL + " could not be located");
    return img ;
    public static String getList(String directory)
    String result = null;
    String element = "";
    File path = new File( directory );
    File files[] = path.listFiles() ;
    String[] list = path.list();
    File p ;
    long lSize ;
    SimpleDateFormat data_formato = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
    for(int i = 0; i < list.length; i++)
    p = files[i] ;
    lSize = p.lastModified();
    // System.out.println(data.toString());
    element = element + data_formato.format(new Date(p.lastModified()))+' '+ list[i] + ' '+ '|';
    return element;
    public static String getFile(String filename)
    String result = null;
    String element = "";
    File p = new File( filename );
    long lSize ;
    SimpleDateFormat data_formato = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
    lSize = p.lastModified();
    System.out.println(lSize);
    element = data_formato.format(new Date(p.lastModified()));
    return element;
    public static String getData(String filename,String datafile,String orafile)
    System.out.println("entrato");
    String element = "";
    String data_costr = "";
    File p = new File( filename );
    SimpleDateFormat data_formato = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
    data_costr = datafile + ' '+orafile;
    System.out.println(data_costr);
    Date date = null;
    boolean success = true;
    try
    date = data_formato.parse(data_costr);
    long datacorr = date.getTime();
    success = p.setLastModified(datacorr);
    } catch (ParseException e) {
    success = false;
    if (success)
    element = data_formato.format(new Date(p.lastModified()));
    return element;
    else
    element = "data errata";
    return element;
    thanks
    cedo001

    Hello,
    Java is case sensitive. you call a getDATA function from Forms, but there is a getData() in the bean.
    Francois

  • Scope when using a JavaBean with JSP

    what is the meaning of this question .....?
    "Which of the following can not be used as the scope when using a JavaBean with JSP? "
    question 4
    site :http://java.sun.com/developer/Quizzes/jsptut/

    The question is clearly written. I don't see how you can be confused. But let's assume you are since you would not have posed the question.
    Dumbed-down:
    There are 4 scopes or areas of variable visibility in JavaServer Pages. Which of those can areas can not be used with JavaBeans?
    Does that help?

  • JavaBean with Oracle Forms

    How can I JavaBean with Oracle Forms 10g. I attempting to use graphics (Aircraft Image created using SVG) interactively with Oracle forms. Any sample code to lead me in the right direction would be helpful.

    How can I JavaBean with Oracle Forms 10g. I attempting to use graphics (Aircraft Image created using SVG) interactively with Oracle forms. Any sample code to lead me in the right direction would be helpful.

  • Use javaBeans with Microsoft ActiveX Components

    Hello,
    I would like to use javaBeans with Microsoft ActiveX Components.
    As I start the Packager and my jdk is installed in c:\jdk1.4
    I set the following command
    "c:\jdk1.4:bin\java.exe -cp jre\lib\rt.jar;jre\lib\jaws.jar
    sun.beans.ole.Packager"
    and receive error messages "Exception in thread main
    java.lang.NoClassDeFoundErrror:sun/beans/ole/Packager"
    Please give me some suggestions.
    Thanks a lot.

    Hello Twupack,
    Thank you provide me the information.
    If I just want to use javaBeans to create Microsoft ActiveX Components
    used in VBScript.
    sdk v1.4.2 is not suitable,right?
    Any Suggestion?
    Thank you very much.

  • Using JavaBean with JSP...will not work no matter what

    Hi guys. Sorry that this is such a common, newb question, but I don't know where else to turn.
    I'm new to web application development, Tomcat, and JSP. I'm trying to use a simple JavaBean in a JSP to store some user information. The JSP is located in $CATALINA_HOME\webapps\art , and the UserBean I'm trying to use is in $CATALINA_HOME\webapps\art\WEB-INF\classes . I've tried adding a context in the Tomcat server.xml file, but nothing seems to work, even putting the .class file into the \art directory along with the JSP. The error I get is the following:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 1 in the jsp file: /welcome.jsp
    Generated servlet error:
    [javac] Compiling 1 source file
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\art\welcome_jsp.java:43: cannot resolve symbol
    symbol : class UserBean
    location: class org.apache.jsp.welcome_jsp
    UserBean user = null;
    ^
    The source code is:
    welcome.jsp
    <%@ page import="java.sql.*" %>
    <jsp:useBean id="user" class="UserBean" scope="session"/>
    <html>
    <head>
    <title>Art Webapp Test</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <h1>Art Site</h1><br><br>
    <h3>Welcome Page</h3><br><br>
    <%
         user.setUsername("joe");
    user.setTitle("admin");
    %>
    </body>
    </html>
    UserBean:
    public class UserBean {
    private String username = null;
    private String title = null;
    public UserBean()
         this.username = null;
         this.title = null;
    public String getUsername()
         return this.username;
    public String getTitle()
         return this.title;
    public void setUsername(String inName)
         this.username = inName;     
    public void setTitle(String inTitle)
         this.title = inTitle;     
    }//UserBean
    Thanks for any and all help anyone could give me about this. It seems such a simple thing, to get a JavaBean working in a JSP...and it's very frustrating to have it NOT work when it seems I've done everything possible to get it to.

    Ok, I figured out what the problem was. My Bean was not a part of any specific package. It was never made clear to me that Beans are required to be a part of some package...I had no idea (though they always put them in packages in the tutorials, you think I would have picked up on it!).
    So I just added the following line to the Bean:
    package com.art;
    Then compiled it and copied the .class file to CATALINA_HOME\webapps\art\WEB-INF\classes\com\art
    Ta-da
    Thanks for the help and sorry for taking up space on this board.
    -Matt

  • Destroy in JavaBean with application scope?

    Hi,
    I am using a java bean in my jsp application with scope "application". I know that this java bean will be terminated only when the server stops or shuts down (Apache Tomcat 5.5).
    I need to cleanup something manually when the server shuts down. Can anyone tell me what method will be called, or that I can override, to clean up?
    I tried finalize and valueUnbound (implements HttpSessionBindingListener) with no luck... I just can't find a equivalent to destroy in Servlets (I can't use servlets, must use javabeans+jsp)...
    Any sugestion?
    thanks in advance for your time

    There is an indirect way if you know servlets. The "application" implicit object that you use in your JSP is the javax.servlet.ServletContext object. Instead of declaring your bean using the jsp:useBean tag, directly put your objects into the ServletContext using ServletContext.putAttribute() method. Objects put in the ServletCOntext are available to all pages in the application. Just use the ServletContext.getAttribute() method to retrieve this bean in any other page.
    To "kill the bean", just reset the value of this object to null by calling putAttribute(null).

  • Interaction between Writer and JavaBeans with Oracle Forms

    Hi, guys,
    I've been facing some difficulties trying to integrate Writer and Oracle Forms Web (10g). I'm able to open a Writer Document by using a JavaBean executed from Eclipse, but I cannot get the same operation working from forms web. Has anyone ever tried to do somenting like that? Is there a solution to communication between Forms 10G and OpenOffice Writer and how to do it?
    Thanks in advance.

    Hi, François!
    Thanks for your prompt answer. But I still have some questions. The Bean I'm using is the OOoBean, provided by OpenOffice and there isn't much documentation around. I have to control the Writer text editor from forms 10G, but I haven't been successful in my goal.
    I'll show the code I'm using in eclipse. I need to adapt it to work in Forms 10G.
    $RCSfile: OOoBeanViewer.java,v $
    * $Revision: 1.3 $
    * last change: $Author: vg $ $Date: 2005/02/16 16:22:52 $
    * The Contents of this file are made available subject to the terms of
    * the BSD license.
    * Copyright (c) 2003 by Sun Microsystems, Inc.
    * All rights reserved.
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    * 1. Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    * 2. Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
    * contributors may be used to endorse or promote products derived
    * from this software without specific prior written permission.
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
    * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
    * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
    * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
    * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
    * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
    * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
    * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    import javax.swing.filechooser.*;
    import javax.swing.*;
    import com.sun.star.comp.beans.*;
    import java.io.*;
    /** A simple Applet that contains the SimpleBean.
    * This applet is a sample implementation of the
    * OpenOffice.org bean.
    * When initally loaded the applet has two buttons
    * one for opening an existant file and one to open
    * a blank document of a given type supported by
    * OpenOffice.org eg. Writer, Calc, Impress, .....
    public class OOoBeanViewer extends java.applet.Applet
    * Private variables declaration - GUI components
    private java.awt.Panel rightPanel;
    private java.awt.Panel bottomPanel;
    private javax.swing.JButton closeButton;
    private javax.swing.JButton terminateButton;
    private javax.swing.JButton newDocumentButton;
    private javax.swing.JPopupMenu documentTypePopUp;
    private javax.swing.JCheckBox menuBarButton;
    private javax.swing.JCheckBox mainBarButton;
    private javax.swing.JCheckBox toolBarButton;
    private javax.swing.JCheckBox statusBarButton;
    private javax.swing.JButton storeDocumentButton;
    private javax.swing.JButton loadDocumentButton;
    private javax.swing.JButton syswinButton;
    private JTextField documentURLTextField;
    private JMenuItem item;
    private JFileChooser fileChooser;
    private byte buffer[];
    * Private variables declaration - SimpleBean variables
    private OOoBean aBean;
    * Initialize the Appplet
    public void init()
              //The aBean needs to be initialized to add it to the applet
              aBean = new OOoBean();
    //Initialize GUI components
    rightPanel = new java.awt.Panel();
    bottomPanel = new java.awt.Panel();
    closeButton = new javax.swing.JButton("close");
    terminateButton = new javax.swing.JButton("terminate");
    newDocumentButton = new javax.swing.JButton("new document...");
    documentTypePopUp = new javax.swing.JPopupMenu();
    storeDocumentButton = new javax.swing.JButton("store to buffer");
    loadDocumentButton = new javax.swing.JButton("load from buffer");
    syswinButton = new javax.swing.JButton("release/aquire");
    menuBarButton = new javax.swing.JCheckBox("MenuBar");
              menuBarButton.setSelected( aBean.isMenuBarVisible() );
    mainBarButton = new javax.swing.JCheckBox("MainBar");
              mainBarButton.setSelected( aBean.isStandardBarVisible() );
    toolBarButton = new javax.swing.JCheckBox("ToolBar");
              toolBarButton.setSelected( aBean.isToolBarVisible() );
    statusBarButton = new javax.swing.JCheckBox("StatusBar");
              statusBarButton.setSelected( aBean.isStatusBarVisible() );
    documentURLTextField = new javax.swing.JTextField();
    //Set up the Popup Menu to create a blank document
    documentTypePopUp.setToolTipText("Create an empty document");
    item = documentTypePopUp.add("Text Document");
    item.addActionListener(new java.awt.event.ActionListener()
    public void actionPerformed(java.awt.event.ActionEvent evt)
    createBlankDoc("private:factory/swriter",
    "New text document");
    item = documentTypePopUp.add("Presentation Document");
    item.addActionListener(new java.awt.event.ActionListener()
    public void actionPerformed(java.awt.event.ActionEvent evt)
    createBlankDoc("private:factory/simpress",
    "New presentation document");
    item = documentTypePopUp.add("Drawing Document");
    item.addActionListener(new java.awt.event.ActionListener()
    public void actionPerformed(java.awt.event.ActionEvent evt)
    createBlankDoc("private:factory/sdraw",
    "New drawing document");
    item = documentTypePopUp.add("Formula Document");
    item.addActionListener(new java.awt.event.ActionListener()
    public void actionPerformed(java.awt.event.ActionEvent evt)
    createBlankDoc("private:factory/smath",
    "New formula document");
    item = documentTypePopUp.add("Spreadsheet Document");
    item.addActionListener(new java.awt.event.ActionListener()
    public void actionPerformed(java.awt.event.ActionEvent evt)
    createBlankDoc("private:factory/scalc",
    "New spreadsheet document");
    syswinButton.addActionListener(
                        new java.awt.event.ActionListener()
    public void actionPerformed(java.awt.event.ActionEvent evt)
                        try
                             aBean.releaseSystemWindow();
                             aBean.aquireSystemWindow();
                        catch ( com.sun.star.comp.beans.NoConnectionException aExc )
                        catch ( com.sun.star.comp.beans.SystemWindowException aExc )
    storeDocumentButton.addActionListener(
                        new java.awt.event.ActionListener()
    public void actionPerformed(java.awt.event.ActionEvent evt)
                        try
                             buffer = aBean.storeToByteArray( null, null );
                        catch ( Throwable aExc )
                             System.err.println( "storeToBuffer failed: " + aExc );
                             aExc.printStackTrace( System.err );
    loadDocumentButton.addActionListener(
                        new java.awt.event.ActionListener()
    public void actionPerformed(java.awt.event.ActionEvent evt)
                        try
                             aBean.loadFromByteArray( buffer, null );
                        catch ( Throwable aExc )
                             System.err.println( "loadFromBuffer failed: " + aExc );
                             aExc.printStackTrace( System.err );
    closeButton.addActionListener(new java.awt.event.ActionListener()
    public void actionPerformed(java.awt.event.ActionEvent evt)
    close();
    terminateButton.addActionListener(new java.awt.event.ActionListener()
    public void actionPerformed(java.awt.event.ActionEvent evt)
    terminate();
    newDocumentButton.addActionListener(new java.awt.event.ActionListener()
    public void actionPerformed(java.awt.event.ActionEvent evt)
    documentTypePopUp.show((java.awt.Component)evt.getSource(), 0,0);
    menuBarButton.addActionListener(new java.awt.event.ActionListener()
    public void actionPerformed(java.awt.event.ActionEvent evt)
                        aBean.setMenuBarVisible( !aBean.isMenuBarVisible() );
    mainBarButton.addActionListener(new java.awt.event.ActionListener()
    public void actionPerformed(java.awt.event.ActionEvent evt)
                        aBean.setStandardBarVisible( !aBean.isStandardBarVisible() );
    toolBarButton.addActionListener(new java.awt.event.ActionListener()
    public void actionPerformed(java.awt.event.ActionEvent evt)
                        aBean.setToolBarVisible( !aBean.isToolBarVisible() );
    statusBarButton.addActionListener(new java.awt.event.ActionListener()
    public void actionPerformed(java.awt.event.ActionEvent evt)
                        aBean.setStatusBarVisible( !aBean.isStatusBarVisible() );
    documentURLTextField.setEditable(false);
    documentURLTextField.setPreferredSize(new java.awt.Dimension(200, 30));
    rightPanel.setLayout( new java.awt.GridLayout(10,1) );
    rightPanel.add(closeButton);
    rightPanel.add(terminateButton);
    rightPanel.add(newDocumentButton);
    rightPanel.add(storeDocumentButton);
    rightPanel.add(loadDocumentButton);
    rightPanel.add(syswinButton);
    rightPanel.add(menuBarButton);
    rightPanel.add(mainBarButton);
    rightPanel.add(toolBarButton);
    rightPanel.add(statusBarButton);
    //bottomPanel.setLayout( new java.awt.GridLayout(1,1) );
    bottomPanel.setLayout( new java.awt.BorderLayout() );
    bottomPanel.add(documentURLTextField);
    setLayout(new java.awt.BorderLayout());
    add(aBean, java.awt.BorderLayout.CENTER);
    add(rightPanel, java.awt.BorderLayout.EAST);
    add(bottomPanel, java.awt.BorderLayout.SOUTH);
    * Create a blank document of type <code>desc</code>
    * @param url The private internal URL of the OpenOffice.org
    * document describing the document
    * @param desc A description of the document to be created
    private void createBlankDoc(String url, String desc)
              //Create a blank document
              try
    documentURLTextField.setText(desc);
    //Get the office process to load the URL
    aBean.loadFromURL( url, null );
                   aBean.aquireSystemWindow();
              catch ( com.sun.star.comp.beans.SystemWindowException aExc )
                   System.err.println( "OOoBeanViewer.1:" );
                   aExc.printStackTrace();
              catch ( com.sun.star.comp.beans.NoConnectionException aExc )
                   System.err.println( "OOoBeanViewer.2:" );
                   aExc.printStackTrace();
              catch ( Exception aExc )
                   System.err.println( "OOoBeanViewer.3:" );
                   aExc.printStackTrace();
                   //return;
         /** closes the bean viewer, leaves OOo running.
    private void close()
                   setVisible(false);
                   aBean.stopOOoConnection();
                   stop();
                   System.exit(0);
         /** closes the bean viewer and tries to terminate OOo.
    private void terminate()
                   setVisible(false);
                   com.sun.star.frame.XDesktop xDesktop = null;
                   try {
                        xDesktop = aBean.getOOoDesktop();
                   catch ( com.sun.star.comp.beans.NoConnectionException aExc ) {} // ignore
                   aBean.stopOOoConnection();
                   stop();
                   if ( xDesktop != null )
                        xDesktop.terminate();
                   System.exit(0);
    * An ExitListener listening for windowClosing events
    class ExitListener extends java.awt.event.WindowAdapter
    * windowClosed
    * @param e A WindowEvent for a closed Window event
    public void windowClosed( java.awt.event.WindowEvent e)
                   close();
    * windowClosing for a closing window event
    * @param e A WindowEvent for a closing window event
    public void windowClosing( java.awt.event.WindowEvent e)
    ((java.awt.Window)e.getSource()).dispose();
    public static void main(String args[])
    java.awt.Frame frame = new java.awt.Frame("OpenOffice.org Demo");
    OOoBeanViewer aViewer = new OOoBeanViewer();
    frame.setLayout(new java.awt.BorderLayout());
    frame.addWindowListener( aViewer.new ExitListener() );
    aViewer.init();
    aViewer.start();
    frame.add(aViewer);
    frame.setLocation( 200, 200 );
    frame.setSize( 800, 480 );
    frame.show();
    }

  • How to link javabean with c using jni

    I am doing a program about using jni to load a c .But when I was using jni with javabean, under tomcat, it didn't work . Please show me a way.
    my code�F
    /////TestJNI.java
    package com.jsp;
    public class TestJNI{ 
    private byte[] cbuff={49,48,48,48,100,0x0};
    public byte getchar(int i)
    return cbuff;
    public native int GetRandom(byte[] pRandom,int j);
    static
    System.loadLibrary( "TestJNI" );
    public void Execute()
    int r=GetRandom(cbuff,4);
    /////BeanTest.jsp
    <jsp:useBean id="TestJNI" scope="session" class="com.jsp.TestJNI">
    </jsp:useBean>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head>
    <body>
    <%=TestJNI.getchar(4)%>;
    <%
    TestJNI.Execute();
    %>
    <br>
    <%=TestJNI.getchar(4)%>
    </body>
    </html>
    //////TestJNI.cpp
    //TestJNI.cpp
    #include"com_jsp_TestJNI.h"
    #include<stdio.h>
    JNIEXPORT jint JNICALL Java_com_jsp_TestJNI_GetRandom (JNIEnv *env,  jclass,  jbyteArray  pRandom,  jint  j)   
    jsize size = env->GetArrayLength((jarray)pRandom);
    jbyte *arrayBody    =  (env)->GetByteArrayElements(pRandom,NULL); 
    jbyte buff[5];
    buff[0]=31;
    buff[1]=32;
    buff[2]=33;
    buff[3]=34;
    buff[4]=35;
    env->SetByteArrayRegion(pRandom,0,5,buff); // set byte[] values
    return (jint)100;
    I put TestJNI.class under directory com/jsp/�Cput TestJNI.dll under classes directory�B
    erro information�F
    java.lang.NoClassDefFoundError
         sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         java.lang.reflect.Constructor.newInstance(Constructor.java:274)
         java.lang.Class.newInstance0(Class.java:308)
         java.lang.Class.newInstance(Class.java:261)
         java.beans.Beans.instantiate(Beans.java:204)
         java.beans.Beans.instantiate(Beans.java:48)
         org.apache.jsp.beantest_jsp._jspService(beantest_jsp.java:45)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

    You can test a normal Class(not a JNI call) invoking in BeanTest.jsp
    1.If there is no problem it's most likely you can't get library path set in server enviroment
    (here: System.loadLibrary( "TestJNI" ); )
    2.If the same exception occurs ,you should check your webapps tree structure.
    please refer to the 2 links if you can read chinese
    http://www.chinaitlab.com/www/news/article_show.asp?id=36677
    http://www.javaresearch.org/article/showarticle.jsp?column=1&thread=4653

  • Mapping lookup up failure with input JavaBean with an array of strings

    To receive input data our Web service defines a JavaBean one element of which is
    an array of strings. When a test Java client calls the service method the call
    is completed successfully. When a Perl client calls the service method an exception
    is returned. If I understand BEA's Web service documentation, it isn't necessary
    to do development for the service specifically to enable correct processing of
    an array of strings.
    In our environment we are running WL 8.1 SP 1.
    Please review the problem documentation and explain to me the cause of the exception
    and what I must do to prevent it.
    Thank you.
    The exception:
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><env:Header/><env:Body><env:Fault><faultcode>env:Server</faultcode><faultstring>Exception
    during processing: weblogic.xml.schema.binding.DeserializationException: mapping
    lookup failure. type=['http://www.w3.org/1999/XMLSchema']:xsd:string schema context=TypedSchemaContext{javaType=java.lang.String}
    (see Fault Detail for stacktrace)</faultstring><detail><bea_fault:stacktrace xmlns:bea_fault="http://www.bea.com/servers/wls70/webservice/fault/1.0.0"/>weblogic.xml.schema.binding.DeserializationException:
    mapping lookup failure. type=['http://www.w3.org/1999/XMLSchema']:xsd:string schema
    context=TypedSchemaContext{javaType=java.lang.String}
         at weblogic.xml.schema.binding.RuntimeUtils.lookup_deserializer(RuntimeUtils.java:461)
         at weblogic.xml.schema.binding.SoapArrayCodecBase.getComponentDeserializer(SoapArrayCodecBase.java:574)
         at weblogic.xml.schema.binding.SoapArrayCodecBase.deserialize(SoapArrayCodecBase.java:285)
         at weblogic.xml.schema.binding.BeanCodecBase.processElement(BeanCodecBase.java:183)
         at weblogic.xml.schema.binding.BeanCodecBase.processAllElements(BeanCodecBase.java:165)
         at weblogic.xml.schema.binding.BeanCodecBase.processElements(BeanCodecBase.java:145)
         at weblogic.xml.schema.binding.BeanCodecBase.deserialize(BeanCodecBase.java:108)
         at weblogic.xml.schema.binding.RuntimeUtils.invoke_deserializer(RuntimeUtils.java:428)
         at weblogic.xml.schema.binding.RuntimeUtils.invoke_deserializer(RuntimeUtils.java:328)
         at weblogic.webservice.core.DefaultPart.toJava(DefaultPart.java:384)
         at weblogic.webservice.core.DefaultMessage.toJava(DefaultMessage.java:458)
         at weblogic.webservice.core.handler.InvokeHandler.handleRequest(InvokeHandler.java:78)
         at weblogic.webservice.core.HandlerChainImpl.handleRequest(HandlerChainImpl.java:143)
         at weblogic.webservice.core.DefaultOperation.process(DefaultOperation.java:518)
         [more]
    The XML generated for the Perl client:
    <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:namesp2="http://namespaces.soaplite.com/perl"
    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><namesp1:getWorkOrdersByFilters
    xmlns:namesp1="ncr.com"><gIMServiceRequest xsi:type="ns:GIMServiceRequest" xmlns:ns="java:com.ncr.gim.bean.service"><applicationID
    xsi:type="xsd:string">REVLOG</applicationID><nodeId xsi:type="xsd:string">00XH</nodeId><stopCodes
    xsi:type="namesp2:array" SOAP-ENC:arrayType="xsd:string[2]"><xsd:string xsi:type="xsd:string">06</xsd:string><xsd:string
    xsi:type="xsd:string">16</xsd:string></stopCodes></gIMServiceRequest></namesp1:getWorkOrdersByFilters></SOAP-ENV:Body></SOAP-ENV:Envelope>
    The XML generated for a test Java client:
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><env:Header/><env:Body
    env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><m:getWorkOrdersByFilters
    xmlns:m="ncr.com"><gIMServiceRequest xmlns:n1="java:com.ncr.gim.bean.service"
    xsi:type="n1:GIMServiceRequest"><CSRCode xsi:type="xsd:string">987x00</CSRCode><applicationID
    xsi:type="xsd:string">GIM</applicationID><incidentNbr xsi:nil="true"/><nodeId
    xsi:type="xsd:string">00T5</nodeId><stopCodes soapenc:arrayType="xsd:string[3]"><xsd:string
    xsi:type="xsd:string">00</xsd:string><xsd:string xsi:type="xsd:string">01</xsd:string><xsd:string
    xsi:type="xsd:string">02</xsd:string></stopCodes></gIMServiceRequest></m:getWorkOrdersByFilters></env:Body></env:Envelope>
    The JavaBean:
    public class GIMServiceRequest implements Serializable {
         private String applicationID = GIMConstants.UNKNOWN_APPLICATION_ID;
         private String nodeId = null;
         private String incidentNbr = null;
         private String CSRCode = null;
         private String[] stopCodes = null;
         public void setStopCodes(String[] aStopCodes) {
              stopCodes = aStopCodes;
         public String[] getStopCodes() {
              return stopCodes;
         [more]
    The service build.xml file:
    <project name="GIMService" default="all" basedir=".">
         <target name="all" depends="ear"/>
    <target name="ear">
    <servicegen
    destEar="GIMService.ear"
    contextURI="GIMContext" >
    <service
         ejbJar="GIMServiceEJB.jar"
         targetNamespace="ncr.com"
                        serviceName="GIMService"
                        serviceURI="/GIM_URI"
                        generateTypes="True"
                        expandMethods="True"
                        style="rpc"
                        protocol="http" >
              <client
                   clientJarName="GIMService_client.jar"
                   packageName="com.ncr.gim.gimservice.client" >
              </client>
    </service>
    </servicegen>
    </target>
    </project>

    Hi Jeff,
    Looks like the Perl client is using an older (deprecated) schema
    namespace "http://www.w3.org/1999/XMLSchema" that is causing this
    failure.
    Hope this helps,
    Bruce
    Jeff Carey wrote:
    >
    To receive input data our Web service defines a JavaBean one element of which is
    an array of strings. When a test Java client calls the service method the call
    is completed successfully. When a Perl client calls the service method an exception
    is returned. If I understand BEA's Web service documentation, it isn't necessary
    to do development for the service specifically to enable correct processing of
    an array of strings.
    In our environment we are running WL 8.1 SP 1.
    Please review the problem documentation and explain to me the cause of the exception
    and what I must do to prevent it.
    Thank you.
    The exception:
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><env:Header/><env:Body><env:Fault><faultcode>env:Server</faultcode><faultstring>Exception
    during processing: weblogic.xml.schema.binding.DeserializationException: mapping
    lookup failure. type=['http://www.w3.org/1999/XMLSchema']:xsd:string schema context=TypedSchemaContext{javaType=java.lang.String}
    (see Fault Detail for stacktrace)</faultstring><detail><bea_fault:stacktrace xmlns:bea_fault="http://www.bea.com/servers/wls70/webservice/fault/1.0.0"/>weblogic.xml.schema.binding.DeserializationException:
    mapping lookup failure. type=['http://www.w3.org/1999/XMLSchema']:xsd:string schema
    context=TypedSchemaContext{javaType=java.lang.String}
    at weblogic.xml.schema.binding.RuntimeUtils.lookup_deserializer(RuntimeUtils.java:461)
    at weblogic.xml.schema.binding.SoapArrayCodecBase.getComponentDeserializer(SoapArrayCodecBase.java:574)
    at weblogic.xml.schema.binding.SoapArrayCodecBase.deserialize(SoapArrayCodecBase.java:285)
    at weblogic.xml.schema.binding.BeanCodecBase.processElement(BeanCodecBase.java:183)
    at weblogic.xml.schema.binding.BeanCodecBase.processAllElements(BeanCodecBase.java:165)
    at weblogic.xml.schema.binding.BeanCodecBase.processElements(BeanCodecBase.java:145)
    at weblogic.xml.schema.binding.BeanCodecBase.deserialize(BeanCodecBase.java:108)
    at weblogic.xml.schema.binding.RuntimeUtils.invoke_deserializer(RuntimeUtils.java:428)
    at weblogic.xml.schema.binding.RuntimeUtils.invoke_deserializer(RuntimeUtils.java:328)
    at weblogic.webservice.core.DefaultPart.toJava(DefaultPart.java:384)
    at weblogic.webservice.core.DefaultMessage.toJava(DefaultMessage.java:458)
    at weblogic.webservice.core.handler.InvokeHandler.handleRequest(InvokeHandler.java:78)
    at weblogic.webservice.core.HandlerChainImpl.handleRequest(HandlerChainImpl.java:143)
    at weblogic.webservice.core.DefaultOperation.process(DefaultOperation.java:518)
    [more]
    The XML generated for the Perl client:
    <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:namesp2="http://namespaces.soaplite.com/perl"
    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><namesp1:getWorkOrdersByFilters
    xmlns:namesp1="ncr.com"><gIMServiceRequest xsi:type="ns:GIMServiceRequest" xmlns:ns="java:com.ncr.gim.bean.service"><applicationID
    xsi:type="xsd:string">REVLOG</applicationID><nodeId xsi:type="xsd:string">00XH</nodeId><stopCodes
    xsi:type="namesp2:array" SOAP-ENC:arrayType="xsd:string[2]"><xsd:string xsi:type="xsd:string">06</xsd:string><xsd:string
    xsi:type="xsd:string">16</xsd:string></stopCodes></gIMServiceRequest></namesp1:getWorkOrdersByFilters></SOAP-ENV:Body></SOAP-ENV:Envelope>
    The XML generated for a test Java client:
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><env:Header/><env:Body
    env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><m:getWorkOrdersByFilters
    xmlns:m="ncr.com"><gIMServiceRequest xmlns:n1="java:com.ncr.gim.bean.service"
    xsi:type="n1:GIMServiceRequest"><CSRCode xsi:type="xsd:string">987x00</CSRCode><applicationID
    xsi:type="xsd:string">GIM</applicationID><incidentNbr xsi:nil="true"/><nodeId
    xsi:type="xsd:string">00T5</nodeId><stopCodes soapenc:arrayType="xsd:string[3]"><xsd:string
    xsi:type="xsd:string">00</xsd:string><xsd:string xsi:type="xsd:string">01</xsd:string><xsd:string
    xsi:type="xsd:string">02</xsd:string></stopCodes></gIMServiceRequest></m:getWorkOrdersByFilters></env:Body></env:Envelope>
    The JavaBean:
    public class GIMServiceRequest implements Serializable {
    private String applicationID = GIMConstants.UNKNOWN_APPLICATION_ID;
    private String nodeId = null;
    private String incidentNbr = null;
    private String CSRCode = null;
    private String[] stopCodes = null;
    public void setStopCodes(String[] aStopCodes) {
    stopCodes = aStopCodes;
    public String[] getStopCodes() {
    return stopCodes;
    [more]
    The service build.xml file:
    <project name="GIMService" default="all" basedir=".">
    <target name="all" depends="ear"/>
    <target name="ear">
    <servicegen
    destEar="GIMService.ear"
    contextURI="GIMContext" >
    <service
    ejbJar="GIMServiceEJB.jar"
    targetNamespace="ncr.com"
    serviceName="GIMService"
    serviceURI="/GIM_URI"
    generateTypes="True"
    expandMethods="True"
    style="rpc"
    protocol="http" >
    <client
    clientJarName="GIMService_client.jar"
    packageName="com.ncr.gim.gimservice.client" >
    </client>
    </service>
    </servicegen>
    </target>
    </project>

  • Is it possible to do this in JSTL / JSP - JavaBean with static properties ?

    javaBean:
    public class Util {
      private static String s;
      public static void setS(String s) { this.s = s; }
      public static getS() { return s; }
    // some other static utilities needed to be called by other classes
    }JSP Page needs to output the value of s (the static value)
    Is it okay for the JavaBean used to have static values and static get and set?

    By the way, the correct way to write your static setS method (without this!) is:
    public static void setS(String s) { Util.s = s; }

  • JDBC in a JavaBean with Webforms

    I have a javabean which is called from webforms on a when-button-pressed trigger. The javabean works fine, except when it reaches a point in the code where i try to load the oracle jdbc driver:
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver())
    when it hits this line, the program just hangs there, no excpetions or errors are shown. Plus, I have tried running the same code in a standalone java application, and it works just fine.
    If you have experienced this, or know why this might be happening, please let me know, your help is appreciated.

    I get a security error in the console, but that is because it tries to do an insert and there is no connection. other than that, no errors messages, and no exceptions are thrown.
    I did not sign the JavaBean. Might this be the reason? I do have another JavaBean that calls the Open File Dialog box and that one works just fine without signing it. I think that this problem is a pure connection problem.

Maybe you are looking for