Java Bean Function problem

Hi All .
i just embeded a java bean into oracle forms it appear succesfully on the canvas now i want to execute the following function but unable to do so. Can u please explain me what i have to type where requested to call following function.
FUNCTION getDate(
obj ORA_JAVA.JOBJECT) RETURN ORA_JAVA.JOBJECT;
and the code i have on custom-trigger is
declare
newdate date;     
begin
     newdate := JCALENDAR.getdate("WHAT to write here");
     if (newdate is not null) then
          :vhead.DTv := newdate;
     end if;
end;
Thanks in Advance
Message was edited by:
Fiz Dosani

Did you use the Java Importer to import the classes ?
>>yes i do
and i am also using a bean area & while looking your reply at the following thread i try to use fbean package for calling a function but the problem is that the getdate function return date and i didnot find invoke_date precedure in fbean package
Re: How to call java function in Oracle forms?

Similar Messages

  • Java Bean Problem

    Hi,
              I have encountered a Java bean/JSP problem. I have developed a simple test
              case as follows:
              Paramtest.jsp:
              <html>
              <head>
              <title>Param Test</title>
              <body>
              <p>
              <form name="form1" method=post action="formtest.jsp">
              <input name="check1" type="checkbox">Check1
              <br>
              <input type="submit" value="OK" type="submit">
              </form>
              </body>
              </html>
              Formtest.jsp:
              <jsp:useBean id="cbtest" class="com.ebiffa.cbtest"
              scope="request" />
              <jsp:setProperty name="cbtest" property="*" />
              <html>
              <body>
              check1= <%= cbtest.getCheck1() %>
              </body>
              </html>
              cbtest.java:
              package com.ebiffa;
              public class cbtest {
              boolean check1;
              public void setcheck1 (boolean check1) {
              this.check1=check1;
              public boolean getCheck1() {
              return check1;
              When I run the program check1 always shows 'false' regardless of whether the
              checkbox is checked.
              I am running Weblogic 5.1.0 SP8
              The program works OK on Tomcat
              Any ideas ???
              Thanks in anticipation
              

    I had already pick that typo up I posted the wrong source code for the bean.
              "Nils Winkler" <[email protected]> wrote in message
              news:[email protected]...
              > The problem is in your bean class: The set-method's name should be
              > "setCheck1", not "setcheck1". Capitalization matters in this case (no
              > pun intended).
              >
              > Hope this helps,
              >
              > Nils
              >
              > Ian McDermid wrote:
              > >
              > > Hi,
              > >
              > > I have encountered a Java bean/JSP problem. I have developed a simple
              test
              > > case as follows:
              > >
              > > Paramtest.jsp:
              > >
              > > <html>
              > > <head>
              > > <title>Param Test</title>
              > > <body>
              > > <p>
              > > <form name="form1" method=post action="formtest.jsp">
              > > <input name="check1" type="checkbox">Check1
              > > <br>
              > > <input type="submit" value="OK" type="submit">
              > > </form>
              > > </body>
              > > </html>
              > >
              > > Formtest.jsp:
              > >
              > > <jsp:useBean id="cbtest" class="com.ebiffa.cbtest"
              > > scope="request" />
              > > <jsp:setProperty name="cbtest" property="*" />
              > > <html>
              > > <body>
              > > check1= <%= cbtest.getCheck1() %>
              > > </body>
              > > </html>
              > >
              > > cbtest.java:
              > >
              > > package com.ebiffa;
              > > public class cbtest {
              > >
              > > boolean check1;
              > >
              > > public void setcheck1 (boolean check1) {
              > > this.check1=check1;
              > > }
              > > public boolean getCheck1() {
              > > return check1;
              > > }
              > >
              > > }
              > >
              > > When I run the program check1 always shows 'false' regardless of whether
              the
              > > checkbox is checked.
              > >
              > > I am running Weblogic 5.1.0 SP8
              > >
              > > The program works OK on Tomcat
              > >
              > > Any ideas ???
              > >
              > > Thanks in anticipation
              >
              > --
              > ============================
              > [email protected]
              

  • Passing parameter from JS to Java Bean.

    We are using bing map to display outages data.
    Now requiement is
    in our JS we have
    var description;
    description=description + "<br><br>" + "Click " + "<a href='javascript:openPopUp()'>"+"*here*"+"</a>" + " to view full list of incidents";
    I am also getting cityname[i]
    so here i need to pass cityname on click of here to one of my java bean function.
    from where i am calling one method that takes city name as input and will return full list of incidents.

    here is how i was able to do .. In my javascript I am preparing param set and setting it to an event and raising this event.
    On my UI.. using a ServerListener.. I am binding this event to an bean method where I am able to access the param.
    here is the javascript:
    function myClientListener(event){
    var element = event.getSource();
    var param = {city:"new york", country:"US"};
    AdfCustomEvent.queue(element, "jsServerListener", param, true);
    event.cancel();
    jspx:
    <af:serverListener type="jsServerListener"
    method="#{MyBean.serverEventHandler}"/>
    bean method:
    public void serverEventHandler(ClientEvent clientEvent) {
    System.out.println(clientEvent.getParameters().get("city"));
    System.out.println(clientEvent.getParameters().get("country"));
    this may be helpful:
    http://naive-amseth.blogspot.com/2011/02/calling-methodbindingwebservice-on.html
    Amit

  • Regarding Full Web Browser Java Bean

    I am using Full web browser java bean, the problem is that I attach 2 java bean in main
    form when form run it shows perfectly but when other form open then these 2
    bean display in that form,means these beans display in each form.
    I attach these beans only in main form by the help of menu i open other form using OPEN_FORM.
    My window property of other form is"Dialog,Modal".
    Regards

    is there any possibility When New form get called
    * Hide the Bean Area.
    * Set With width,height to zero.
    * Change the axis.
    Regards

  • Problem with java beans and jsp on web logic 6.0 sp1

              HI ,
              I am using weblogic6.0 sp1.
              i have problem with jsp and java beans.
              i am using very simple java bean which stores name and email
              from a html form.
              but i am getting following errors:
              Full compiler error(s):
              D:\bea4\wlserver6.0sp1\config\mydomain\applications\DefaultWebApp_myserver\WEB-INF\_tmp_war_myserver_myserver_DefaultWebApp_myserver\jsp_servlet\_savename2.java:89:
              cannot resolve symbol
              symbol : class userbn
              location: class jsp_servlet._savename2
              userbn ud = (userbn) //[ /SaveName2.jsp; Line: 7]
              ^
              D:\bea4\wlserver6.0sp1\config\mydomain\applications\DefaultWebApp_myserver\WEB-INF\_tmp_war_myserver_myserver_DefaultWebApp_myserver\jsp_servlet\_savename2.java:89:
              cannot resolve symbol
              symbol : class userbn
              location: class jsp_servlet._savename2
              userbn ud = (userbn) //[ /SaveName2.jsp; Line: 7]
              ^
              D:\bea4\wlserver6.0sp1\config\mydomain\applications\DefaultWebApp_myserver\WEB-INF\_tmp_war_myserver_myserver_DefaultWebApp_myserver\jsp_servlet\_savename2.java:94:
              cannot resolve symbol
              symbol : class userbn
              location: class jsp_servlet._savename2
              ud = (userbn) java.beans.Beans.instantiate(getClass().getClassLoader(),
              "userbn"); //[ /SaveName2.jsp; Line: 7]
              ^
              3 errors
              in which directory should i place java bean source file(.java file)
              here is my jsp file:
              <%@ page language = "java" contentType = "text/html" %>
              <html>
              <head>
              <title>bean2</title>
              </head>
              <body>
              <jsp:usebean id = "ud" class = "userbn" >
              <jsp:setProperty name = "ud" property = "*" />
              </jsp:usebean>
              <ul>
              <li> name: <jsp:getProperty name = "ud" property = "name" />
              <li> email : <jsp:getProperty name = "ud" property = "email" />
              </ul>
              </body>
              <html>
              here is my bean :
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              import java.io.*;
              public class userbn implements Serializable
                   private String name ;
                   private String email;
                   public void setName(String n)
                        name = n;
                   public void setEmail(String e)
                        email = e;
                   public String getName()
                        return name;
                   public String getEmail()
                        return email;
                   public userbn(){}
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              pls help me.
              Thanks
              sravana.
              

              You realy can do it like Xiang says, but the better way is to use packages. That's
              the way BEA is designed for. If you use packages you can but your bean classes
              in every subfolder beneath Classes. Here for example we have the subfolders test
              and beans:
              You have to declare the package on top of your Bean Source Code:
              package test.beans;
              In your JSP you don't need the import code of Xiang. You only have to refer the
              path of your bean class:
              <jsp:useBean id="testBean" scope="session" class="test.beans.TestBean" />
              There are some other AppServers that only can deploy Java Beans in packages. So
              if you use packages you are always on the right side.
              ciao bernd
              "sravana" <[email protected]> wrote:
              >
              >Thank you very much Xiang Rao, It worked fine.
              >Thanks again
              >sravana.
              >
              >"Xiang Rao" <[email protected]> wrote:
              >>
              >><%@ page import="userbn" language = "java" contentType = "text/html"
              >>%> should
              >>work for you.
              >>
              >>
              >>"sravana" <[email protected]> wrote:
              >>>
              >>>HI ,
              >>>
              >>>I am using weblogic6.0 sp1.
              >>>
              >>>i have problem with jsp and java beans.
              >>>
              >>>i am using very simple java bean which stores name and email
              >>>
              >>>from a html form.
              >>>
              >>>but i am getting following errors:
              >>>
              >>>________________________________________________________________
              >>>
              >>>Full compiler error(s):
              >>>D:\bea4\wlserver6.0sp1\config\mydomain\applications\DefaultWebApp_myserver\WEB-INF\_tmp_war_myserver_myserver_DefaultWebApp_myserver\jsp_servlet\_savename2.java:89:
              >>>cannot resolve symbol
              >>>symbol : class userbn
              >>>location: class jsp_servlet._savename2
              >>> userbn ud = (userbn) //[ /SaveName2.jsp; Line: 7]
              >>> ^
              >>>D:\bea4\wlserver6.0sp1\config\mydomain\applications\DefaultWebApp_myserver\WEB-INF\_tmp_war_myserver_myserver_DefaultWebApp_myserver\jsp_servlet\_savename2.java:89:
              >>>cannot resolve symbol
              >>>symbol : class userbn
              >>>location: class jsp_servlet._savename2
              >>> userbn ud = (userbn) //[ /SaveName2.jsp; Line: 7]
              >>> ^
              >>>D:\bea4\wlserver6.0sp1\config\mydomain\applications\DefaultWebApp_myserver\WEB-INF\_tmp_war_myserver_myserver_DefaultWebApp_myserver\jsp_servlet\_savename2.java:94:
              >>>cannot resolve symbol
              >>>symbol : class userbn
              >>>location: class jsp_servlet._savename2
              >>> ud = (userbn) java.beans.Beans.instantiate(getClass().getClassLoader(),
              >>>"userbn"); //[ /SaveName2.jsp; Line: 7]
              >>> ^
              >>>3 errors
              >>>
              >>>____________________________________________________________
              >>>
              >>>in which directory should i place java bean source file(.java file)
              >>>
              >>>here is my jsp file:
              >>>--------------------------------------------------------
              >>>
              >>><%@ page language = "java" contentType = "text/html" %>
              >>><html>
              >>><head>
              >>><title>bean2</title>
              >>></head>
              >>><body>
              >>><jsp:usebean id = "ud" class = "userbn" >
              >>><jsp:setProperty name = "ud" property = "*" />
              >>></jsp:usebean>
              >>><ul>
              >>><li> name: <jsp:getProperty name = "ud" property = "name" />
              >>><li> email : <jsp:getProperty name = "ud" property = "email" />
              >>></ul>
              >>></body>
              >>><html>
              >>>
              >>>-------------------------------------------------------------
              >>>
              >>>here is my bean :
              >>>
              >>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              >>>
              >>>import java.io.*;
              >>>
              >>>public class userbn implements Serializable
              >>>{
              >>>
              >>>     private String name ;
              >>>
              >>>     private String email;
              >>>
              >>>     public void setName(String n)
              >>>     {
              >>>
              >>>          name = n;
              >>>     }
              >>>
              >>>     public void setEmail(String e)
              >>>     {
              >>>
              >>>          email = e;
              >>>     }
              >>>
              >>>     public String getName()
              >>>     {
              >>>
              >>>          return name;
              >>>     }
              >>>
              >>>     public String getEmail()
              >>>     {
              >>>
              >>>          return email;
              >>>     }
              >>>
              >>>     public userbn(){}
              >>>}
              >>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              >>>
              >>>pls help me.
              >>>Thanks
              >>>sravana.
              >>>
              >>
              >
              

  • Problems with a java bean in Weblogic 5.1

    Hello,
              I am having a problem deploying a java bean in Weblogic 5.1:
              I have been given a .class and a .jar file for a java bean (not an EJB). I
              placed the .class file into e:\temp\WEB-INF\classes and added the following
              line to my weblogic.properties file:
              weblogic.httpd.webApp.testApp=e:/temp/
              I have also updated the web.xml file in the WEB-INF directory as follows:
              <?xml version="1.0" encoding="UTF-8"?>
              <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
              Application 1.2//EN"
              "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
              <web-app>
              <servlet>
              <servlet-name>EdIface</servlet-name>
              <jsp-file>test.jsp</jsp-file>
              </servlet>
              <servlet-mapping>
              <servlet-name>EdIface</servlet-name>
              <url-pattern>EdIface</url-pattern>
              </servlet-mapping>
              </web-app>
              When I try to access my http:\\server:port\testApp\test I get an "Error
              500 - internal server error".
              Has anyone had experice with deploying a java bean with jsut the .class and
              .jar file? Where should I put the .jar file?
              I appreciate any advice!
              

    Bump

  • Problems with Java-Beans-Connectivity

    Post Author: dweise
    CA Forum: JAVA
    I'm new in crystal reports and try to connect a sample bean class to the java beans conectivity. Problem is that i only get JavaServerType=JavaBeans|JavaBeanName= for selection. Can anyone tell me what the problem is with my configuration. I followed the steps of the POJOTutorial.doc and the Configuration-Infos of the java_beans_connectivity.My System is w2k professional and for Crystal Reports i use the developer installation with Product Version 11.5.0.313 Thanks by now

    Post Author: pabhijit
    CA Forum: JAVA
    Could you send me the detailed steps and what point you are stucked.? I recently did something simillar and may be I would be able to help.

  • Implementing java beans in forms 10g [Problem]

    Hi All,
    I am trying to implement the java bean in the forms 10g
    I performed the following steps, but no luck.. Could anybody please help me in this?
    I have created a simple java class
    package mypackage1;
    public class MyClass
    public String GetString(String a)
    return a;
    Make a jar myjar.jar out of it.
    Copy this jar files in $ORACLE_HOME/forms/java directory
    and set the archive.jini parameter in formsweb.cfg to
    archive_jini=frmall_jinit.jar,Myjar.jar
    Created a simple form having one button, one textbox
    Set the implementation class property of text item to mypackage1.MyClass
    on button pressed trigger, I wrote
    set_custom_property('block2.text_item4',1,'GetString','Hello World');
    Ideally, on button pressed, it should show the text "Hello World" in the etxt box. But on button pressed nothing is happening and in java console on error is appearing.
    My java console output is
    Loading http://asst104253:8889/forms/java/frmall_jinit.jar from JAR cache
    Loading http://asst104253:8889/forms/java/Myjar.jar from JAR cache
    proxyHost=null
    proxyPort=0
    connectMode=HTTP, native.
    Forms Applet version is : 10.1.2.0
    Could anyone please tell me what I am doing wrong?? And how do I achieve this functionality??
    Please, any help appreciated !!

    Hi there
    The is plenty wrong with this code:
    1. MyClass is not extending VBean
    2. There is no public boolean setProperty(ID ID, Object args) method and no property IDs have been defined so set_custom_property('block2.text_item4',1,'GetString','Hello World'); will not execute anything
    3. If you're hoping to return values back from the bean, you need to define a custom event and associated ID.
    If you're just looking for some java code to return values in a similar manner as normal Oracle functions then you may want to consider using forms java stored procedures which are based on static java methods. Beans are really more for interaction type stuff with other applications.
    But any way if you want to do it this way (i.e. using beans) then at very least you class should look something like (Note, I have not compiled is so there may be a few errors):
    package mypackage1;
    import oracle.forms.handler.IHandler;
    import oracle.forms.ui.CustomEvent;
    import oracle.forms.properties.ID;
    import oracle.forms.ui.VBean;
    import oracle.forms.engine.Main;
    import oracle.forms.engine.*;
    import oracle.forms.handler.*;
    public class MyClass extends VBean
    // initiating event id
    protected static final ID pgetString = ID.registerProperty("GetString");
    // return value id
    private static final ID preturnValue = ID.registerProperty("returnValue");
    // return event id
    protected static final ID preturn = ID.registerProperty("returnEvent");
    static IHandler mHandler;
    public String GetString(String a)
    // may do some string manipulation here.
    return a;
    public boolean setProperty(ID ID, Object args)
    if (_ID== pgetString)
    if (_args instanceof String)
    String myArg = (String)_args;
    mHandler.setProperty(preturnValue,getString(myArg));
    CustomEvent ce = new CustomEvent(mHandler, preturn);
    dispatchCustomEvent(ce);
    Keep your button as is and then to return the value back into forms place a WHEN-CUSTOM-ITEM-EVENT trigger on the bean area with something like this:
    DECLARE
         BeanValListHd1 PARAMLIST;
         ParamType NUMBER;
         EvenName     Varchar2(20);
         CurrentValue Varchar2(2000);
    BEGIN
         BeanValListHd1 := get_parameter_list(:SYSTEM.CUSTOM_ITEM_EVENT_PARAMETERS);
         IF :SYSTEM.Custom_Item_Event = 'returnEvent' THEN
              IF iD_NULL(BeanValListHd1) THEN
              MESSAGE('NO PARAMETER FOUND FOUND');     
              ELSE
              GET_PARAMETER_ATTR(BeanValListHd1,'returnValue',ParamType,CurrentValue);
              MESSAGE('IN CUSTOM EVENT THE STRING RETURNED IS '|| CurrentValue);
              END IF;
         ELSE
              MESSAGE('no value');
         END IF;          
    END;
    hope this helps
    Q

  • Problems with the ActiveX bridge for Java beans when using third-party .jar

    I encountered the following problem when using the ActiveX bridge for a java bean:
    I am using JDK 1.4.2_09 and MS Visual Basic 6.0 (SP6). I wrote a java bean called ProcessViewer (my class ProcessViewer inherits from JComponent and implements the interfaces Serializable and AdjustmentListener) which I would like to use within a VB 6.0 application. I used the ActiveX bridge (packager.exe) to generate a DLL (ProcessViewer.dll) and registered it successfully. The java bean GUI-control works fine within my VB 6.0 application unless my java bean (ProcessViewer.jar) uses any third-party .jar files.
    But when I tried to add a reference to some third-party class (com.sap.xxx.xxx....) I got some problems. I could solve the problem with packager.exe by setting the correct CLASSPATH. But at runtime my VB 6.0 application does not work. It crashes or it reports an error like this: "The control ... could not be loaded from axbridge.dll" (although I deployed my .jar file correctly to the directory C:\Programme\Java\j2re1.4.2_09\axbridge\bin and lib). Setting the CLASSPATH environment variable before calling my VB 6.0 application (exe) did not solve the problem.
    How can I teach my VB 6.0 application (containing the Java bean ActiveX control) where to find the third-party .jar file? Copying the third-party .jar file to the JRE lib-folder or to the axbridge\lib folder did not solve the problem either.
    I studied the documentation about the ActiveX bridge given at:
    http://java.sun.com/j2se/1.4.2/docs/guide/beans/axbridge/developerguide/index.html
    but I am missing informations on how the third-party .jar files can be found during runtime of the ActiveX container (e. g. a VB 6.0 application).

    See how to solve your problem with JNI:
    http://codeproject.com/cpp/OOJNIUse.asp
    More examples (for SWING) in tools setup:
    http://www.simtel.net/product.php[id]95126[SiteID]simtel.net
    http://www.simtel.net/product.php[id]94368[SiteID]simtel.net
    http://www.simtel.net/product.php[id]93174[SiteID]simtel.net

  • Delete command are not executed in function of Java Bean

    Hello Sir,
    In Java bean have a function submitData.I want in this function run delete command through PreparedStatement..But Its not executed.
    Please review..
    public void submitData()
         try
    System.out.println("Printed*************************************************************");
    Class.forName("oracle.jdbc.driver.OracleDriver");
    System.out.println("Loading....");
    Connection con=DriverManager.getConnection("jdbc:oracle:thin:@VijayKumar-PC:1521:XE","SYSTEM","SYSTEM");
    System.out.println("Connection created");
    PreparedStatement st=con.prepareStatement("delete  from simple where NAME='?' and BNAME='?' ");
    String User=getUserName();
    st.setString(1,User);
    String Bname=getBookName();
    st.setString(2,Bname);
    int y= st.executeUpdate();
    System.out.println(y);
    System.out.println("Query Executed");
    con.commit();
    con.close();
    System.out.println("Your Book are Submitted *****************");
    catch(Exception e)
    e.printStackTrace();
    }Thanks.

    Dear Sir,
    I removed the singleaquotes from preparedstatement.But Its not executed in this function.Like:
    public void submitData()
         try
    System.out.println("Printed*************************************************************");
    Class.forName("oracle.jdbc.driver.OracleDriver");
    System.out.println("Loading....");
    Connection con=DriverManager.getConnection("jdbc:oracle:thin:@VijayKumar-PC:1521:XE","SYSTEM","SYSTEM");
    System.out.println("Connection created");
    PreparedStatement st=con.prepareStatement("delete  from simple where NAME=? and BNAME=? ");
    String User=getUserName();
    st.setString(1,User);
    String Bname=getBookName();
    st.setString(2,Bname);
    int y= st.executeUpdate();
    System.out.println(y);
    System.out.println("Query Executed");
    con.commit();
    con.close();
    System.out.println("Your Book are Submitted *****************");
    catch(Exception e)
    e.printStackTrace();
    }Allthough Insert command is properly executed in another function of Java Bean.
    Please review...
    Thanks.

  • Problem KeyEvent Java Bean  (Francois Degrelle)

    Hello !
    I have a problem with the KeyEvent Java Bean (keykressed.zip)
    from the Forms - PJC and JavaBean store !
    1.
    I call a forms-dialog and use the KeyEvent Java Bean.
    (Set_Custom_Property('BL.BEAN',1,'INIT','')
    2.
    I call a second forms-dialog and use the KeyEvent Java Bean too.
    Set_Custom_Property('BL.BEAN',1,'INIT','')
    3.
    Now i go back to the first forms-dialog and this dialog hangs...
    (No input over keyboard possible !)
    Maybe you can help me ?
    Many thanks in advance !
    Thomas

    Hello,
    Re-load the JAR file from the article.
    I still get an error in the Java console after closing the second dialog, but the key is correctly sent to the first form, so it seems to be OK.
    Francois

  • 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

  • Using Java Beans in Java Server Pages

    Can we not use a method of Java Bean in a Java Server Page ?
    I am trying to retrieve the user email from a java bean method "getUserEmail". I am instantiating the class, but when I try to use that in JSP tags, I am getting an error.
    <jsp:useBean class = "formjavabean.application" id = "applicationId" scope = "session" />
    <%@ page import="java.io.*, java.lang.*" %>
    <%!
    String user = applicationId.getUserEmail() ;
    String f3 = "ftn03" ;
    String f3not = "ftn03 file not uploaded";
    ...........I am failing in debugging that, can anyone help plz ?

    Here is my whole code in parts:
    First the head section:
    <head>
    <title> Fastran </title>
    <jsp:useBean class = "formjavabean.application" id = "applicationId" scope = "session" />
    </head>JSP part in the body section :
    <%@ page import="java.lang.*, java.io.*" %>
    <%!
    private String f3 = "ftn03";
    private String f3not = "ftn03 file not uploaded";
    private String f7 = "ftn07";
    private String f7not = "ftn07 file not uploaded";
    private String f9 = "ftn09";
    private String f9not = "ftn09 file not uploaded";
    public String checkFile3()
        File ch3 = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn03") ;
        if (ch3.exists() == true)
            return f3 ;
        else
            return f3not ;
    public String checkFile7()
        File ch7 = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn07") ;
        if (ch7.exists() == true)
            return f7 ;
        else
            return f7not ;
    public String checkFile9()
        File ch9 = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn09") ;
        if (ch9.exists() == true)
            return f9 ;
        else
            return f9not ;
    %>Java Script in the body section, using methods defined in the JSP part:
    <script type="text/javascript">
            function validate_file ( )
                    var file3 = "<%= checkFile3() %>" ;
                    var file7 = "<%= checkFile7() %>" ;
                    var file9 = "<%= checkFile9() %>" ;
                    if ( file3 != "ftn03" || file7 != "ftn07" || file9 != "ftn09" )
                        alert("Please upload the required file") ;   
                        return ("fastran.jsp") ;
                    else
                        return ("processForm.jsp") ;
            function validate_upload ( )
                    valid = true;
                    if ( document.val_file.filefield.value == "")
                            alert("Please select a file for upload") ;
                            valid = false;
                    return valid;
        </script>Finally the form and button part of the page, in the body section:
    <form name = "val_file" method="post" action="upload.jsp" name="submit" enctype="multipart/form-data" onSubmit = "return validate_upload();">
    Upload Files: <input type="file" name="filefield" >&nbsp&nbsp<input type="submit" name="submit" value="Upload"><br>
    <font color = "Red"><h5>(ftn03,ftn07, and ftn09)</h5></font><br><br><br>
    Files on the server :<br><br>
    <font color = "Green"><h5>
    <%= checkFile3() %><br>
    <%= checkFile7() %><br>
    <%= checkFile9() %><br>
    </h5></font>
    <br><br><br><br><br><br><br><br><br>
    <input type=button onClick="location.href='logintest.jsp'" value='Home'>  <input type=button onClick="location.href=validate_file()" value='Proceed' ><br>
    </form>Now try this:
    Change <%! to <%, or try using bean method as:
    String userEmail = applicationId.getUserEmail() ;..........and that is my problem. I would really appreciate any help, thanks

  • Java.beans.Statement & java.sql.Statement

    My old code from jdk1.3.1 throws the ambiguous class thingie-mo-bob. Why did they implement the new java.beans.Statement, and is there anyway to make it default to the old java.sql.Statement without having to go through all the old code and add import java.sql.Statement. I have like 200 jsp files 'n it will take a loooong time!
    Pete

    There r two ways to do this.
    (i) One is Implement the java.sql.Statement
    like
    package java.beans;
    public interface Statement implements
    java.sql.Statement {
    }What? Are you suggesting he edit the source code for java.beans.Statement and make it implement java.sql.Statement?? I would most certainly not suggest that solution- beside violating the licensing agreement, it has troubling consequences since you are basically redefining the structure of a class in a way that makes no functional sense- that is, there is no reason for java.beans.Statement to implement methods like getConnection() and the other signatures of java.sql.Statement.
    I'm not sure if I'm reading your response correctly or not, but I would definitely not refactor java.beans.Statement just to get this problem solved with out editing files ... ... since java.sql.Statement is used so widely, perhaps they should have considered a different name for java.beans.Statement , although you hate to base a name off of what's going to cause the least problems, rather then what makes the most sense ... ... any way, I guess it doesn't matter now: the name has been selected .... I'd be interested to hear how you solved the problem.

  • What makes a Java Bean invaild for a model import?

    I'm busy prototyping some functionality that will expose some MDM 5.5 data through a WebDynpro application.  I'm having a problem creating a java bean that will sit in front of an EJB, in that the Bean importer will refuse to import a bean if a certain line of code in a method is visible.  Here's the offending code from the method:
    try {
         A2iResultSet rs = cat.GetRecordsByValue(ary, rsd, Schema.MyTable.NAME);
         setEventLocation(rs.GetValueAt(0, Schema.MyTable.EVENT_LOCATION).GetStringValue());
    } catch (StringException e) {
         setEventLocation("failed to find record");
    Note that I have a class instance variable called 'eventLocation', which has get/set methods defined for it, thereby satisfying the Javabean requirement.
    The first two lines of the 'try' block are the problem.  If I comment them out and assemble the DC, I can import the Bean into a model with no issues.  If I uncomment them, I cannot import the bean - I get a message that says 'Invalid Jar - no beans to import'.
    Can someone explain why this is happening?  Does it have something to do with the StringException?  As far as I can tell from the Java bean model import documentation, I think I'm doing everything correctly, but something must be amiss.
    Suggestions?

    Pablo,
    Now I understand your question in comments to my blog better
    You have to add "ejb20" classes to your WebDynpro project as well, and import model afterwards.
    In WebDynpro DC expand path (<project> -> DC MetData -> DC Definition -> Used DC) and invoke "Add Used DC..." in contextual menu. In dialog select "<dev. config> -> SAP-J2EE -> ejb20 -> DC MetaData -> Public Parts -> default". Set dependencies Built-time (probably Design-time as well). Click OK. Try to import model. If fails, restart IDE and try to import again.
    Valery Silaev
    EPAM Systems
    http://www.NetWeaverTeam.com/

Maybe you are looking for