Writing java bean class?

Hi All,
In my scenario,I am getting all pagelevel details from the database.
I mean Suppose in my web application 10 pages are there.for 10 pages, all details (like page title,button names,page header etc) based on user.per user it will vary .Some body have insert,update buttons ,some body not.
I was created java bean with static getters and setters for all pages to get the data and store.
I don't want to connect to the database to get the page details per every page.so,
its working for me.what happen if more than one user access the application.The details will effect to all when new user enter into the system?
any suggestions.....................................????
if I write non - static getters and setters ,I need to instantiate everypage.
its takes more memory ,In my web application I have above 75 pages.
solution???

1)So,I need to pass the Class object to the
session.setAttribute()
right?
Well to be precise - you create an instance of the class (object) for each registered and logged in user and then yes - store the object as a session attribute
>
2)Suppose I change my bean to instance bean,bean have
above 20 instance variables .I think performance
point of view,Its not good.
Because,if users are more than 20 what happend?
You should probably think about 200 :). 20 users is not an issue wwhen you have sufficient hardware.
One option would be to store the user permission/preferences in the db and associate it with the user id. Infact for large applications that hold lots of user related data per user, that would be my preferred approach.
ram.

Similar Messages

  • Dynamic Java bean classes for XSD using JAVA (not any external batch or sh)

    Hi,
    How can we generate dynamic Java bean classes for XSD (dynamically support All XSD at runtime)?
    Note: - Through java code via only needs to generate this process. (Not using any xjc.bat or xjc.sh from JAXB).
    Thanks

    Muthu wrote:
    How can we generate dynamic Java bean classes for XSD (dynamically support All XSD at runtime)?
    Pretty sure you can't. Probably can do a lot of them with years of work.
    And can probably can do a resonable subset suitable for the business at hand with only a moderate effort.
    Note: - Through java code via only needs to generate this process. (Not using any xjc.bat or xjc.sh from JAXB).The Sun jdk, not jre, comes with the java compiler as part of it. You can create in memory class (I believe in memory) based on java code you create.
    I believe BCEL alllows the same thing (in memory) but you start with byte codes.
    You could just create a dynamic meta data solution as well, via maps and generic methods. Not as fast though.

  • Java Connectivity - No classes appearing in the Java Beans Classes dropdown

    Hi,
    VERY NEW user to Crystal Reports.  I am trying to create a report using a java class as a datasource.  I have updated the setting in the CRConfig.xml file, and can get the Java Beans Connectivity screen to appear, but is shows none of my classes in the dropdown.  I found a knowlege base entry that indicated this problem was caused by the JavaBeansClassPath value in the CRConfig.xml file being invalid.  But I've verified the location and it is pathed directly to the classes.
    Not sure what I am missing, but any help is greatly appreciated.
    Thanks!

    Ted,
    Thanks for the reply.  I checked out each of your suggestions, but haven't had any luck thus far.  Here's what I found:
    1.  We created a simple method in an existing public class to return a ResultSet.  The method looks like this:
    public ResultSet GetAllMediaTypesRS()
          String strFuncName = "ScsXDMDatabase::GetAllMediaTypesRS : ";
          ScsDebug coutDebug = new ScsDebug();
          String strSqlStmt;
          String strMediaType;
          ScsStringList sslReturnList = new ScsStringList();
          // Create the SQL to get all the Displayable Media Types.
          strSqlStmt =
             "SELECT DISTINCT mt.Media_Type_Name "
                + "FROM dbo.Media_Type mt "
                + "WHERE mt.Media_Type_Rqst_Display_Ind = 1 "
                + "ORDER BY mt.Media_Type_Name";
          coutDebug.println(strFuncName + "SQL Statement:  " + strSqlStmt);
          // Run the Query
          Statement stmt = null;
          ResultSet SQLResult = null;
          try
             stmt = GetConnection().createStatement();
             SQLResult = stmt.executeQuery(strSqlStmt);
          } //End of Try
          catch (SQLException sqle)
             if (sqle.getErrorCode() != 0)
                coutDebug.println(
                   "Error in ExecuteQuery: "
                      + "Error code - "
                      + sqle.getErrorCode());
                coutDebug.println("Message - " + sqle.getMessage());
          return SQLResult;
    The signature, and the method look fine to us, but maybe we are missing something obvious.
    2. We do use JDK 1.5 to compile the classes, but my JavaDir setting in the CRConfig.xml file points to jre1.6.0_02.  I assume this is OK.
    3. We do see java.exe start up when opening the JavaBeans connection.
    4. No firewall issues as we are inside our corporate network.
    Any other thoughts or ideas?  I did see a knowledge base entry that indicated the cause of this particular problem is that the JavaBeansClassPath in CRConfig.xml is incorrect or invalid.  I've validated the path takes me right to the classes, so I believe that is OK.  Is there some way that we can see the actual path that is searched when the JavaBeans connection is opened?
    Thanks for your help.
    --john davies

  • Where to put the java bean classes

    Hi,
    I am very new to the web service developer pack. I have written a java bean but don't know which directory to place it. Can anyone please tell mi???
    Thanks

    put in
    WEB-INF/classes
    if is a jar file
    put in
    WEB-INF/lib
    regards

  • Java Bean Classes not showing up in drop down

    Post Author: Cdog
    CA Forum: JAVA
    I've set the <JavaBeansClassPath>C:\Basement\vo</JavaBeansClassPath> and even added it the the ClassPath in the CRConfig.xml but nothing is showing up.
    Please advise me on what I am leaving out.
    Thank you,

    Post Author: Ted Ueda
    CA Forum: JAVA
    I'd try jar-ing the JavaBean and explicitly putting the path to the jar file into that tag.  This would ensure no issues with subfolder access.Sincerely,Ted Ueda

  • Java server page compiler can not find a class defined in a java bean file

    I have a jsp file using java bean. The java bean class file is uploaded into the server and also the directory to this java bean .class file is included in the Unix environment CLASSPATH. This .jsp file is registered and should be compiled and excecuted automatically.
    WHen I try to invoke this .jsp file, the jsp compiler error, saying the class defined by java bean can not be found. I already include this path in teh CLASSPATH, I thought the jsp compiler will go to the right place according to CLASSPATH to find the referenced class.
    Can anyone tell me what I have done wrong or what should I do in order to allow jsp compiler to find the class refrenced by .jsp file and defined by java bean file?
    Thank you so much

    hello friends,
    i am also facing the same problem of not finding bean class files for both jsp and servlet though it is placed in same package. the problem of not finding bean class file for jsp is experienced in Tomcat server only whereas in Blazix, there is no such error and the file is compiled and runs successfully.
    i have checked Tomcat properly. there is no error in its configuration also servlets without the use of bean files run successfully. so please can anybody guide me about what is the problem and how to solve it. plz its urgent .

  • Difference b/w Java Class and Bean class

    hi,
    can anybody please tell me the clear difference between ordinary java class and java Bean class. i know that bean is also a java class but i donno the exact difference between the both.
    can anybody please do help me in understanding the concept behind the bean class.
    Thank u in advance.
    Regards,
    Fazlina

    While researching this question, I came across this answer by Kim Fowler. I think it explains it better than any other answer I have seen in the forum.
    Many thanks Kim
    Hi
    Luckily in the java world the definition of components is a little
    less severe than when using COM (I also have, and still occasionaly
    do, worked in the COM world)
    Firstly there are two definitions that need to be clarified and
    separated: JavaBean and EnterpriseJavaBean (EJB)
    EJB are the high end, enterprise level, support for distributed
    component architectures. They are roughly equivalent to the use of MTS
    components in the COM/ COM+ world. They can only run within an EJB
    server and provide support, via the server, for functionality such as
    object pooling, scalability, security, transactions etc. In order to
    hook into this ability EJB have sets of interfaces that they are
    required to support
    JavaBeans are standard Java Classes that follow a set of rules:
    a) Hava a public, no argument constructor
    b) follow a naming patterns such that all accessor and modifier
    functions begin with set/ get or is, e.g.
    public void setAge( int x)
    public int getAge()
    The system can then use a mechanism known as 'reflection/
    introspection' to determine the properties of a JavaBean, literally
    interacting with the class file to find its method and constructor
    signatures, in the example above the JavaBean would end with a single
    property named 'age' and of type 'int' The system simply drops the
    'set' 'get' or 'is' prefix, switches the first letter to lower case
    and deduces the property type via the method definition.
    Event support is handled in a similar manner, the system looks for
    methods similar to
    addFredListener(...)
    addXXXListener
    means the JavaBean supports Fred and XXX events, this information is
    particularly useful for Visual builder tools
    In addition there is the abiliity to define a "BeanInfo' class that
    explicitly defines the above information giving the capability to hide
    methods, change names etc. this can also be used in the case where you
    cannot, for one reason or another, use the naming patterns.
    Finally the JavaBean can optionally - though usually does - support
    the Serializable interface to allow persistence of state.
    As well as standard application programming, JavaBeans are regularly
    used in the interaction between Servlets and JSP giving the java
    developer the ability to ceate ojbect using standard java whilst the
    JSP developer can potentially use JSP markup tags to interact in a
    more property based mechanism. EJB are heaviliy used in Enterprise
    application to allow the robust distribution of process
    HTH.
    Kim

  • WDVisibility type paramter in Java Bean(Web Dynpro DC in CE 7.1)

    Hi All,
    I need to set a WDVisibility type paramter in a java bean and i am able to do so.It imports com.sap.tc.webdynpro.progmodel.api.WDVisibility class .
    The problem is when i am creating a Java Bean model  it is not allowing me to select the Java bean class it gives an error message" Invalid Class : No class files found for JavaBean : com/sap/tc/webdynpro/progmodel/api/WDVisibility".
    The java Bean class exists in Web Dynpro DC>src folder.
    Any Pointers?
    Regards
    Avinash

    Hi Ondrej ,
    Refer the above links to convert the component of the first dc as a public part.
    Then declare the methods which are written in the component controller of the first DC in the interface controller with the same signature.( When method is called automatically component controller method is called)
    In second dc in component controller properties tab add the reference of the first dc.
    Then access the method in second dc as
    wdthis.wdget<UsedComponent name>Interface.methodname();
    Thanks & Regards,
    Ardhendu

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

  • Stepping into Java Beans from JSP

    I am trying to figure out how to step into the Java Source code for my beans that are used in my JSP pages. I need to be able to debug them by stepping into them, using break points, etc.
    I have Nitro installed and a sample JSP page with the import to my test Java Bean class. What I did was create two projects in my work space. One as a Web project application and one as a Java project. I referenced and opened both projects. Everything compiles fine and the syntax is correct.
    The problem is I can not make the link for importing the class.
    I get this error: Class com.BrianTest.MyBean not found in import com.BrianTest.MyBean
    Anyone got a clue or a good example? I did try and add the class path and I tried to put it in a Jar file and attach the source to the Jar, but same problem.
    Thanks :?

    Stepping into jsp:useBean is not possible, but you can step-into jsp getter & setter tag.
    Since you are using java bean from a dependent project you need to configure your server with DevLoader.
    And currently only Tomcat server can be configured with Sysdeo Devloader to handle this situation
    Download Sysdeo DevLoader for Tomcat from http://www.sysdeo.com/eclipse/tomcatPlugin.html
    NOTE: If the project is self sufficient and not dependent on other projects/locations for classess/libraries then NitroX picks up all the libraries & classes present within default WEB-INF/lib & WEB-INF/classes respectively. And in this case you need not modify server configuration.
    Sysdeo DevLoader is to allow your web project to use libraries/classes from dependent projects. All you need to do is extract DevLoader.zip present within tomcatPluginV3.zip inside your Tomcat/server/classes folder.
    For more information about DevLoader please refer to http://www.sysdeo.com/eclipse/readmeDevLoader.html
    This will solve your problem and you should be able to run/debug your application. And most important make sure you have the correct NitroX build that supports Sysdeo DevLoader, refer http://www.m7.com/whatsnew.htm document against your build id (Help > About NitroX > NitroX Icon)

  • Calling Java Bean From JSP

    <%@ page contentType="text/html;charset=windows-1252" errorPage = "error.jsp"%>
    <%@ page import="java.sql.*,java.io.*,javax.sql.*, mypackage1.*"%>
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
        <title>Process</title>
      </head>
      <body>
          <P align="center">
            <STRONG><FONT face="Algerian" size="6" color="#0033cc">Result from the Query</FONT></STRONG>
          </P>
          <P align="center"> </P>
          <P align="center"> </P>
          <P align="center"> </P>
          <P align="center"> </P>
          <P align="center">
       <%
            int rowsChanged;
            Connection con;
            try
              String sql;
              sql = request.getParameter("query");
              System.out.println(sql);
              session=request.getSession(true);
              String name = (String)session.getAttribute("theID");
              String password = (String)session.getAttribute("paswd");
              String driver="oracle.jdbc.OracleDriver";
              Class.forName(driver);
              String url ="jdbc:oracle:thin:@minerva.humber.ca:1521:grok" ;      
              con = DriverManager.getConnection(url,name,password);
              if(sql.substring(0,6).equalsIgnoreCase("Select"))
                  Statement stat = con.createStatement();
                     ResultSet rs = stat.executeQuery(sql);
          %>
         <jsp:useBean id="myBean" scope="page" class="mypackage1.Table" >
               </jsp:useBean>
             <jsp:setProperty name="myBean" property="*" param="<%rs%>"/>
          <%
            myBean.setTable(rs);
            out.println(myBean.getTable());
         %>
          <%
           else
              Statement stat = con.createStatement();
              rowsChanged = stat.executeUpdate(sql);
              out.println("<h3><STRONG><FONT face=Algerian size=5 color=#0033cc>Number of rows affected are: "+rowsChanged+"</h3></Strong></Font>");
           }//End of Try
           catch(Exception e)
              System.out.println(e+ "gd"+ e.getMessage());     
          %>
          </P>
            <P align="center">
            <a href="check.jsp">Please Click Here to Return to Main Page</a>
          </P>
      </body>
    </html>Above is my JSP file, which is calling a Java bean class called Table. The thing is that Its not returning any Table from the Table Class. I dont know how to use Java bean as I m new to it. Following is my Table Class. So If anyone can plz help me then it would be great. I m suffering from 2 days just because of this class and JSP.
    package mypackage1;
    import java.io.Serializable;
    import java.sql.ResultSet;
    import java.sql.ResultSetMetaData;
    public class Table implements Serializable
      private ResultSet rs;
      public Table()
      public void setTable(ResultSet result)
        rs = result;
      public String getTable()
             String output=null;
             try
                    ResultSetMetaData metadata;
                    metadata=rs.getMetaData();
         // find the number of fields in customer table
                    int col=metadata.getColumnCount();
                    output = "<table/><tr/>";
                    for(int i=1;i<=col;i++)
                        output+="<td/><b/>"+metadata.getColumnName(i)+"</b/></td/>";
                    output += "</tr/>";
                    while (rs.next())
                           output="<tr/>";
                           for(int i=1;i<=col;i++)
                             output+="<td/>"+rs.getString(i)+"</td/>";
                           output += "</tr/></table/>";
                    }//End of While
               catch(Exception e)
        return output;
      }//End of Table method
    }//End of Class

    First reaction: yuck.
    This is not something you should be using a bean for.
    Beans are meant for storing data, not for generating HTML from.
    I don't really like queries on a JSP page either, but thats a different story again.
    I would recommend you use JSTL for this.
    1 - it provides a c:forEach tag for looping
    2 - it provides sql tags for doing queries in a database
    IF you are going to do database queries from a JSP page, I absolutely recommend you use the JSTL tags.
    (end rant)
    Your problem is probably caused by the fact that in your bean you have the following
    try{
      // code here
    catch (Exception e){
      // completely ignore exception and carry on as if nothing bad happened.
      // what you should be doing is something like:
      System.out.println("Error occurred " + e.getMessage());
      e.printStackTrace();
      return e.getMessage();
    }Cheers,
    evnafets

  • Java Bean Model in WebDynpro

    Hi,
    I have build am Java Bean Class which I use in a WebDynpro Model. In this Java Bean Class i want to call a remote method via RMI.
         public String calculate(int aFirst, int aSecond)
              float theResult = 0;
              try {
                   Properties p = new Properties();
                   p.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
                   p.put(Context.PROVIDER_URL, "nitse06u:50004");
                   p.put(Context.SECURITY_PRINCIPAL, "Administrator");
                   p.put(Context.SECURITY_CREDENTIALS, "admin");
                   Context initialContext = new InitialContext(p);
                   Object ob = initialContext.lookup("Calculator");
                   CalculatorHome home = (CalculatorHome) PortableRemoteObject.narrow(ob, CalculatorHome.class);
                   Calculator theCalculator = home.create();
                   theResult = theCalculator.add(aFirst, aSecond);
              catch (Exception ex)
                   ex.printStackTrace();
              return new Integer(((new Float(theResult))).intValue()).toString();
    At runtime following exception occurred.
    java.lang.NoClassDefFoundError: com.sap.examples.calculator.CalculatorHome
         at com.sap.calculator.helper.CalculatorHelper.calculate(CalculatorHelper.java:109)
         at caom.sap.webdynpro.CalculatorComponentView.onActionCalculate(CalculatorComponentView.java:150)
         at caom.sap.webdynpro.wdp.InternalCalculatorComponentView.wdInvokeEventHandler(InternalCalculatorComponentView.java:144)
         at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
         at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
         at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleAction(WebDynproMainTask.java:100)
         at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleActionEvent(WebDynproMainTask.java:299)
         at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:635)
         at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)
    How can I add the home and remote classes to my webdynpro?
    Regards 
    Richard

    You could try to put the ejbClient.jar (the jar file that was generated in your ejb project) into the lib directory of your webdynpro project.
    Everything in the lib directory is deployed with the Webdynpro application.
    To see the lib directory you have to change to the navigator view in the IDE.
    It is right under the Project root.
    If you have Development Component Projects this is a different story. You can add the public part in your ejb DC (of type assembly) to the DC usages in the WebDynpro DC. The type assembly means then, that the jar file from the ejb project is taken and packaged with the WebDynpro DC. But watch out. For this to work you have to do a real DC build and a real DC deploy not the deploy and run function. Hope this helps.

  • Java Bean Importer

    Hi
    I am trying to import a Java bean into webdynpro component. I have exposed the Java bean class as public part and I am using this as a used DC in webdynpro.
    I am trying to create a model from Java bean importer and i select the Jar of the java bean I am getting the following error.
    java.lang.Exception: Invalid Class - JavaBean not available for import
    Class :javax/ejb/CreateException
    Jar :C:\Documents and Settings\Administrator\.dtc\1\DCs\ibm.com\jdidemo\maint\java\_comp\gen\default\public\CommandBean\lib\java\comjdidemomaintjavaCommandBean.jar
         at com.sap.ide.metamodel.importers.javabean.JavaBeanAnalyser.identifyClassesForJar(JavaBeanAnalyser.java:1187)
    Any help is appreciated.
    Regards
    NagaKishore V

    Hi,
      please check the steps to be implemented to import the Jave Bean.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1f5f3366-0401-0010-d6b0-e85a49e93a5c
    Please refer the blog as well.
    /people/valery.silaev/blog/2005/08/30/javabean-model-import-when-it-really-works
    hope that helps.
    Regards,
    S.Divakar
    Message was edited by: Divakar Salla

  • Eclipse: transform normal awt/swing app to bean class?

    hi all.
    i have to modify an existing java app that's based on awt and swing. i'd like to edit in in visual editor for eclipse (java bean classes), but how can i do that? is it possible anyhow??
    thanks.
    j0sh

    i do have a visual editor plugin, but it uses "visual" classes, and now id like to know how to transform normal classes to visual classes... =)

  • Java Bean usage

    folks
    i have a pageflow and i have one jsp in a pageflow and i am using a Java Bean class inside this pageflow to collect all the information from the JSP when the user submits the page, Well i want to know whether i can use this Java Bean outside of the JPF as a value object or i should use a different value object, Infact my JPF is talks to a Java Control, So i was thinking how do i get that Java Bean object inside a Java Control,
    Any advices is appreciated,
    Thanks
    portalman

    here is an idea: forget about patterns, stop worrying about doing it "the one and only correct way" and simply use your brain.
    Its all personal preference and usually very much depending on the situation. You could use only one bean, but some situations will call for the creation of a separate bean that can hold additional information, or even several beans. Sometimes the framework you use already forces the creation of specific beans.
    There is only one thing that will help you to determine which situation calls for which approach: experience. Until then you'll just have to make plenty of mistakes like the rest of us have at the beginning of our careers. But there is one tip I can give you that may save you some time: if you look at your code and things just aren't as simple as they should be: you have a design flaw. Usually when you keep going with it, you'll hit some sort of limitation that'll cause you to see how the code design should have been from the beginning. Eventually you'll get into that situation often enough that you'll automatically do it right from the beginning. As I said: experience.

Maybe you are looking for

  • Using iPhoto Library with Windows XP

    Hello folks, I have searched many forums far and wide, but have yet to encounter anyone suffering from my particular problem. I have found many out there who want to use iPhoto on their PC, but they are all offered solutions that don't really work fo

  • Why is Solaris 11 iso so small ?

    This post is not about Solaris 11 express. This is about Solaris 11 released on November 9, 2011 I remember download Solaris 10 (august 2011) release for x86_64. It was just above 2gb. Why the newly released Solaris 11's text based Installer is only

  • Printing slow after Snow Leopard Upgrade

    Hi! Newbie here! I recently upgraded my 2007 iMac to Snow Leopard and as a result my Canon BJC-2100 printer has slowed to a crawl. It seems the software adjusted the print quality to the sharpest setting but this also slowed the process way down. I d

  • Questions on BW security 'rules'

    I asked this question last week in the ASUG BW forum, but have not received any replies there, till date. Hope somebody from the user community here can answer these questions? 1. Does anybody use table authorization groups in BW 2. Does anybody use

  • How to update itunes 10.6.3

    Hello whenever I try to update itunes, it says that i cannot do it because there is aproblem. But I cannot uninstall itunes either... How can I update itunes? Thanks in advance helaron