Is this a javabean?

I am a newcomer in java and I am taking over the codes from my predecessor. And today i read some javabean codes below. but there seems to be no difference between javabean and the general class?
------------------------------------------------------code-------------
package com.hqcomm.beans;
import java.io.PrintStream;
import java.sql.*;
public class DbBean
public ResultSet executeQuery(Connection connection, String s)
ResultSet resultset = null;
try
Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
resultset = statement.executeQuery(s);
catch(SQLException sqlexception)
System.err.println("db.executeQuery: " + sqlexception.getMessage());
return resultset;
public int executeSQL(Connection connection, String s)
int i = 0;
try
Statement statement = connection.createStatement();
i = statement.executeUpdate(s);
statement.close();
catch(SQLException sqlexception)
System.err.println("db.executeUpdate: " + sqlexception.getMessage());
return i;
public boolean changepwd(Connection connection, String s, String s1)
boolean flag;
flag = false;
try
String s2 = " update A_Register set C_PassWD = '" + s1 + "' where RegisterId = '" + s + "' ";
Statement statement = connection.createStatement();
int i = statement.executeUpdate(s2);
System.out.println(s2 + "****" + i);
if(i == 1)
flag = true;
else
flag = false;
statement.close();
catch(Exception exception)
System.err.println(exception);
return flag;
public static String toChinese(String s)
try
if(s == null)
return null;
else
s = new String(s.getBytes("ISO-8859-1"), "GB2312");
return s;
catch(Exception exception)
return null;
}

All java beans are java
classes and not vice-versa. Wrong, for example the Math or System class aren't beans.
A class needs to meet certain requirements in order to call itself bean.
One is to hava a public constructor, which does not take any arguments.
For the official specs of java beans see
http://java.sun.com/products/javabeans/docs/spec.html
and documents referenced therein.
For a lot of the day to day work you can use the strongly simplified version:
a bean is a class with a public constructor an properties which a accessible through getPropertyName and setPropteryName
regards
Spieler

