UIX Problem: How call a nonstatic java bean?

Now with a better subject! It's the same Problem like my post:
How can I call a nonstatic class
Hello All,
I've wrote a simple bean for my testcase that count a value (e.g. site access):
public class Bean1 {
private int accessCount = 1;
public int getAccessCount() {
return (accessCount++);
If I call the bean with a jsp-site, it works fine with different scope. e.g. session and application.
With session scope different browser count different. With application scope different bowser count together. Thats the normal attitude.
My jsp code:
<jsp:useBean id="counter" class="ml.view.Bean1" scope="session" />
<jsp:getProperty name="counter" property="accessCount" />
This don't work with a static bean (normal too), but I can only call a static class in my UIX site.
I call the bean from uix with the invoke element. Is that correct? How can I call a nonstatic class with a special scope? Which other solution ist possible?
My uix code:
<invoke method="getAccessCount" result="${uix.eventResult.getAccessCount}" instance="${sessionScope.Bean1.getAccessCount}" exception="${uix.eventResult.error}" javaType="ml.view.Bean1"/>
Thank you for any solution!
The error messages are:
java.lang.NullPointerException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java)
at oracle.cabo.servlet.event.InvokeEventHandler._invoke(Unknown Source)
at
and so forth...

Hello,
try right clicking on the bean and select Create Data Control.
The bean will then appear on your data control pallet and you can drag the field onto your UIX page.
you may be able to acheive this using EL in your example, but i am not sure how to do this. I know the above solution works. You can also use the binding container in any struts action to get hold of your bean and perform any actions on it.
regards,
Brenden

Similar Messages

  • Problem while calling servlet from java bean

