Java bean implementation

i 'm developing a web service, in my service part , i got a complex type that i should return in a java bean.
I have a class in which i have defined my java bean, in an other class
I have extracted content from a database, i don't know how to process it to the java bean.
please help

From the class where you extracted content from the database, create a new bean and set the information through a set function.
example:
database.java
//get info from DB
InfoBean infoBean = new InfoBean();
infoBean.setName( <nameresultFromDB>);
infoBean.setCountry( <countryresultFromDB>);
etc.
if you got multiple beans to save, you should create a bean holder class that holds multiple beans for you.

Similar Messages

  • Frm-13008 Cannot find Java Bean/Implementation of Webutil

    Hi,
    I have implemented all the steps as per the Webutil doc but still i am getting the above error.
    I have set the FORMS90_BUILDER_CLASSPATH to
    D:\OraHome1\jlib\importer.jar;D:\OraHome1\jlib\debugger.jar;D:\OraHome1\jlib\utj90.jar;D:\OraHome1\jlib\dfc90.jar;D:\OraHome1\jlib\help3.jar;D:\OraHome1\jlib\help3-nls.jar;D:\OraHome1\jlib\oracle_ice5.jar;D:\OraHome1\jlib\ewt3.jar;D:\OraHome1\jlib\share.jar;D:\OraHome1\forms90\webutil\lib\webutil.jar;D:\OraHome1\forms90\java\f90all.jar;D:\OraHome1\jdk\jre\lib\rt.jar;D:\OraHome1\jdev\lib\jdev-rt.jar
    My enviroment is as follows:
    Oracle 9iDS 9.0.3,Oracle 9i and Windows 2000.
    Regards
    Deepak

    Deepak,
    try with less entries in the Forms90_Builder_Classpath. You have appr. 400 characters but Windows has a limit at 256.
    Frank

  • 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

  • Implementation of java bean

    hi
    every body...i am trying to implement a java bean, i have created the java class and it runs successfuly in jdeveloper envoirnment and after its deployment as jar file i implement it as bean in a bean area in my oracle form and it gives frm-92100
    error!!!!! any help???????
    zulfiqar

    thanks Degrelle for replying my post....
    but i could not get you.....as i have created a bean area on my canvas and it is visible as well and i have given my java class name in its implementation class property. what else it needs. i run that class from jdk and it runs successfully and even the other classes in the same jar file are being implented successfuly but this one is not... any further guidlines.......??
    best regards
    zulfiqar

  • What is the difference between java direct or java bean in JSP?

    What is the difference if I use java code directly in JSP or use java bean in JSP?
    Which class to use for receiving the passed parameter from html or java script? Any difference for java code and java bean in the way receiving the passed data?
    How can I pass string from jsp to html or java script?

    it's generally accepted as better design to separate presentation from logic. meaning, the java code in the jsp should be used to support displaying data, as oppsoed to implementing the application - like database access, etc.
    when the logic is separated from the presentation, it allows you to reuse logic components within several jsp pages.
    if you decide to change the presentation layer in the future (to support wap, for example) you don't need to rewrite your entire application, since the "guts" of the application is outside of the jsps.
    it is also a good idea to separate your business logic from your data layer. adding a "buffer zone" between these layers helps in the same manner as in separating presentation from logic. if you're using flat files for storage now, upgrading to a database wouldn't require rewriting all your business logic, just the methods which write out the data to a file, for example.
    once you feel comfortable with separating the various layers, check out the struts framework at http://jakarta.apache.org/
    to answer your second question, to get parameters passed in from HTML forms, use ServletRequet's getParameter() method.
    in tomcat:
    <% String lastName = request.getParameter( "lastname" ); %>
    to answer your third question: when displaying the HTML from withing a jsp, print out the string to a javascript variable or a hidden form element:
    <% String firstName = "mike"; %>
    <input type="hidden" name="firstname" value="<%= firstName %>">
    <script language="javascript1.2">
    var firstName = "<%= firstName %>";
    </script>
    this jsp results in the following html:
    <input type="hidden" name="firstname" value="mike">
    <script language="javascript1.2">
    var firstName = "mike";
    </script>

  • Java Bean Connectivity and Closing Connections (XI 3.0)

    Hi guys,
    We have existing Java Beans that we would like to use with Crystal Reports. Our current Java beans return a disconnected GridModel and explicitly close the connection immediately after so that they can be returned to the connection pool (Oracle).
    Once we modified these beans to return ResultSets we found that closing the connection also closes all the associated ResultSets and Statements.
    What is the best practice here?
    Modify the Java bean to close the connection in the finally block?
    Will Crystal clean up after itself?
    I also see there is something called a CachedRowSet which is disconnected:
    http://java.sun.com/j2se/1.5.0/docs/api/javax/sql/rowset/CachedRowSet.html
    Is this supported by Crystal?
    Thanks,
    Kevin D Lee =)

    Hello Kevin,
    Enterprise XI 3.0 CRConfig.xml points to Java JRE 1.5 provided with the install, so you should be ok with the CachedRowSet. 
    It's used by other customers for disconnected operation.
    Since you're going to Oracle, you'd likely encounter issues mapping Oracle fields to POJO property types.
    Furthermore, POJO Factory libraries that were shipped with Crystal Reports XI Release 2 aren't shipped with Enterprise XI 3.0, so you'd not find that an out-of-the-box option. 
    Another alternative to CachedRowSet is to define callback method in your JavaBeans class that Crystal will call when it's done with the data source. 
    This has been implemented in XI 3.0 (track ADAPT00877915) - excerpt from the track note:
    <JavaBeans>
        <CacheRowSetSize>100</CacheRowSetSize>
         <JavaBeansClassPath>c:\javabeans\</JavaBeansClassPath>
         <CallBackFunction>CrystalReportsLogoff</CallBackFunction>
    </JavaBeans>
          Customer can configuration the <CallBackFunction/> to let CR know
          which function should be invoked when loging off.
    Advantage of CachedRowSet is that you can immediately close it after you've read all the data, disadvantage would be the default implementation stores all data in memory.
    Advantage of the callback method is that it would use the JavaBean you've supplied (and not load all data immediately in memory), but callback won't be called immediately, but only after the report is done with.
    Sincerely,
    Ted Ueda

  • 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.
              >>>
              >>
              >
              

  • Urgent : java bean having bidirectional one to many relationship

    Hi,
    We have complex requirement in our application.
    We need to copy java bean having bidirectional one to many relationship to another javabean having bidirectional one to many relationship..
    E.g
    Class Basket1 {
    public String color;
    pubic String type;
    public List<Basket1> basketList = new ArrayList()
    Class Basket2 {
    public String color;
    pubic String type;
    public List<Basket2> basketList = new ArrayList()
    We need to exact copy Basket1 to Basket2. We are in trouble to copy List of child because we do not have how many child Basket1 have of same type..
    Can someone help us how we can implement such kind of complex object bidirectional one to many relationship??

    I can't see anything bidirectional about these relationships. What I can see is a couple of BasketN classes that look identical so I don't know why they both exist, and they both contain lists of themselves as members, which suggests some kind of tree structure. Nothing bidirectional there. I can see tat these things can form circular object graphs but I don't see why you would want to do that.
    We need to exact copy Basket1 to Basket2And I don't know what that means. Please explain.

  • 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

  • Request parameter are not stored in database through Java Bean

    Hi,
    I want to store the request parameter in database through Java Bean.Allthough program are properly run but value are not store in DB.
    Here My code:
    Login.html:<html>
    <head>
    <title>A simple JSP application</title>
    <head>
    <body>
    <form method="get" action="submit.jsp" >
    Name: <input type="text" name="User">
    Password: <input type="password" name="Pass">
    <input type="Submit" value="Submit">
    </form>
    </body>
    </html>SimpleBean.java:
    package co;
    import java.util.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.util.*;
    public class SimpleBean implements java.io.Serializable{
    private String User="";
    private String Pass="";
    public SimpleBean(){}
    public String getUser() {
    return User;
    public void setUser(String User) {
    this.User = User;
    public String getPass() {
    return Pass;
    public void setPass(String Pass) {
    this.Pass = Pass;
    public void show()
         try
    System.out.println("Printed*************************************************************");
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    System.out.println("Loading....");
    Connection con=DriverManager.getConnection("jdbc:odbc:Ex11dump");
    System.out.println("Connected....");
    PreparedStatement st=con.prepareStatement("insert into Table1 values(?,?)");
    System.out.println("~~~~~~~~~~~~~~~~~~~~");
    String User=getUser();
    st.setString(1,User);
    String Pass=getPass();
    st.setString(2,Pass);
    int y= st.executeUpdate();
    System.out.println(y);
    System.out.println("Query Executed");
    con.commit();
    con.close();
    System.out.println("Your logging is saved in DB *****************");
    catch(Exception e)
    e.printStackTrace();
    }submit.jsp:
    <jsp:useBean id="obj" class="co.SimpleBean"/>
    <jsp:setProperty name="obj" property="*" />
    <jsp:getProperty name="obj" property="User" /> <br>
    <jsp:getProperty name="obj" property="Pass" /> <br>
    <% obj.show();%>
    <%
    out.println("Ur data is saved in DB");
    %>Please Help me.
    Thanks.

    The issue is in the naming of your fields.
    Change User -> user and Pass->pass
    Name: <input type="text" name="user">
    Password: <input type="password" name="pass">

  • Context mapping vs. Java beans

    Hi,
    I'm making a "Server" Component (Java Web Dynpro) that exposes a view to other "Client" Components (other Java Web DynPros). The Clients can insert the exposed view into their views to use the Server's services.
    The Server, obviously, has to be initialized with specific data from the Client.
    At first I thought of creating a context node in the Server, structured with all the attributes needed for its configuration, and then expose that node in the interface. In this way the Client creates a local copy of that node via node mapping and then populates its attributes with values. Once the client populates it in its wdDoInit() method, the embedded view's wdDoInit() method is called and the Server's View can initialize itself.
    Now, instead, I was considering using Java Beans (a class that wraps all the data that I've currently put in the context) because:
    1- The Client should not be able to alter the Server's configuration once it has been initialized. With context mapping the Client can alter at runtime the configuration node's content.
    2- The Server configuration has to be shared between multiple Server's views. When passing a configuration NodeElement as argument to methods shared between views, I've always the problem that I have to deal with the type of the NodeElement (the public interface of the component controller, the private interfaces of the views).
    What is the right way to do things in this scenario?
    Thanks to anyone who drops an answer,
    See you,
    Pietro
    PS. If it's unclear, let me know!

    You can implement some inteface at server,
    declare usage of this interface at client.
    then,
    you can initalise server component by getting that interface from server component,
    and calling methods with desired objects as arguments.
    other methods of this interface can be used to return server's configuration,
    so it will be shared.

  • "Java-Bean: True" missing after being packed in jar file

    Hi All
    X86, Windows XP Professional, J2SDK 1.4.2
    I complied a section of code ", which is from << Thinking In Java>>(3rd).
    Created a manifest file "BangBean.tmp"
    <<
    Name: bangbean/BangBean.class
    Java-Bean: True
    >>
    And then packed class files into "BangBean.jar" with command
    "jar cfm BangBean.jar Bang BangBean.tmp bangbean".
    It's puzzling that "Java-Bean: Ture" was missing in the "BangBean.jar/META-INF/MENIFEST.MF" .
    <<
    Manifest-Version: 1.0
    Created-By: 1.4.2 (Sun Microsystems Inc.)
    Name: bangbean/BangBean.class
    >>
    What's more, after altering the"BangBean.tmp" into this
    <<
    Java-Bean: True
    Name: bangbean/BangBean.class
    >>
    and had a another try.
    I got a jar file with such MENIFEST.MF.
    <<
    Manifest-Version: 1.0
    Created-By: 1.4.2 (Sun Microsystems Inc.)
    Java-Bean: True
    Name: bangbean/BangBean.class
    >>
    This jar file worked well in BDK's beanbox.
    I've test it with JSDK 1.5.0, the same thing happened.
    And I didn't encounter such problem in other bean programs.
    I've searched " 'Java-Bean: True' missing " with google, but didn't get proper answers.
    Is there anybody who can give a prompt about why this happend?
    Thanks a lot for your help!
    code
    //: bangbean:BangBean.java
    // A graphical Bean.
    package bangbean;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import com.bruceeckel.swing.*;
    public class
    BangBean extends JPanel implements Serializable {
    private int xm, ym;
    private int cSize = 20; // Circle size
    private String text = "Bang!";
    private int fontSize = 48;
    private Color tColor = Color.RED;
    private ActionListener actionListener;
    public BangBean() {
    addMouseListener(new ML());
    addMouseMotionListener(new MML());
    public int getCircleSize() { return cSize; }
    public void setCircleSize(int newSize) {
    cSize = newSize;
    public String getBangText() { return text; }
    public void setBangText(String newText) {
    text = newText;
    public int getFontSize() { return fontSize; }
    public void setFontSize(int newSize) {
    fontSize = newSize;
    public Color getTextColor() { return tColor; }
    public void setTextColor(Color newColor) {
    tColor = newColor;
    public void paintComponent(Graphics g) {
    super.paintComponent(g);
    g.setColor(Color.BLACK);
    g.drawOval(xm - cSize/2, ym - cSize/2, cSize, cSize);
    // This is a unicast listener, which is
    // the simplest form of listener management:
    public void addActionListener(ActionListener l)
    throws TooManyListenersException {
    if(actionListener != null)
    throw new TooManyListenersException();
    actionListener = l;
    public void removeActionListener(ActionListener l) {
    actionListener = null;
    class ML extends MouseAdapter {
    public void mousePressed(MouseEvent e) {
    Graphics g = getGraphics();
    g.setColor(tColor);
    g.setFont(
    new Font("TimesRoman", Font.BOLD, fontSize));
    int width = g.getFontMetrics().stringWidth(text);
    g.drawString(text, (getSize().width - width) /2,
    getSize().height/2);
    g.dispose();
    // Call the listener's method:
    if(actionListener != null)
    actionListener.actionPerformed(
    new ActionEvent(BangBean.this,
    ActionEvent.ACTION_PERFORMED, null));
    class MML extends MouseMotionAdapter {
    public void mouseMoved(MouseEvent e) {
    xm = e.getX();
    ym = e.getY();
    repaint();
    public Dimension getPreferredSize() {
    return new Dimension(200, 200);
    } ///:~
    ************************************************

    Since you didn't use code-formatting tags ([ code ] and [ /code ] without the spaces) it's kinda hard to look at it. But I'm sure it DID execute much more than just the return statement - maybe you're not closing a file or db connection, or maybe you're seeing a cached page, so it actually isn't executing ANYTHING on the server (is your browser set to never check for newer pages so it (almost) always returns from cache, for example?)

  • Java Bean does not display in Forms 9i

    Hi,
    I created a Java bean taht would not display in a Forms 9i application. I do not get any error messages, just nothing seem to happen. I did the following:
    1. Created a Java Bean with az Init() public function, packed it into a jar file and put it into <9iASHome>\forms90\java
    2. Added the jar file to the formsweb.cfg file's archive_jini.
    3. Created a Form with a Java Bean item on a canvas.
    4. Set the implementation property of the bean item to the full java 'direcotry' path of the class.
    5. Created the WHEN-NEW-FORM-INSTANCE trigger and put this code into it:
    fbean.register_bean('BLOCK3.BEAN_AREA4',1,'geoifsweb.ifsframe');
    After deploying the form to 9iAS and running it nothing seems to happen, only the place of the Java Bean appears on the Form. Teh Java Bean class extend a JFrame class, so I would expect it to appear on the screen.
    What am I missing? Thank you for any help or hint in advance.
    Regards,
    Tamas Szecsy

    Tamas
    When using fbean.register_bean you don't need to set the implementation class of the bean at design time.
    You must however supply the full package and class name in the register_bean call.
    Do you get any exceptions in the Java console?
    I'd also switch logging on (see FBEAN.Set_Logging_Mode)

  • Help with Login Form (JSP DB Java Beans Session Tracking)

    Hi, I need some help with my login form.
    The design of my authetication system is as follows.
    1. Login.jsp sends login details to validation.jsp.
    2. Validation.jsp queries a DB against the parameters received.
    3. If the query result is good, I retrieve some information (login id, name, etc.) from the DB and store it into a Java Bean.
    4. The bean itself is referenced with the current session.
    5. Once all that's done, validation.jsp forwards to main.jsp.
    6. As a means to maintain state, I prefer to use url encoding instead of cookies for obvious reasons.I need some help from step 3 onwards please! Some code snippets will do as well!
    If you think this approach is not a good practice, pls let me know and advice on better practices!
    Thanks a lot!

    Alright,here is an example for you.
    Assume a case where you don't want to give access to any JSP View/HTML Page/Servlet/Backing Bean unless user logging system and let assume you are creating a View Object with the name.
    checkout an example (Assuming the filter is being applied to a pattern * which means when a resource is been accessed by webapplication using APP_URL the filter would be called)
    public doFilter(ServletRequest req,ServletResponse res,FilterChain chain){
         if(req instanceof HttpServletRequest){
                HttpServletRequest request = (HttpServletRequest) req;
                HttpSession session = request.getSession();
                String username = request.getParameter("username");
                String password = request.getParameter("password");
                String method = request.getMethod();
                String auth_type  = request.getAuthType();
                if(session.getAttribute("useInfoBean") != null)
                    request.getRequestDispatcher("/dashBoard").forward(req,res);
                else{
                        if(username != null && password != null && method.equaIsgnoreCase("POST") && (auth_type.equalsIgnoreCase("FORM_AUTH") ||  auth_type.equalsIgnoreCase("CLIENT_CERT_AUTH")) )
                             chain.doFilter(req,res);
                        else 
                          request.getRequestDispatcher("/Login.jsp").forward(req,res);
    }If carefully look at the code the autherization is given only if either user is already logged in or making an attempt to login in secured way.
    to know more insights about where these can used and how these can be used and how ?? the below links might help you.
    http://javaboutique.internet.com/tutorials/Servlet_Filters/
    http://e-docs.bea.com/wls/docs92/dvspisec/servlet.html
    http://livedocs.adobe.com/jrun/4/Programmers_Guide/filters3.htm
    http://www.javaworld.com/javaworld/jw-06-2001/jw-0622-filters.html
    http://www.servlets.com/soapbox/filters.html
    http://www.onjava.com/pub/a/onjava/2001/05/10/servlet_filters.html
    and coming back to DAO Pattern hope the below link might help you.
    http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html
    http://java.sun.com/blueprints/patterns/DAO.html
    http://www.javapractices.com/Topic66.cjp
    http://www.ibm.com/developerworks/java/library/j-dao/
    http://www.javaworld.com/javaworld/jw-03-2002/jw-0301-dao.html
    On the whole(:D) it is always a good practice to get back to Core Java/J2EE Patterns.and know answers to the question Why are they used & How do i implement them and where do i use it ??
    http://www.fluffycat.com/java-design-patterns/
    http://java.sun.com/blueprints/corej2eepatterns/Patterns/index.html
    http://www.cmcrossroads.com/bradapp/javapats.html
    Hope that might help :)
    REGARDS,
    RaHuL

  • 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

Maybe you are looking for