Similar Messages

  • Can't reference methods in a Bean from a Composite JSF Component.

    I have the following composite component TestCC.xhtml:
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
    xmlns:cc="http://java.sun.com/jsf/composite" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <cc:interface>
    <cc:attribute name="manager" method-signature="java.lang.String helloTest()" required="true"/>
    </cc:interface>
    <cc:implementation>
    Hello #{cc.attrs.manager} !!!!!!!!!!!!!!!!!!!!!
    </cc:implementation>
    </html>
    When I try to call it in a JSFF file:
    <?xml version='1.0' encoding='UTF-8'?>
    <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:icc="http://java.sun.com/jsf/composite/IchipComponent">
    <icc:TestCC manager="#{viewScope.PatientClinicalBean.helloTest}"/>
    The page crashes at my composite tag with the following message in the console:
    javax.el.ELException: //C:/Documents and Settings/tlam/Application Data/JDeveloper/system11.1.2.3.39.62.76.1/o.j2ee/drs/iCHIP/ViewControllerWebApp.war/WEB-INF/classes/META-INF/resources/IchipComponent/TestCC.xhtml: javax.el.PropertyNotFoundException: //C:/Documents and Settings/tlam/Application Data/JDeveloper/system11.1.2.3.39.62.76.1/o.j2ee/drs/iCHIP/ViewControllerWebApp.war/Patient/Profile/Clinical.jsff @13,86 manager="#{viewScope.PatientClinicalBean.helloTest}": The class 'patient.profile.PatientClinicalBean' does not have the property 'helloTest'.
    But my managed bean does have a public String helloTest() method, as well as other methods that work fine elsewhere in my JSFF page:
    public class PatientClinicalBean{
    String test = "TESTING";
    public String helloTest() {
    return test;
    I have tried this many times with different methods, all with the same result. Yet if my composite component outputs just a string and I enter the expression <icc:TestCC manager="#{viewScope.PatientClinicalBean.test}"/> to access the String test field directly it executes properly. I can't seem to reference any of the methods in PatientClinicalBean from only my composite component, when other method calls work fine in the same JSFF page. All other examples I've seen on the web have no problems doing this the same way I have, am I missing something?!
    Edited by: tnology on 24-Oct-2012 14:13
    Edited by: tnology on 24-Oct-2012 14:14
    Edited by: tnology on 24-Oct-2012 14:16

    What if you change the method in the class like this?
    public String getHelloTest() {
      return test;
    }If you attempt to read a property call abc from a bean, you need to have a method called getAbc(). If you attempt to set a property called abc, you need to have a method called setAbc(...). This is JavaBeans convention.

  • How to design a client object???

    hello,Michael Wooten
    thank for your help, now I know the list of Java data types for the parameters
    and return values, and their corresponding SOAP data types.
    but how to design a client object, f.e: this object is value Object in ejb, their
    have some gets and sets methods, these set methods, their return type is void
    in java, but now in web service,how to deal with these prolem?
    like ejb, we have ejb's design pattern, for web service, do we have their design
    pattern also?
    thanks :-)

    Hi littlehill,
    In general, you want to think of the input parameters (and return values) for
    a web service method as "hierarchical state", not objects :-)
    The main motivation for taking this approach is to reduce the likelihood of interoperability
    issues with other (noteably non-Java) SOAP packages. The JavaBean model provides
    a simple, easy to implement mechanism for creating "hierarchical state", because
    it allows nesting. Using this nested JavaBean approach, you should be able to
    create an object graph that represents your "value object", but again the key
    here is to not thinking of them (the value objects) as objects, but state ;-)
    Each SOAP (or Web Services) toolkit will have a different approach and API for
    writing SOAP clients, unless it supports JAX-RPC. This being the case, it is a
    bit difficult to come up with an "across the board" design for a web service client
    ;-) In the case of Java-based SOAP toolkits, most developers prefer to "stay in
    the object world" as opposed to dealing with XML parsing APIs. To accommodate
    this desire, most Java-based SOAP toolkits have a "XML-to-Java, Java-to-XML" type
    mapping mechanism to handle the complexities of this task. If you don't want to
    muck around with type mappings, you should look around for a product that can
    generate Java classes from XML Schema, and vis-versa. WLS 7.0 does a better good
    of this than WLS 6.1, so you might want to check it out. I've also had a fair
    amount of success with the Exolab Castor data binding package (http://castor.exolab.org/sourcegen.html).
    It has a very comprehensive implementation of "XML Schema Part 1: Structures"
    and "XML Schema Part 2: Datatypes", is open-source, and works quite well. When
    you get down to it, a good XML Schema processor is key to saving yourself lots
    of frustration and coding.
    Regards,
    Mike Wooten
    "littlehill lee" <[email protected]> wrote:
    >
    hello,Michael Wooten
    thank for your help, now I know the list of Java data types for the parameters
    and return values, and their corresponding SOAP data types.
    but how to design a client object, f.e: this object is value Object in
    ejb, their
    have some gets and sets methods, these set methods, their return type
    is void
    in java, but now in web service,how to deal with these prolem?
    like ejb, we have ejb's design pattern, for web service, do we have their
    design
    pattern also?
    thanks :-)

  • Rich text

    sir,
    Many customers continue to demand the ability to enter rich text in form fields (i.e. bold, underline, font, size, color etc). I have seen in one article that it is possible this with Javabeans/Custom Java. Please give some examples in step by step for the implementation of bold, font size change etc. By using OLE, we can print only one page text. Please help me.

    Suresh,
    actually there is no native widget in Forms that allows you rich text handling. If using a Java Bean in Forms, then this wont work on client/server. The sample available is a bean that does render HTML in Forms, so that rich text defined by HTML tags shows correct. We are aware of this requirement and will keep an eye on it.
    Frank

  • Print JSP/HTML Pages (perhaps PDF?)

    Hi,
    i have a table in HTML generated by JSP.
    Just like the following simple example:
    ...<table>
    <%
    for( Enumeration et = free.getSqlIDs().elements(); et.hasMoreElements();)
    String keyt = (String)et.nextElement();
    Bean b = new Bean();
    b.init(path,DB);
    b.setID(keyt);
    b.restore();
    %>
    <tr>
    <td>
    <%out.print(b.getName());%>
    </td>
    <td>
    <%out.print(b.getAdress());%>
    </td>
    </tr>
    %>
    </table>...
    No i want to give a button to the user. When pressed, the HTML-Page should transform to PDF.
    With such a method i want to print the HTML-Page.
    I Know that this is possible with the help of XML/XSP and a stylesheet. But i like to do that with this way:JavaBeans-->JSP-->HTML-->PDF
    Anyone a solution, some code examples for me?
    Or perhaps another solution to print HTML-Pages in a fine design?
    Thank you for your help
    Andy

    Hi,
    no one any idea?
    How do you print Jsp Pages?
    Thank you
    Bye
    Andy

  • Need some tip sendRedirect();

    Actually i got 2 java and one jsp file.. from jsp i'm taking the input thru form and validating using javabean in a java file, in middle i got servelet file to get the input from the jsp and sending this value thru request to javabean. I validate this in javabean and again i'm sending the result to the servlet.
    upto this it is working fine....
    how can i send this result to the jsp file...
    thanx in advance
    kumar

    sorry for the inconvenience!
    Actually i need the differenece between sendRedirect (); and requestDespatcher();.
    the requestDespatcher() class got 2 methods forward() and include() what is the use of the above two methods.
    kumar
    Can you please elucidate your question so as that
    more people can grasp and post their replies.Will do. Sorry.
    The OP said "thanks in advance", which implied to me
    that he expects me or someone else to do something
    for him. Since he did not give that information, I
    asked what he's still lacking, in order to get a
    clarifying reply so I or someone else can fill in the
    gap.

  • Java*

    I'm trying to get a picture of the broader Java world.
    Reading the docs, I came across this:
    "A JavaBean is a reusable software component that is written in the Java programming language."
    Can somebody tell me what that means? How is that different from writing any other class?
    Also, what is JavaScript? It sounds like some kind of front end batch processing language but of what use is a scripting language front end to a "regular" programming language?
    Thank you.

    "A JavaBean is a reusable software component that is
    written in the Java programming language."
    Can somebody tell me what that means? How is that
    different from writing any other class?A JavaBean has specific requirements as to method names and their relations to the member variables of the class. A "simple" Bean has only member variables and "get/set" methods for those variables.
    Also, what is JavaScript?JavaScript, a poor naming choice by Netscape to jump on the "brand new" Java lanaguage bandwagon (this was a while back) is an embedded scripting language (of sorts) that's used in web pages and "interpreted" by the user's browser. It has no relation to Java except for the name. Other names/versions are "VBScript" and "ECMAScript"

  • What's wrong with this JavaBean?!

    I'm new to JSP and there is an example which I'm trying to run but get an error.
    I'm working on Eclipse 3.2 with WTP plugin and use Tomcat
    The code is as follows:
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
    <%!
    // This is a local "helper" bean for processing the HTML form
         static public class localBean
              private String value;
              public String getValue() {return value;}
              public void setValue(String s) {value=s;}
    %>
    <jsp:useBean id="localBean" scope="page" class="localBean">
         <%-- Every time we create the bean, initialize the String --%>
         <jsp:setProperty name="localBean" property="value" value=""/>
    </jsp:useBean>
    <jsp:setProperty name="localBean" property="*" />
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Using JavaBeans</title>
    </head>
    <body>
         <center>
              <p><h1>Hello <jsp:getProperty name='localBean' property='value'/></h1></p>
              <form method=post>
                   <br>Enter a name to be greeted:
                   <input type="text" size="32" name="value" value="<jsp:getProperty name='localBean' property='value'/>">
                   <br>
                   <input type="submit" value="Submit">
              </form>
         </center>
    </body>
    </html>and the error is:
    Sep 28, 2006 12:13:32 PM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    org.apache.jasper.JasperException: /HWBean.jsp(15,0) The value for the useBean class attribute localBean is invalid.
         at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
         at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
         at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146)
         at org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1174)
         at org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
         at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
         at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
         at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
         at org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
         at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
         at org.apache.jasper.compiler.Generator.generate(Generator.java:3305)
         at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
         at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Thread.java:797)Message was edited by:
    linumax

    Does 'localBean' doesn't have a 'package' statement?
    (It seems like it should.)
    Should your page have an import statement?
    <%@ page import="com.mycompany.localBean" %>
    ode]
    Message was edited by:
    coyotlno package, the bean is local (declared within the JSP) and therefore I don't think there's a need for any kind of import
    correct me if I'm wrong

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

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

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

  • What is the diffrence between a javabean and  EJB

    hi!
    what is the diffrence between a javabean and entreprise jvaabeans! i mean which are the uitilization featires of eaxh one !

    i am seeking for a solution for my problem , in fact i ma trying to implement and develop an application with java that allows a certain range of IP adresses to be connected to a database server in order to extract the suitable data from the server .
    let me explain mor ethe suitation , in fact what i am loking for is to use javabeans to grant my application much more consistence and pertinence : si i am asking if it could be possible to use javabeans in my case especially if i am not trying to developp a web application but a cleint /server one allowing some services.
    The application is in fact dealing with a stock exchange market and what i am trying to do is to grant particilar registrated customers to have the informations that they need ( portofolio, currency's status, market indicators, .) also drawing some charts decribing rates, variations, and others specefic financial caracterestics .So , if we consider that this application is not a web application ( no HTTP request and no servers like apache or others ) how it is possible to use javabeans and not EJB to build the application? i mean what could be suitable and preferable to rely on and dvelop to ensure a good java application !!
    if you need more details to help you find the answer for me don't hesitate to answer me back !!
    Someone here gave me that answer
    use RMI to code the services and (Updateable) Value Objects to pass the information between tiers.
    RMI is an all-java distributed component framework (ie. EJB, CORBA, DCE/RPC, DCOM, etc.), that is very suitable for developing non-containerized multi-tier applications. Refer to the RMI trail in the Java Tutorial as a starting point for coding RMI solutions (http://java.sun.com/docs/books/tutorial/index.html). Under this scenario you would code the database access service as an RMI service (server-side). Client/server communication should be facilitated through the use of JavaBeans/classes that wrap the information being passed (customer information, portfolio details, market information, etc.) - these are refered to as 'Updateable Value Objects' (a design pattern). Graphing and charting would be handled in your client from the information received from the (RMI) server. GUI JavaBeans can be used to provide this functionality as well as other client-side services. There are numerous "shrink-wrapped" components for GUIs available on the market just peruse any Java magazine to find them.
    but how comes? how can i do it !! and where can i find more information please about 'Updateable Value Object "
    thanks

  • Problem retrieving javabean instance from request in JSP

    I am using WSAD and I created a javabean called confirmBean in default package which contains two private properties fname, lname and public setters and getters
    In a servlet I placed values in the bean, then placed the bean in a request and then forwarded to confirm.jsp
    confirmBean cb = new confirmBean();
    cb.setFname("testing");
    req.setAttribute("mybean", cb);     
    req.getRequestDispatcher("/confirm.jsp").forward(req,res);
    Here is my JSP, I used java syntax for retrieving javabean:
    <HTML>
    <HEAD>
    <TITLE>confirm.jsp</TITLE>
    </HEAD>
    <%@ page
    language="java"
    contentType="text/html; charset=ISO-8859-1"%>
    <%@ page import="confirmBean"%>
    <BODY>
    <% confirmBean myBean = (confirmBean)request.getAttribute("MYBEAN"); %>
    <%= myBean.getFname() %>
    </BODY>
    </HTML>
    and here is the error i am getting when executing:
    Error 500: Unable to compile class for JSP c:\testWorkspace\.metadata\.plugins\com.ibm.etools.server.core\tmp0\cache\localhost\server1\Test\TestWeb.war\_confirm.java:3: '.' expected import confirmBean; ^ An error occurred at line: 11 in the jsp file: /confirm.jsp Generated servlet error: c:\testWorkspace\.metadata\.plugins\com.ibm.etools.server.core\tmp0\cache\localhost\server1\Test\TestWeb.war\_confirm.java:78: cannot resolve symbol symbol : class confirmBean location: class org.apache.jsp._confirm confirmBean myBean = (confirmBean)request.getAttribute("MYBEAN"); ^ An error occurred at line: 11 in the jsp file: /confirm.jsp Generated servlet error: c:\testWorkspace\.metadata\.plugins\com.ibm.etools.server.core\tmp0\cache\localhost\server1\Test\TestWeb.war\_confirm.java:78: cannot resolve symbol symbol : class confirmBean location: class org.apache.jsp._confirm confirmBean myBean = (confirmBean)request.getAttribute("MYBEAN"); ^ 3 errors
    Please help!!!!

    1 - Put your bean in a proper package. As of Java1.4 classes in the default package are not visible :
    http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=c85f07c1ce8f344d787b7a5146d68:WuuT?bug_id=43615752 - As a matter of style, class names should always start with a capital letter. ie ConfirmBean
    3 - Rather than declaring the bean, and retrieving it, from the request manually, have a useBean tag:
    <jsp:useBean id="MYBEAN" class="com.mypackage.ConfirmBean" scope="request"/>
    of course the id has to be the same as the attribute in scope.
    Hope this helps,
    evnafets

  • Problem with JavaBeans in JSP.IT'S URGENT!!!

    Hi, i have problems with JavaBeans in JSP.
    In a jsp file( locating in ROOT directory of tomcat 4.0.6 :jakarta-tomcat-4.0.6\webapps\root ) i have this code:
    <jsp:useBean id="paramBean" class="licentza.ParamBean" />
    <jsp:setProperty name="paramBean"
    property="nume"
              value='<%= request.getParameter("numeUser") %>' />
    where ParamBean it's a "bean" class locating in jakarta-tomcat-4.0.6\webapps\examples\web-inf\classes\licentza (licentza is the package i'm using).
    And i get this error:
    Generated servlet error:
    D:\jakarta-tomcat-4.0.6\work\Standalone\localhost\_\dora\intrare2$jsp.java:67: Class licentza.ParamBean not found.
    ParamBean paramBean = null;
    What is the problem?Thank you.

    Hi,
    Put the class file or the package under :jakarta-tomcat-4.0.6\webapps\root\WEB-INF\classes.
    Rajesh

  • JSP, JavaBeans and iPlanet 4.1-  Unable to load JavaBean

    I get the following error when trying to access a JavaBean from a JSP page. I have tried just about everything including using the <@page import /> in the JSP page.
    I can get it to run perfectly in Tomcat 3.2 but it must run in iPlanet 4.1. I think the solution should be fairly simple I just can't find it.
    Any help would be greatly appreciated.
    Thanks.
    The exception is as follows (thrown on running the generatePage.jsp linked from index.jsp).
    [29/Nov/2001:16:50:23] info ( 1364): Internal Info: loading servlet /TechCom/generatePage.jsp
    [29/Nov/2001:16:50:23] info ( 1364): JSP: JSP1x compiler threw exception
    org.apache.jasper.JasperException: Unable to load class JspPageLoader
         at org.apache.jasper.compiler.BeanRepository.getBeanType(BeanRepository.java:183)
         at org.apache.jasper.compiler.GetPropertyGenerator.generate(GetPropertyGenerator.java:97)
         at org.apache.jasper.compiler.JspParseEventListener$GeneratorWrapper.generate(JspParseEventListener.java:728)
         at org.apache.jasper.compiler.JspParseEventListener.generateAll(JspParseEventListener.java:190)
         at org.apache.jasper.compiler.JspParseEventListener.endPageProcessing(JspParseEventListener.java:159)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:141)
         at com.netscape.server.http.servlet.NSServletEntity.load(NSServletEntity.java:214)
         at com.netscape.server.http.servlet.NSServletEntity.(NSServletEntity.java:104)
         at com.netscape.server.http.servlet.NSServletRunner.loadServlet(NSServletRunner.java:607)
         at com.netscape.server.http.servlet.NSServletRunner.Service(NSServletRunner.java:357)
    [29/Nov/2001:16:50:23] warning ( 1364): Unable to locate class: D:\Netscape\Server4\docs\TechCom (java.lang.ClassNotFoundException: D:\Netscape\Server4\docs\TechCom)
    [29/Nov/2001:16:50:23] warning ( 1364): Internal error: Failed to load servlet (servlet=/TechCom/generatePage.jsp)

    To solve this problem you have to:
    include <@page import /> tags importing the JavaBean to be used.
    In the classpath of iPlanet include the directory in which your JavaBeans are placed.
    Also in the classpath of iPlanet include the root directory of you web site containing the JSP's. this should then solve the problem.

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

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

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

  • How to format this table in jsp page?

    I have a table in database and there are four data field in it.They are "id","name","email","registetime".
    In javabean,I add all this data to a vector:" ResultSet rs;
    while(rs.next()){
    vec.add(rs.getString("id");
    vec.add(rs.getString("name");
    vec.add(rs.getString("email");
    vec.add(rs.getString("registetime");} ";
    I use a Iterator to read all the data to jsp page:"
                   iter=vec.iterator();
                   while(iter.hasNext()){
                   int i=0;               
                   %>
                   <table border="1" bordercolor="#FF6699" bgcolor="#CCCC99">
                   <%
                   if(i==0|i%8==0){
                   out.println("<td><tr>");
                   %>
                   <%=iter.next()%>
                   </td>
    <%
                   if(i%8==0)
                   out.println("</tr></td>");
                   i++;
                   %></table>
    I use a variable i for change range.I want to output a '\n' after output 4 data.But now the data in IE is this:
    1
    lyo
    [email protected]
    2003-6
    2
    Yashnoo
    [email protected]
    2003-7
    It not that I want to get.I means I want to get data like this:
    1 lyo [email protected] 2003-6
    2 Yashnoo [email protected] 2003-7
    How can I do? :(

    Anyone has idea?But I change it to this:
    <body>
    <table border="1" bordercolor="#FF6699" bgcolor="#CCCC99">
    <%
    Iterator iter=null;
    ResultSet rs=null;
    Vector vec=new Vector();
    vec=lyo.addData(rs,vec);
    iter=vec.iterator();
    try{
    while(iter.hasNext()){
    int i=0;
    %>
    <%
    if(i%8==0){
    out.print("<tr>");
    out.print("<td>");
    %>
    <%=iter.next()%>
    <%
    out.print("</td>");
    if(i%8==0){
    out.print("</tr>");
    i++;
    %></table>
    <%
    }catch(Exception e){
    out.println(e.toString());
    %>
    It can't help? Why?

Maybe you are looking for

  • Solution Manager 4.0 Security

    Hi all, If anybody has experience with the Solution Manager 4.0 Security, could you please share the list of authorization objects used for implementation of Solution Manager for the following scenarios: 1. Implementation & Distribution, 2. Roadmaps,

  • Classification, Batch Management, Serialisation Profile along with QM

    Hi All GURUS,         I have very interesting scenario to work on. My client requirement is to identify produciton lot seperately and maintain production data seperately for each production lot. Also for some materials client requires to maintain uni

  • Third party benchmarks for WLS

    Does anyone have a reference for third party benchmarks for WLS 5.1 or 6.0 vs other J2EE app servers? Also performance of built-in WLS web server vs Apache or NES? Thanks, Eric Chiu

  • Trouble with OSX client registering in SCCM

    I am having a weird issue with a OSX client failing to register in SCCM.  Our infrastructure is a CAS and three primary sites.  On one of the primary sites (we will call it "Site 3"), I have a DP with the MP role on it to support HTTP clients and a s

  • Flickering Desktop Background Yosemite

    Hello! I have a 15" MacBook Pro early 2011, recently upgraded OS X to Yosemite 10.10.1, Specs: Processor: 2 GHz Intel Core i7; Memory: 4 GB 1333 MHz DDR3; Graphics: Intel HD Graphics 3000 384 MB. I was working with Word and suddenly the keyboard stop