    I am trying to call a servlet from java bean in cep.
    My java bean:
    package com.bea.wlevs.example.algotrading;
    import com.bea.wlevs.ede.api.StreamSink;
    import com.bea.wlevs.example.algotrading.event.MarketEvent;
    import javax.xml.bind.JAXBContext;
    import javax.xml.bind.Unmarshaller;
    import java.io.BufferedReader;
    import java.io.BufferedWriter;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.OutputStreamWriter;
    import java.io.StringReader;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.URLConnection;
    public class MarketEventBean implements StreamSink {
         String s=null;
         public void onInsertEvent(Object event) {
              if (event instanceof MarketEvent) {
                   MarketEvent marketEvent = (MarketEvent) event;
                   try {
                        JAXBContext cxt = JAXBContext.newInstance(MarketEvent.class);
                        Unmarshaller unmarsh = cxt.createUnmarshaller();
                        StringReader strReader = new StringReader(marketEvent.getString_1());
                        MarketEvent obj = (MarketEvent) unmarsh.unmarshal(strReader);
                        s=obj.getSymbol();
                        System.out.println("data: " + s);
                   } catch(Exception e) {
                        e.printStackTrace();
                   try {
                        System.out.println("test1");
         URL url = new URL("http://172.18.21.94:7001/AppServletrecv-Model-context-root/ReceiveServlet");
         URLConnection conn = url.openConnection();
              System.out.println("test2");
         conn.setDoOutput(true);
              System.out.println("test3");
         BufferedWriter out =
         new BufferedWriter( new OutputStreamWriter( conn.getOutputStream() ) );
         out.write("symbol="+s);
              System.out.println("test4");
         out.flush();
         System.out.println("test5");
         out.close();
         System.out.println("test6");
         BufferedReader in =
         new BufferedReader( new InputStreamReader( conn.getInputStream() ) );
              System.out.println("test7");
         String response;
         while ( (response = in.readLine()) != null ) {
         System.out.println( response );
         in.close();
         catch ( MalformedURLException ex ) {
         // a real program would need to handle this exception
         catch ( IOException ex ) {
         // a real program would need to handle this exception
    My servlet code:
    package model;
    import javax.servlet.http.HttpServlet;
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class ReceiveServlet extends HttpServlet {
    private final static String _SYMBOL = "symbol";
    public void doPost(HttpServletRequest request, HttpServletResponse response) {
    * Get the value of form parameter
    // private final static String USERNAME = "username";
    String symbol = request.getParameter( _SYMBOL );
    * Set the content type(MIME Type) of the response.
    response.setContentType("text/html");
    * Write the HTML to the response
    try {
    PrintWriter out = response.getWriter();
    out.println("<html>");
    out.println("<head>");
    out.println("<title> A very simple servlet example</title>");
    out.println("</head>");
    out.println("<body>");
    out.println("<h1>Hello " + symbol +"</h1>");
    out.println("</body>");
    out.println("</html>");
    out.close();
    } catch (IOException e) {
    Web.xml:
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
    <servlet>
    <servlet-name>ReceiveServlet</servlet-name>
    <servlet-class>model.ReceiveServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>ReceiveServlet</servlet-name>
    <url-pattern>/ReceiveServlet</url-pattern>
    </servlet-mapping>
    </web-app>
    My servlet is running in weblogic server.
    But when I am running this program in weblogic server side there is no log.
    Edited by: 856272 on Jun 23, 2011 6:43 AM

    I would run both sides in a debugger and see what code is getting invoked

  • How to make my java bean internationalization?

    hi,
    I have a project on tomcat. I have rewrite my jsp to multi-language according to user's browse language setting. User's language is English, the jsp shows them English. User's language is Chinese, the jsp shows them Chinese, and so on. But in my java bean code, some exception are thrown out with some message or alert. Can anybody tell me how to make these java beans show the language string acording to user's browse language setting?
    thx
    Pierre

    Dear one_dane,
    Thank you. That is a great document to me. The fact is that my owner code throws exception with a string. The code is:
    if(amount<0) throw new Exception("Please input correct amount.");
    If the code is in jsp, I can convert it to a internationalized String using struts tag <bean:message...>. But it is in a deep function of java class. So must I add a Locale object parameter to the function and all calling functions?
    thx
    yours,
    Pierre

  • How to attach a java bean in forms6i

    Hi,
    I am new to oracle forms6i. i just want to ask on how to attach a java bean to forms6i.i did putting the full directory path to the implementation class but it has an error, bean not found. what should i do?
    Your help is highly appreciated.

    The implementation class should contain the package and class name of the bean e.g. com.groundside.beans.DateFieldBean, not a directory location. The bean itself is loaded from the JAR files specified to be downloaded with the applet.
    If you are running client server then you can't use JavaBeans this way - it's a web only feature.

  • How to use/configure JAVA beans file in Forms10g?

    Hi!
    I'm using Forms10g. I need to use few java beans file in my forms. How do i call it and configure it. So, that i can access all the features of this file in Forms.
    Regards.
    Satyaki De.

    Hello,
    Java Beans Integration
    http://forms.pjc.bean.over-blog.com/article-4018331.html
    Hope it helps,
    Jose.

  • How Get ICubeContext at Java bean (Spring Context)

    Hello,
    I need to get the ICubeContext in a Java Bean (Spring Context). Is possible?
    For example in a custom xpath fuction, is very easy:
    public Object call(IXPathContext context, List args) throws XPathFunctionException {
        Map props = (Map) context.getVariableValue(null, null, "xpath-function-data");
        ICubeContext ctx = (ICubeContext) props.get("ICubeContext");
    I would appreciate any help. Thank you very much!
    Sergio.

    This is a possible solution:
    BPELContext bc = BPELContext.peekThreadBPELContext();
        if (bc == null)
          return null;
        ICubeContext ctx = bc.getCubeContext();
    not yet tested!!

  • Reports 10g and Firefox 3 - How to load the java bean

    Hi,
    I have problems configuring Firefox to run Reports.
    I have been told that Firefox cannot load the java bean right from the start.
    If someone could direct me to documentation on using Firefox and Reports, that would be nice.
    Many thanks in advance.
    Jean

    Hello,
    If you execute your Reports as a JSP page : URL like http://server:port/reports/myreports.jsp?param1=...
    the output will be in HTML
    If you execute your Reports using the Reports Servlet : URL like hhp://server:port/reports/rwservlet?report=myreports.jsp&param1=...
    the output will be in the format specified by DESFORMAT : (HTML / RTF / PDF / ..)
    Supported values for DESFORMAT :
    http://www.oracle.com/webapps/online-help/reports/10.1.2/topics/htmlhelp_rwbuild_hs/rwrefex/cmdline/common/bld_desformat.htm
    Regards

  • How can I using java bean to insert new record

    Hi everybody,
    I'd some problem when I insert a record using java bean. When insert a record, the resultset executeUpdate return 0 anc cannot add record to database. Would you please tell me what's wrong in my code?
    java bean
    package miniproj;
    import java.sql.*;
    public class Register{
    private String sql;
    private String username;
    private String usertype;
    private String password;
    private String blocknum;
    private int floornum;
    private String owner;
    private int rows;
    private String s;
    // set parameter to database
    public int setMember(){
    try{
    //load database driver
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    // Get a connection to the database
    Connection sqlConn = java.sql.DriverManager.getConnection("jdbc.odbc:WFBS");
    // Get a statement from the connection
    Statement sqlStmt = sqlConn.createStatement();
    sql = "INSERT INTO USERS(user_name, password) VALEUS ('aaa', 'aaa')";
    // sql = "INSERT INTO USERS(user_name, password) VALEUS (" + user_name + "," + password + ")" ;
    rows = sqlStmt.executeUpdate(sql);
    // sqlRst.close();
    sqlStmt.close();
    sqlConn.close();
    catch(SQLException se){
    catch(Exception e){
    return rows;
    // set user name method
    public void setUsername(String name){
    username = name;
    // set passwrod method
    public void setPassword(String pwd){
    password = pwd;
    // set block num mehtod
    public void setBlockNum(String block){
    blocknum = block;
    // set floor num method
    public void setFloorNum(int floor){
    floornum = floor;
    // set owner method
    public void setOnwer(String own){
    owner = own;
    // get user name method
    public String getUsername(){
    return username;
    // get password method
    public String getPassword(){
    return password;
    jsp code
    <%@ include file="Header.jsp" %>
    <%@ page errorPage="Error.jsp" %>
    <jsp:useBean id="register" class="miniproj.Register" />
    <jsp:setProperty name="register" property="*" />
    User name : <%=register.getUsername()%><br>
    Password : <%=register.getPassword()%><br>
    <%
    int i = register.setMember();
    out.println(i);
    %>
    Thanks a lot
    Chris

    Seems to me that executeUpdate() would throw an SQLException, which in turn would get caught by your empty catch. The SQL keyword VALUES is misspelled. Put a 'se.printStackTrace()' in your catch to confirm this.

  • How to NOT ignore java beans read only properties when serializing Java to AS?

    As stated in the Adobe LCDS documentation, the read-only properties of a java bean are ignored in the AMF serialization process.
    Would you know what to do so that Java beans read only properties do not get discarded when sending it via BlazeDS AMF?
    Many thanks in advance.

    Hi,
    I've managed to get what I needed by using a shift register + event structure as suggested by Adnan. However, I face another problem after implementing SR+event. I've attached two files, first the original program and second the updated program using SR + event. (it's only the jpg file as I've forgotten to save the labview program, will upload the program by tomorrow.
    In the original program, I have an elapsed time that is able to run continuously when I run the program. In the updated program, my elapsed time don't seem to run continuously when I run the program (as shown by elapsed time indicator). I need the elapsed time to run continuously as a input to calculate my motor profile.
    I suppose this is caused by the introduction of the event structure, will adding a case structure to wrap the event structure solve the problem or is there another way to get pass this. Appreciate if someone could drop me a pointer or two.
    Thanks
    Attachments:
    Mar 16 - continuous elapsed time.png ‏12 KB
    Mar 16 - elapsed time not continuous after introducing shift register + event structure.png ‏17 KB

  • How to make view Java Bean as .ocx file.

    Hi All,
    I want to use a visual Java Bean in Visual basic. So that I can modify all the bean properties as modify properties in a ocx file.
    I used ActiveX Com bridge downloaded from Sun's site. But the packager
    makes a .tlb file .
    This file can only be added as a reference in visual basic but not as a ActiveX control. Is there any way out to do that???
    Thanks & regards.
    Nimesh

    The packager creates a registry file and a tlb file.
    After registering this .reg file, java bean can be used as an ActiveX control.
    From within Visal Basic, select the "Tools" menu and "Custom Controls" item and add the Bean control that was generated.
    Avinash.

  • How i can run java bean

    i want to run java bean at bean area. i write a simple bean and what i will write on oracle forms builder bean area property palette implementation class. i make bean a jar file and i put it same folder with form file.
    thanks for your helps

    Hello,
    I did not see any error mentioned in your initial post...
    So, what is the error ?
    If the jar file is not in your registry, you could have the design time error (bean not found), but is the bean runs ok at runtime ?
    Francois

  • How can i use JAVA BEAN and JSP?

    well, i have developed all my web apps by using pure JSP only, i know this sucks, but i dont know how to start on using beans... what directory should i put them into... etc... what are the good programminmg practices/standards/techniques when incorporating beans in jsp???

    Standards are pretty loose, but generally, Beans hold a lot of the backend logic for your JSP. This can include data validation before entering into the database, database inserts, queries, data manipulation. The JSP should really only contain code that will retrieve the data from the bean and appropriately output it.
    As far as using them, you can use the <jsp:useBean> tag in your JSP. As long as the bean is stored somewhere that your classpath points to, you're all set. From then on, you can use it like any other object in your JSP.

  • How can I include Java Bean model into the model outside the component

    Hi All,
    I am new to SAP portal. I wanted to create a bean for storing the data and to include that into the application model.
    Please help me with an example .
    Regards,
    Saroj

    Hi,
      Check these blogs.
    The specified item was not found.
    Importing Complex JavaBean model into WebDynpro by creating relationships for the model classes
    JavaBean Model Import: when it really works
    Issue in Importing Java Bean Model
    Regards,
    Harini S
    Consider rewarding points for helpful answers. Post this thread in WD forums for more results.

  • How to Debug a Java bean In Jdeveloper 3.2

    I want to debug my java Bean in Jdeveloper Environment.
    When I click on debug option Nothing happens .can some body provide me some guidance here

    Sameera,
    You can create a "Custom Project" which is equivalent to "Generic Project".
    -Arun

  • Problem while calling RFC in java

    hi,
    I writed a java program  calling a batch input RFC.  The RFC return an internal table which storing the system messages of the batch input process. My problem is:
    When i debug the java program,the RFC excecuted and return the correct internal table to me.
    But when i executed it not in debug mode, there is no batch input messages return to me.
    My code is:
    package com.hongta.com.z_delivery_bdc;
    import com.sap.mw.jco.IFunctionTemplate;
    import com.sap.mw.jco.JCO;
    import com.sap.mw.jco.JCO.ParameterList;
    @author Administrator
    To change the template for this generated type comment go to
    Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    public class ConnectRFC extends Object {
         JCO.Client mConnection;
         JCO.Repository mRepository;
         String filePath;
         String BDCLOG;
         JCO.Function function;
         public void Connect1() {
              filePath =
                   "C:
    Documents and Settings
    Administrator.3939200975DB4C5
    desktop
    cigaXY2008-12-15.xml";
              function = null;
              try {
                   // Change the logon information to your own system/user
                        mConnection = JCO.createClient("610", // SAP client
              "xxxxxx", // userid
              "xxxxxx", // password
              null, // language
              "10.96.0.53", // application server host name
         "01"); // system number
          // mConnection.setAbapDebug(true);
                   mConnection.connect();
                   mRepository = new JCO.Repository("ARBsoft", mConnection);
              } catch (Exception ex) {
                   ex.printStackTrace();
                   System.out.println("jco connect failed");
                                            mConnection.disconnect();
                   System.exit(1);
              //JCO.Table codes = null;
              try {
                   function = this.createFunction("Z_BAPI_CONTRACT_BDC");
                   if (function == null) {
                        System.out.println(
                             "Z_BAPI_contract_bdc" + " not found in SAP.");
                        if ( mConnection != null && mConnection.isAlive()) {
                             mConnection.disconnect();
                        System.exit(1);
                   //function.getImportParameterList().setValue(filePath, "FILEPATH");               
                   //function.getImportParameterList().setValue(BDCLOG, "BDCLOG");
                   mConnection.execute(function);
                                   catch (Exception ex) {
                                       //System.out.println(ex.toString());
                                    ex.printStackTrace();
                                     System.out.println("execute failed");
                                            mConnection.disconnect();
                                     System.exit(1);
              JCO.Table codes = null;
              codes =
                 function.getTableParameterList().getTable("MESSAGE");
              try {
                        codes.firstRow();
                        for (int i = 0; i < codes.getNumRows(); i++, codes.nextRow()) {
                        System.out.println(codes.getString("CON")"  "codes.getString("MESG"));
              catch(Exception ex1){
                   ex1.printStackTrace();
                   System.out.println("codes");
              if ( mConnection != null && mConnection.isAlive()) {
                   mConnection.disconnect();
                   System.out.println("chenggong");
              public JCO.Function createFunction(String name) throws Exception {
                   try {
                        IFunctionTemplate ft =
                             mRepository.getFunctionTemplate(name.toUpperCase());
                        if (ft == null){
                             return null;
                        return ft.getFunction();
                   } catch (Exception ex) {
                        throw new Exception("Problem retrieving JCO.Function object.");
              public static void main(String[] args) {
                   ConnectRFC app = new ConnectRFC();
                   app.Connect1();
    Regards,
    taowenbo.

    hi,
    i had resolved my problem in other way.I don't upload my data using ws_upload now,but upload with table.
    here is my code.Maybe helpful to somebody:
           JCO.Table C_XYORDERTable;
         JCO.Table C_XYORDPR_FINALTable;
         public void getXyordprFinalElement(Element e) {
              try {
                   for (Iterator i = e.getChildren().iterator(); i.hasNext();) {
                        Element child = (Element) i.next();
                        if (child.getName().equals("ORDER_ID"))
                             C_XYORDPR_FINALTable.setValue(child.getText(), "ORDER_ID");
                        else if (child.getName().equals("ID"))
                             C_XYORDPR_FINALTable.setValue(child.getText(), "ID");
                        else if (child.getName().equals("PRODUCT_ID"))
                             C_XYORDPR_FINALTable.setValue(
                                  child.getText(),
                                  "PRODUCT_ID");
                        else if (child.getName().equals("MATNR"))
                             C_XYORDPR_FINALTable.setValue(child.getText(), "MATNR");
                        else if (child.getName().equals("QUANTITY"))
                             C_XYORDPR_FINALTable.setValue(child.getText(), "QUANTITY");
                   C_XYORDPR_FINALTable.nextRow();
              } catch (Exception ex) {
                   ex.printStackTrace();

Maybe you are looking for

  • Unable to view Flash content after Norton Utilities scan

    I ran a Norton Utilities scan yesterday, and afterwards various websites looked extremely strange in Firefox. Worse, I lost the ability to view embedded videos on such sites as the BBC, YouTube etc. Further testing this morning shows that the problem

  • Account Clearing Concept

    Dear all, I am working on a training document to demostrate account clearing. I am now making a GL Document first (FB50) and then F-03 in FB50, can anyone teach me the DrCr entry please? Debit which type of account? (Asset/Liability/?) Credit which t

  • How to map betwwen two custom table

    Hi, I have two custom table like GL1000 & GL1001 in HR(Should be same behavior HRP1000 & HRP10001). I need to pass the data webdynpro screen through BADI. The Method would be Create, FIND, READ, DELIMT, and UPADTE when i create BADI definition. My Qu

  • Batch process for Web & Devices possible??

    Hiya, Here's what I have going on.  I'm heavily involved with the DAZ3D community.  Over a year ago I create a huge and I mean huge texture pack for the Windy Wizard Robe and the Morphing Fantasy Robe found at Renderosity.  The pack, when zipped up i

  • 2011 15" MBP won't boot past grey screen

    I came to turn on my 15" 2011 MBP OSX10.9.5 today, which had been left in sleep mode for a few days. The battery was flat, so I connected to the power supply and left it for a couple of hours. I then turned it on (no longer connected to power) and it