Duke's Bannk Application

Could someone help. I tried populating the pointbase database by running this command at the commandline asant create-db_common, I get errors
Here are the errors
====================
Buildfile: build.xml
F:\Program%20Files\j2eetutorial14\examples\common\targets.xml could not be found
init:
create-db_common:
Buildfile: build.xml
F:\Program%20Files\j2eetutorial14\examples\common\targets.xml could not be found
init:
create-db_common:

Don't worry guys I've fixed it
Thanks

Similar Messages

  • Security check, j_security_check, Duke's Bank Application

    Hello all! I'm a newbie on j2ee and looking for answer to some thoughts.
    When looking at the "Duke's Bank Application" I found that the webclient use a form to authorize the user (logon.jsp), the form post to "j_security_check".
    - What is "j_security_check" and where is it defined?
    - In deplytool I noticed that the BankWAR have some security settings that are set to "Form Based" and that there are some login-stuff in web.xml but...how does it connect to j_security_check?

    I also got the same problem whenever I run the web client, the application client is working just fine. Please help!!!
    Thanks,
    ace

  • WEB CLIENT in Duke�s Bank Application

    Hi, I have a problem with running the WEB CLIENT in Duke�s Bank Application.
    First about the VERSIONs:
    I downloaded
    "The Java EE 5 Tutorial" For Sun Java System Application Server Platform Edition 9, dated: June 16 2006
    The source for the tutorial examples is obtained from the above mentioned "The Java EE 5 Tutorial" online, when on that page click on "Download". The downloaded file is
    javaee-5-doc-tutorial-1[1].0_01.
    I am running Sun Java System Application Server Platform Edition 9.0 (build b48).
    I am referring to what happens when I follow the instructions on pages 1209-1213 of the manual
    After you have read the description of the problem, please see below for output from running:
    ant create-tables
    ant
    ant deploy
    which I did according to the tutorial. Also I created the users according to the tutorial.
    As you can see below,
    ant reported �dukesbank-war\src\conf\persistence.xml� missing
    Could someone please explain why (and whether that is the reason for my problems).
    This seems significant (though I am an absolute beginner in J2EE and may be wrong). Would it be possible that the file �dukesbank-war\src\conf\persistence.xml� mistakenly was not included in the zipped source code file?
    APPLICATION CLIENT it would seem runs okay. I could log on as bankadmin, create a new customer.
    WEB CLIENT
    First of all the manual says the url is
    http://localhost:1189/dukesbank/main.faces
    but the url that works is
    http://localhost:1189/dukesbank-war/main.faces
    Is that just a small inaccuracy in the manual, or there is more to it?
    Now for the problem:
    I do get the page �Please enter your customer ID and password and click Submit�
    If I enter the user 200 (the one created as per the tutorial), I get:
    HTTP Status 403 - Access to the requested resource has been denied
    type Status report
    message Access to the requested resource has been denied
    description Access to the specified resource (Access to the requested resource has been denied) has been forbidden.
    Sun Java System Application Server Platform Edition 9.0
    However, if I enter a non-existing user I get the page �dukesbank-war/j_security_check � which tells me:
    �Please check your customer ID and password.�
    �. Which is of course a correct response. (I would get the same response with the correct user 200 but incorrect password, which also makes sense)
    So, what is the problem when I use a correct user name and password, why can't I proceed?
    THE ANT OUTPUTS:
    C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5\examples\dukesbank>ant create
    -tables
    Buildfile: build.xml
    -pre-init:
    init:
    check:
    tools:
    start-db:
    [exec] Database already started on host localhost, port 1527.
    [exec] Command start-database executed successfully.
    delete-tables:
    [sql] Executing file: C:\javaeetutorial5\examples\common\sql\javadb\de
    .sql
    [sql] 24 of 24 SQL statements executed successfully
    create-tables:
    [sql] Executing file: C:\javaeetutorial5\examples\common\sql\javadb\tu
    al.sql
    [sql] 181 of 181 SQL statements executed successfully
    BUILD SUCCESSFUL
    Total time: 9 seconds
    C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5\examples\dukesbank>ant
    Buildfile: build.xml
    -pre-init:
    init:
    default-ear:
    -pre-init:
    init:
    default-ear:
    -pre-compile:
    bpp-actual-compilation:
    [echo] Compiling dukesbank-ejb
    [mkdir] Created dir: C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5\exam
    ples\dukesbank\dukesbank-ejb\build\jar
    [javac] Compiling 25 source files to C:\javaee-5-doc-tutorial-1[1].0_01\java
    eetutorial5\examples\dukesbank\dukesbank-ejb\build\jar
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    -post-compile:
    compile:
    package:
    bpp-package-persistence-unit-war:
    bpp-package-persistence-unit-ejb-jar:
    [copy] Copying 1 file to C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5
    \examples\dukesbank\dukesbank-ejb\build\jar\META-INF
    package-persistence-unit:
    [delete] Deleting: C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5\example
    s\dukesbank\dukesbank-ejb\build\dukesbank-ejb.jar
    [jar] Building jar: C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5\exa
    mples\dukesbank\dukesbank-ejb\build\dukesbank-ejb.jar
    [delete] Deleting directory C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial
    5\examples\dukesbank\dukesbank-ejb\build\jar
    bpp-copy-dist:
    [copy] Copying 1 file to C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5
    \examples\dukesbank\dukesbank-ejb\dist
    default-not-ear:
    default:
    -pre-init:
    init:
    default-ear:
    copy-common-jars:
    -pre-compile:
    bpp-actual-compilation:
    [echo] Compiling dukesbank-appclient
    -post-compile:
    compile:
    package:
    [mkdir] Created dir: C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5\exam
    ples\dukesbank\dukesbank-appclient\build\app-client
    [copy] Copying 27 files to C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutoria
    l5\examples\dukesbank\dukesbank-appclient\build\app-client
    [delete] Deleting: C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5\example
    s\dukesbank\dukesbank-appclient\build\dukesbank-appclient.jar
    [jar] Building jar: C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5\exa
    mples\dukesbank\dukesbank-appclient\build\dukesbank-appclient.jar
    [delete] Deleting directory C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial
    5\examples\dukesbank\dukesbank-appclient\build\app-client
    bpp-copy-dist:
    [copy] Copying 1 file to C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5
    \examples\dukesbank\dukesbank-appclient\dist
    default-not-ear:
    default:
    Trying to override old definition of task iterate
    -pre-init:
    init:
    default-ear:
    build-common:
    -pre-init:
    init:
    default-ear:
    -pre-compile:
    bpp-actual-compilation:
    [echo] Compiling dukesbank-ejb
    [mkdir] Created dir: C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5\exam
    ples\dukesbank\dukesbank-ejb\build\jar
    [javac] Compiling 25 source files to C:\javaee-5-doc-tutorial-1[1].0_01\java
    eetutorial5\examples\dukesbank\dukesbank-ejb\build\jar
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    -post-compile:
    compile:
    package:
    bpp-package-persistence-unit-war:
    bpp-package-persistence-unit-ejb-jar:
    [copy] Copying 1 file to C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5
    \examples\dukesbank\dukesbank-ejb\build\jar\META-INF
    package-persistence-unit:
    [delete] Deleting: C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5\example
    s\dukesbank\dukesbank-ejb\build\dukesbank-ejb.jar
    [jar] Building jar: C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5\exa
    mples\dukesbank\dukesbank-ejb\build\dukesbank-ejb.jar
    [delete] Deleting directory C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial
    5\examples\dukesbank\dukesbank-ejb\build\jar
    bpp-copy-dist:
    [copy] Copying 1 file to C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5
    \examples\dukesbank\dukesbank-ejb\dist
    default-not-ear:
    default:
    copy-common-jars:
    [copy] Copying 1 file to C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5
    \examples\dukesbank\dukesbank-war\build\web\WEB-INF\lib
    -pre-compile:
    bpp-actual-compilation:
    [echo] Compiling dukesbank-war
    -post-compile:
    compile:
    package:
    [mkdir] Created dir: C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5\exam
    ples\dukesbank\dukesbank-war\build\war
    bp-copy-classes:
    [mkdir] Created dir: C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5\exam
    ples\dukesbank\dukesbank-war\build\war\WEB-INF\classes
    [copy] Copying 25 files to C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutoria
    l5\examples\dukesbank\dukesbank-war\build\war\WEB-INF\classes
    [copy] Copying 27 files to C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutoria
    l5\examples\dukesbank\dukesbank-war\build\war
    bpp-package-persistence-unit-war:
    [mkdir] Created dir: C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5\exam
    ples\dukesbank\dukesbank-war\build\war\WEB-INF\classes\META-INF
    [copy] Warning: Could not find file C:\javaee-5-doc-tutorial-1[1].0_01\java
    eetutorial5\examples\dukesbank\dukesbank-war\src\conf\persistence.xml to copy.
    [copy] Warning: Could not find file C:\javaee-5-doc-tutorial-1[1].0_01\java
    eetutorial5\examples\dukesbank\dukesbank-war\src\conf\persistence.xml to copy.
    bpp-package-persistence-unit-ejb-jar:
    package-persistence-unit:
    [delete] Deleting: C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5\example
    s\dukesbank\dukesbank-war\build\dukesbank-war.war
    [jar] Building jar: C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5\exa
    mples\dukesbank\dukesbank-war\build\dukesbank-war.war
    [delete] Deleting directory C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial
    5\examples\dukesbank\dukesbank-war\build\war
    bpp-copy-dist:
    [copy] Copying 1 file to C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5
    \examples\dukesbank\dukesbank-war\dist
    default-not-ear:
    default:
    -pre-compile:
    bpp-actual-compilation:
    [echo] Compiling dukesbank
    -post-compile:
    compile:
    package:
    [echo] building ear package
    [mkdir] Created dir: C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5\exam
    ples\dukesbank\build\ear
    [mkdir] Created dir: C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5\exam
    ples\dukesbank\build\ear\META-INF
    [copy] Copying 1 file to C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5
    \examples\dukesbank\build\ear\META-INF
    [copy] Copying 1 file to C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5
    \examples\dukesbank\build\ear\META-INF
    bpp-copy-dist:
    [copy] Copying 1 file to C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5
    \examples\dukesbank\build\ear
    bpp-copy-dist:
    [copy] Copying 1 file to C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5
    \examples\dukesbank\build\ear
    Trying to override old definition of task iterate
    bpp-copy-dist:
    [copy] Copying 1 file to C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5
    \examples\dukesbank\build\ear
    [delete] Deleting: C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5\example
    s\dukesbank\build\dukesbank.ear
    [jar] Building jar: C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5\exa
    mples\dukesbank\build\dukesbank.ear
    bpp-copy-dist:
    [copy] Copying 1 file to C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial
    \examples\dukesbank\dist
    default-not-ear:
    default:
    BUILD SUCCESSFUL
    Total time: 9 seconds
    C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5\examples\dukesbank>
    C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5\examples\dukesbank>ant deploy
    Buildfile: build.xml
    check:
    tools:
    -pre-deploy:
    -pre-init:
    init:
    check:
    tools:
    start-db:
    [exec] Database already started on host localhost, port 1527.
    [exec] Command start-database executed successfully.
    delete-tables:
    [sql] Executing file: C:\javaeetutorial5\examples\common\sql\javadb\del
    .sql
    [sql] 24 of 24 SQL statements executed successfully
    create-tables:
    [sql] Executing file: C:\javaeetutorial5\examples\common\sql\javadb\tut
    al.sql
    [sql] 181 of 181 SQL statements executed successfully
    deploy:
    [exec] Command deploy executed successfully.
    deploy-url-message:
    [echo] Application Deployed at: http://localhost:8080/dukesbank
    BUILD SUCCESSFUL
    Total time: 13 seconds
    C:\javaee-5-doc-tutorial-1[1].0_01\javaeetutorial5\examples\dukesbank>
    So please do try this all and respond. If you have ever got Duke's Bank WEB CLIENT going on any other version of j2EE tutorial or application server please let me know too, I am happy to go to a previous version!
    Message was edited by:
    grand_armee on 10-nov-06-
    added version information
    Message was edited by:
    grand_armee

    As you can see below,
    ant reported �dukesbank-war\src\conf\persistence.xml�
    missing
    Could someone please explain why (and whether that is
    the reason for my problems).
    This seems significant (though I am an absolute
    beginner in J2EE and may be wrong). Would it be
    possible that the file
    �dukesbank-war\src\conf\persistence.xml� mistakenly
    was not included in the zipped source code file?You can ignore that warning message. It's part of the BluePrints build system, which checks to see if you have persistence.xml in your WAR so it can package it. The persistence unit is in in the EJB JAR for Duke's Bank:
    javaeetutorial5/examples/dukesbank/dukesbank-ejb/src/conf/persistence.xml
    First of all the manual says the url is
    http://localhost:1189/dukesbank/main.faces
    but the url that works is
    http://localhost:1189/dukesbank-war/main.faces
    Is that just a small inaccuracy in the manual, or
    there is more to it? Actually, in "Running the Web Client" the page is:
    http://localhost:8080/bank/main.faces
    So in your case it should be:
    http://localhost:1189/bank/main.faces
    Try that URL instead, and see if you get the same error.
    -ian

  • Duke's Bank Application

    Where can I find the files for the duke's bank application?

    Where did you look?
    What did Google suggest?
    %

  • Getting error while compiling The Duke’s Bank Application

    Hi,
    I am trying to complies The Duke’s Bank Application with reference to http://docs.jboss.org/jbossas/getting_started/v4/html/dukesbank.html guide.
    I am getting the following error:
    D:\Technical\Software\Tutorial\J2ee\Installation\J2ee-1_4\J2ee-1_4\j2ee-1_4-doc-tutorial_7\j2eetutorial14\jbossj2ee-src\examples\bank>ant -f jboss-build.xml c
    pile
    Buildfile: jboss-build.xml
    prepare:
    compile:
    [javac] Compiling 5 source files to D:\Technical\Software\Tutorial\J2ee\Installation\J2ee-1_4\J2ee-1_4\j2ee-1_4-doc-tutorial_7\j2eetutorial14\jbossj2ee-sr
    examples\bank\build
    BUILD FAILED
    D:\Technical\Software\Tutorial\J2ee\Installation\J2ee-1_4\J2ee-1_4\j2ee-1_4-doc-tutorial_7\j2eetutorial14\jbossj2ee-src\examples\bank\jboss-build.xml:44: D:\T
    hnical\Software\Tutorial\J2ee\Installation\J2ee-1_4\J2ee-1_4\j2ee-1_4-doc-tutorial_7\j2eetutorial14\jbossj2ee-src\examples\bank\${jboss.server}\lib not found.
    Total time: 0 seconds
    D:\Technical\Software\Tutorial\J2ee\Installation\J2ee-1_4\J2ee-1_4\j2ee-1_4-doc-tutorial_7\j2eetutorial14\jbossj2ee-src\examples\bank>
    Its not able to find ${jboss.server}\lib.
    What is the solution for this compiling problem. Please help me.
    Thanks in Advance.

    Hi,
    This could also be a reason :
    If you have any private proc defined in package body, make sure you define it at the top before using in other proc inside package body.

  • Please, help me learn J2EE...point me out to better tutorials or something!

    Hi,
    Guys, I really need help in trying to learn what J2EE is.
    I've got prior knowledge and experience on Java (I thought), but ever since I came across the terms J2EE, EJB, JNI, JSP, JDBC and all that crap, I now don't know what I actually learnt!
    Please bear with me I beg of you! :)
    1.0: What I've learnt.
    ===============================
    So far, I've learnt (I think) the core/basics of the Java language, covering uhm...the basics up to GUIs, Arrays, IOStreams...yeah I think that's it.
    I code using notepad and compile them using the SDK...which up to now I still don't know if it is an SE or EE edition. It's j2sdk1.4.0 the last time I checked. I didn't use any IDE.
    I've done (school) projects like a Library System (involves loaning of books and charges etc etc), a Chalet Organizer (Loaning out chalets/rooms and charges etc etc) and an Appointment Organizer.
    So what was that which I learnt? Am I right to say that that is only core Java and nothing else and is next to worthless in the working world?
    2.0: Why I want to learn J2EE.
    ===============================
    Okay so why do I want to learn specifically J2EE? Well, most employment opportunities here require J2EE and EJB (and maybe some other alien terms) as prerequisites to being a "Java Programmer".
    I really need the job as soon as possible (for family's sake) and the job market here is already saturated with webmasters..
    3.0: What I have tried.
    ===============================
    Believe me, I tried for like 2 months already to try learn this thing on my own.
    I have followed almost exactly to the J2EE "Beginner's Tutorial" found on http://java.sun.com/j2ee/tutorial/ but no matter how far I read, I'm still just as clueless as I was when I was in my mother's womb about what J2EE is all about, even though I did the examples. I stopped somewhere in the middle of "Getting Started" because I realized I wasn't learning anything at all.
    4.0: Help meeeeeee...
    ===============================
    4.1:
    Can anyone please help me set my head straight and either point me to a REAL beginner's tutorial on J2EE and what the heck it is, or help explain to me slowly what J2EE really is and how to learn it?
    4.2:
    What's the difference between J2EE and J2SE?!? I initially thought that J2SE was simply just a smaller download which didn't include some of the heavier stuff that the EE carried, but boy was I wrong when that same tutorial asked me to install BOTH of them!
    4.3:
    Is it right for me to think that EJB are just files which are precoded to facilitate programming? e.g.:(I could've written up my own Date class instead of using the standard Date class that everybody uses.)
    4.4:
    What the hell is Jakarta Ant? Is it a builder and not a compiler, and may allow me to run built programs just by double-clicking on an e.g. executable? Like C++? So that I don't have to go to command prompt and type "java myApp.class"? (OT, but I think it's ridiculous that Apache has this and not Sun!!)
    4.5:
    Is there a simpler, much much much simpler example of a J2EE tutorial besides the overly vague tutorial "The Duke's Bank Application"? I need more examples of smaller scale maaaan... Better yet, is there a tutorial around that covers the very very very basics of Java all the way up to J2EE, step by step and with ample explanations?
    =========================
    Thanks all, I would really really appreciate any heads up you can provide me with.
    Sincerely, Kai.

    Lee and tsith - same fella -
    Run Tomcat as a standalone critter - the install of the current ver (4.1.12?) on a Windows machine sets it up nicely, and you don't have to worry about web connectors and stuff. Just create a few JSPs and dump them somewhere under the ROOT directory of your webapps directory and you should be able to hit them via a URL like http://localhost:8080/test.jsp (assuming you have it running on port 8080). Once you get your fill of the JSP thing, make a serrvlet and look into creating WAR files - then copy your WAR file into webapps subdirectory of your Tomcat installation and play with that. When you've had enough Servlet fun, then look into JBoss and making EAR files and you'll have all sorts of fun with JNDI and JDBC and all those other acronyms.
    Ant is just a build tool, not a compiler. Compiling simple java classes is no big deal, 'cause you just type javac MyClass.java or some such. But when you get into complicated build processes (like, compile these classes, making sure to include the J2EE jar and all the other jars I need, and create a WAR file, and deploy it to Tomcat) then Ant really helps.
    If you want help documenting your classes, the javadoc tool is for you.
    Lee

  • Import DukesBank in Java Studio Enterprise

    hi
    I'm using the Sun Java Studio Enterprise and I'm not able to import the Duke's bank application from the J2EE tutorial.
    I like to compile and deploy the application to the Sun Application Server 8 afterward.
    But i cannot connet to the EJB's.
    Ideas are welcome!
    Thanks

    hi
    I created a new enterprise project with an EJB and a WEB module. Then i copied the source files from the tutorial in to the project structure inclusive the ejb*.xml's.
    Added the EJB and th WEB module to the main project.
    Now i cannot deploy the main project to the server:
    [#|2006-04-20T15:37:25.015+0200|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.tools.deployment|_ThreadID=12;|DPL5109: EJBC - START of EJBC for [htabankapp]|#]
    [#|2006-04-20T15:37:25.046+0200|WARNING|sun-appserver-pe8.1_02|javax.enterprise.resource.resourceadapter|_ThreadID=12;|RAR6017 : Failed to get connection pool object via JNDI lookup : null|#]
    [#|2006-04-20T15:37:25.046+0200|WARNING|sun-appserver-pe8.1_02|javax.enterprise.resource.resourceadapter|_ThreadID=12;|RAR7010: Pool not reachable. |#]
    [#|2006-04-20T15:37:25.046+0200|WARNING|sun-appserver-pe8.1_02|javax.enterprise.resource.resourceadapter|_ThreadID=12;|RAR5114 : Error allocating connection : [This pool is not registered with the runtime environment]|#]
    [#|2006-04-20T15:37:30.671+0200|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.tools.deployment|_ThreadID=12;|Processing beans ...|#]
    [#|2006-04-20T15:37:30.671+0200|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.tools.deployment|_ThreadID=12;|DPL5110: EJBC - END of EJBC for [htabankapp]|#]
    [#|2006-04-20T15:37:31.640+0200|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.tools.deployment|_ThreadID=12;|Total Deployment Time: 8656 msec, Total EJB Compiler Module Time: 5656 msec, Portion spent EJB Compiling: 65%
    Breakdown of EJBC Module Time: Total Time for EJBC: 5656 msec, CMP Generation: 485 msec (8%), Java Compilation: 5171 msec (91%), RMI Compilation: 0 msec (0%), JAX-RPC Generation: 0 msec (0%),
    |#]
    [#|2006-04-20T15:37:31.640+0200|SEVERE|sun-appserver-pe8.1_02|javax.enterprise.system.tools.deployment|_ThreadID=12;|Exception occured in J2EEC Phase
    com.sun.enterprise.deployment.backend.IASDeploymentException: No local string defined -- Inconsistent Module State
         at com.sun.enterprise.security.SecurityUtil.linkPolicyFile(SecurityUtil.java:321)
         at com.sun.enterprise.deployment.backend.AppDeployerBase.generatePolicy(AppDeployerBase.java:377)
         at com.sun.enterprise.deployment.backend.AppDeployer.doRequestFinish(AppDeployer.java:108)
         at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:146)
         at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:71)
         at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:633)
         at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:188)
         at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:520)
         at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:143)
         at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:172)
    |#]

  • Problems with servlet filters

    Hello,
    I'm trying to implement filters for some of the examples presented in the j2ee tutorial. Thus, I've realized a very simple filter that works very well for the Converter example (mapped to the index.jsp URL). But this filter doesn't work with the Duke's Bank application and I don't understand why. I've tried to map this filter to the Dispatcher servlet and also to different URLs, the filter is actually executed, but the client gets no response from the server.
    Here's the source code for my filter :
    package com.sun.ebank.web.filters;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public final class MyFilter implements Filter {
    private FilterConfig filterConfig = null;
    public void init(FilterConfig filterConfig) throws ServletException {
    this.filterConfig = filterConfig;
    public void destroy() {
    this.filterConfig = null;
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
    if (filterConfig == null) return;
    HttpServletRequest hr = (HttpServletRequest)request;
    System.out.println ("MyFilter : " + hr.getMethod () +      " URL=" + hr.getRequestURL () +          " QueryString={" + hr.getQueryString () + "}");
    chain.doFilter(request, response);
    public String toString() {
    if (filterConfig ==null) return ("MyFilter()");
    StringBuffer sb = new StringBuffer("MyFilter(");
    sb.append(filterConfig);
    sb.append(")");
    return (sb.toString());
    Can anybody help me?
    Thanks,
    B.F.

    As you're not actually doing anything in this filter but a quick System.out.print, there doesn't appear to be a problem with the filter code.
    What does your web.xml file look like?
    Does your IDE allow you to trace through the filter to the next target in the chain? If so, where does the code die? If not, use System.out.print statements to determine how far into the code you get.
    No response to the client usually means that the response didn't have any content set. You can verify this by checking the state of the response object after doFilter has been called; if the headers haven't been set then something crashed in a bad way.
    Good luck!

  • Java EE5 Tutorial - Totally lost!

    HI I'm just working through the Java EE5 Tutorial.
    I'm using:
    Sun Java System Application Server Platform Edition 9 Update 1 Patch 1
    installed in C:\Sun\SDK
    The tutorial/example projects are therefore in:
    C:\Sun\SDK\domains\domain1\docroot\javaeetutorial5\examples\web\bookstore1
    Netbeans IDE 5.5.1
    I'm having problems specifically with Chapter 2: Populating the Example Database
    The instructions state:
    When you deploy any of the Duke's Bookstore applications using ant deploy, the database is automatically populated at the same time. If you want to populate the database separately from the deploy task or are using NetBeans 5.5 to deploy the application, follow these steps:
    1. In a terminal window, go to the books directory or any one of the bookstore1 through bookstore6 example directories.
    2. Start the Java DB database server. For instructions, see Starting and Stopping the Java DB Database Server. You don't have to do this if you are using NetBeans 5.5. It starts the database server automatically.
    3. Run ant create-tables. This task runs a command to read the file tutorial.sql and execute the SQL commands contained in the file.
    At the end of the processing, you should see the following output:
    [sql] 181 of 181 SQL statements executed successfully
    The first problem I have is that the Runtime/Databases section, I cannot connect to:
    jdbc:derby://localhost:1527/sample
    (though I don't think this matters for this problem)
    Next if I use the ant command from the command prompt I get:
    C:\Sun\SDK\domains\domain1\docroot\javaeetutorial5\examples\web\bookstore1>ant c
    reate-tables
    'ant' is not recognized as an internal or external command,
    operable program or batch file.
    C:\Sun\SDK\domains\domain1\docroot\javaeetutorial5\examples\web\bookstore1>Using asant I get:
    C:\Sun\SDK\domains\domain1\docroot\javaeetutorial5\examples\web\bookstore1>asant create-tables
    Buildfile: build.xml
    -pre-init:
    init:
    check:
    BUILD FAILED
    C:\Sun\SDK\domains\domain1\docroot\javaeetutorial5\examples\bp-project\app-serve
    r-ant.xml:417: Property javaee.server.passwordfile not specified. Please
                specify the javaee.server.passwordfile property in 'bp-project/build
    .properties'.
                You will also need to ensure that the passwordfile is present and co
    ntains
                AS_ADMIN_PASSWORD.
    Total time: 0 secondsI can deploy the project no problem, If I navigate to
    http://localhost:8080/bookstore1/bookstore
    I get the exception:
    Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.8 (Build 060830)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: org.apache.derby.client.am.SqlException: Table 'WEB_BOOKSTORE_BOOKS' does not exist.Error Code: -1
    Call:SELECT BOOKID, FIRSTNAME, SURNAME, ONSALE, INVENTORY, CALENDAR_YEAR, TITLE, PRICE, DESCRIPTION FROM WEB_BOOKSTORE_BOOKS WHERE (BOOKID = ?)
         bind => [203]
    Query:ReadObjectQuery(com.sun.bookstore.database.Book)Can anyone give me any pointers as to what I'm doing wrong?
    I must say that I find the whole tutorial completely inaccessible, as it seems to give no tutorial at all, simply stating a stream of remotely connected facts, without any practical example. Is there an alternative book/guide to working through Java EE 5 for beginners?

    Dear all
    I am having a similar problem with the bookstore1 example from JEE5 Tutorial. When I launch it from the browser I get an Exception
    Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.8 (Build 060830)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: org.apache.derby.client.am.SqlException: Table 'WEB_BOOKSTORE_BOOKS' does not exist.Error Code: -1
    Call:SELECT BOOKID, INVENTORY, DESCRIPTION, PRICE, TITLE, FIRSTNAME, SURNAME, ONSALE, CALENDAR_YEAR FROM WEB_BOOKSTORE_BOOKS WHERE (BOOKID = ?)
         bind => [203]
    Query:ReadObjectQuery(com.sun.bookstore.database.Book)
    My environment (under Windows) is set up as follows:
    JAVAEE_HOME points to C:\\Program Files\\Java\\java_ee_sdk-5_02
    The tutorial is located in C:\\javaeetutorial5
    Application server is running at localhost:8080
    Java DB running at localhost:1527
    Java DB databases directory is located at C:\\DERBYDB
    I created BookDB database and it is in C:\\DERBYDB\\BookDB
    I populated the database, can connect to it and view tables from within NetBeans > Runtime
    I can also execute SQL queries from NetBeans on the datasets.
    In Runtime>Databases the URL for the database is setup as jdbc:derby://localhost:1527/BookDB
    In NetBeans > Tools > Options > Advanced Options > Server and External Tool Settings > Java DB Database the properties are set as
    Java DB Location: C:/Program Files/Java/java_ee_sdk-5_02/javadb
    Database Location : C:/DERBYDB
    In Application Server > Resources > JDBC > JDBC Resources I have
    JNDI Name:     derby
    Pool Name: DerbyPool     
    Status:     Enabled
    JNDI Name:     jdbc/BookDB
    Pool Name:     DerbyPool
    Status:     Enabled
    as well as jdbc/__CallFlowPool, jdbc/__default, jdbc/__TimerPool
    Project bookstore1 properties feature
    Libraries > bookstore - dist/bookstore.jar
    The output from the Application Server console:
    deployed with moduleid = bookstore1
    WEB0100: Loading web module [bookstore1] in virtual server [server] at [bookstore1]
    naming.bind
    [TopLink Config]: 2007.08.31 08:05:26.546--ServerSession(15189713)--The alias name for the entity class [class com.sun.bookstore.database.Book] is being defaulted to: Book.
    [TopLink Config]: 2007.08.31 08:05:26.546--ServerSession(15189713)--The column name for element [public java.lang.String com.sun.bookstore.database.Book.getDescription()] is being defaulted to: DESCRIPTION.
    [TopLink Config]: 2007.08.31 08:05:26.546--ServerSession(15189713)--The column name for element [public java.lang.String com.sun.bookstore.database.Book.getSurname()] is being defaulted to: SURNAME.
    [TopLink Config]: 2007.08.31 08:05:26.546--ServerSession(15189713)--The column name for element [public java.lang.String com.sun.bookstore.database.Book.getTitle()] is being defaulted to: TITLE.
    [TopLink Config]: 2007.08.31 08:05:26.546--ServerSession(15189713)--The column name for element [public java.lang.String com.sun.bookstore.database.Book.getBookId()] is being defaulted to: BOOKID.
    [TopLink Config]: 2007.08.31 08:05:26.546--ServerSession(15189713)--The column name for element [public int com.sun.bookstore.database.Book.getInventory()] is being defaulted to: INVENTORY.
    [TopLink Config]: 2007.08.31 08:05:26.546--ServerSession(15189713)--The column name for element [public float com.sun.bookstore.database.Book.getPrice()] is being defaulted to: PRICE.
    [TopLink Config]: 2007.08.31 08:05:26.546--ServerSession(15189713)--The column name for element [public java.lang.String com.sun.bookstore.database.Book.getFirstName()] is being defaulted to: FIRSTNAME.
    [TopLink Config]: 2007.08.31 08:05:26.562--ServerSession(15189713)--The column name for element [public boolean com.sun.bookstore.database.Book.getOnSale()] is being defaulted to: ONSALE.
    [TopLink Config]: 2007.08.31 08:05:26.562--ServerSession(15189713)--The column name for element [public int com.sun.bookstore.database.Book.getCalendar_year()] is being defaulted to: CALENDAR_YEAR.
    [TopLink Config]: 2007.08.31 08:05:26.578--ServerSession(15189713)--property toplink.server.platform.class.name is deprecated, property toplink.target-server should be used instead.
    topLink_version
    application_server_name_and_version
    platform=>JavaDBPlatform
    user name=> ""
    connector=>JNDIConnector datasource name=>null
    );|connecting
    ;|connected_user_database_driver
    platform=>JavaDBPlatform
    user name=> ""
    connector=>JNDIConnector datasource name=>null
    );|connecting
    ;|connected_user_database_driver
    login_successful
    WARNING *********** NetBeans HTTP Monitor ************
    The request cannot be recorded most likely because the NetBeans HTTP Server is not running. Go to the IDE and start the HTTP Server from within the Runtime window to fix this problem.
    =======================================================
    The number of hits is: 1
    =======================================================
    Local Exception Stack:
    Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.8 (Build 060830)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: org.apache.derby.client.am.SqlException: Table 'WEB_BOOKSTORE_BOOKS' does not exist.Error Code: -1
    Call:SELECT BOOKID, INVENTORY, DESCRIPTION, PRICE, TITLE, FIRSTNAME, SURNAME, ONSALE, CALENDAR_YEAR FROM WEB_BOOKSTORE_BOOKS WHERE (BOOKID = ?)
    bind => [203]
    Query:ReadObjectQuery(com.sun.bookstore.database.Book)
    at oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:303) ...
    Could anyone enlighten me why the table 'WEB_BOOKSTORE_BOOKS' cannot be found? As I said I can see it in NetBeans and can run a query e.g. SELECT BOOKID, INVENTORY, DESCRIPTION, PRICE, TITLE, FIRSTNAME, SURNAME, ONSALE, CALENDAR_YEAR FROM WEB_BOOKSTORE_BOOKS WHERE (BOOKID = '201')
    Also does the line connector=>JNDIConnector datasource name=>null in the Application Server output have any implication on this problem?
    I will greatly appreciate your help as I have run out of ideas how to fix this.

  • Transfer object,  FindByPrimaryKey, session facade

    I would like to request help on coding a 'facade session' bean that invokes the FindByPrimaryKey method on a BMP entity bean, and how to put the returned values into a transfer object. I've been trying to modify the code provided in Sun's 'Duke's Bank Application' to accomplish this. Below is the code copied and pasted from Sun's session facade. 'accountIds' is a Collection that contains the values (customerId, balance, etc) of bank accounts which were retrieved with a FindBy method. AccountDetails produces a transfer object.
    try {
    Iterator i = accountIds.iterator();
    while (i.hasNext()) {
    Account account = (Account)i.next();
    AccountDetails accountDetails = account.getDetails();
    accountList.add(accountDetails);
    I was wondering how to accomplish the task of transfering values into a transfer object when invoking FindByPrimaryKey.
    I've taken a few stabs at it. My FindByPrimaryKey method doesn't throw any exceptions (as far as I can tell):
    try {
    Account account = accountHome.findByPrimaryKey(id);
    } catch (Exception ex) {
    throw new AccountNotFoundException("darn it - " + ex.getMessage());
    The error (which appears in the catalina log) occurs in the following section of code, which immediately follows the above:
    ArrayList myAccountDetails = new ArrayList();
    try {
    AccountDetails accountDetails = account.getDetails();
    myAccountDetails.add(accountDetails);
    } catch (RemoteException ex) {
    throw new EJBException("getDetails isn't working in AccountControllerBean: " + ex.getMessage());
    And here is the business method from Account:
    public AccountDetails getDetails() {
    return new AccountDetails(id, surname, firstname, balance);
    If any of the experts out there have spotted a mistake, I sure would be grateful for your help.
    James

    Thank you for your help. I think the ejbCreate method in the 'session facade' takes into account your advice:
    public void ejbCreate() {
    try {
    accountHome = EJBGetter.getAccountHome();
    } catch (Exception ex) {
    throw new EJBException("ejbCreate: " +
    ex.getMessage());
    account = null;
    accountId = null;
    I included your piece of code just the same to see if it would help anyway. Unfortunately the same error appeared in the catalina file.
    Also, there were error messages I hadn't noticed until now in the Verifier.
    One read:
    "No findByPrimaryKey method was found in home interface class [database.AccountHome]"
    The other:
    "No single argument findByPrimaryKey was found in home interface class [database.AccountHome]"
    Here is the method in the implementation class of the entity bean:
    public String ejbFindByPrimaryKey(String primaryKey)
    throws FinderException {
    boolean result;
    try {
    result = selectById(primaryKey);
    } catch (Exception ex) {
    throw new EJBException("ejbFindByPrimaryKey: " +
    ex.getMessage());
    if (result) {
    return primaryKey;
    else {
    throw new ObjectNotFoundException
    ("Row for id " + id + " not found.");
    Below is the 'selectById' method that it invokes:
    private boolean selectById(String primaryKey)
    throws SQLException {
    makeConnection();
    String selectStatement =
    "select id " +
    "from accountTable where id = ? ";
    PreparedStatement prepStmt =
    con.prepareStatement(selectStatement);
    prepStmt.setString(1, primaryKey);
    ResultSet rs = prepStmt.executeQuery();
    boolean result = rs.next();
    prepStmt.close();
    releaseConnection();
    return result;
    Here is what I have in the home interface of the entity bean for this find method:
    public Account findByPrimaryKey(String id)
    throws FinderException, RemoteException;
    In addition here is the entire method in the 'session facade':
    public ArrayList getAccount(String id)
    throws AccountNotFoundException, InvalidParameterException {
    if (id == null)
    throw new InvalidParameterException("null id");
    try {
    account = accountHome.findByPrimaryKey(id);
    } catch (Exception ex) {
    throw new AccountNotFoundException("dag it" + ex.getMessage());
    ArrayList accountList = new ArrayList();
    try {
    AccountDetails accountDetails = account.getDetails();
    accountList.add(accountDetails);
    } catch (RemoteException ex) {
    throw new EJBException("getDetails isn't working in Account ControllerBean: " + ex.getMessage());
    return accountList;
    Thanks again for helping me out.
    James

  • Cloudscape Kills Windows 2000

    I have installed J2EE SDK 1.3 beta 2, and was going along well until I reached the Dukes Bank sample application.
    I have gone through step by step as stated in the tutorial, using ant to compile everything. I use the deploytool to open the resulting DukesBankApp.ear file and everything looks fine. I then attempt to deploy the application, set that going, and watch as the progress window appears. The messages displayed get to (I believe) "Making Server JARs", and then the system reboots. I've uninstalled and reinstalled everything, recompiled from scratch, and it still does it.
    So I thought I'd go on a different tack to test out the database features. I ran the cloudscape server with "cloudscape -start", and then tried to connect to it with "cloudscape -isql". And it happens again - reboot.
    I have Windows 2000 Pro (SP2), IE5.5, 384Mb RAM, J2EE 1.3 beta 2. Any thoughts on where to go next with this problem?
    Thanks.

    in my experiance the problem is not because of cloudscape, the same problem might happen in another database too...
    in windows 2000 it shows some collition between java runtime environment.
    This same problem may occure in any java installation of windows2000 in ur system. better try to reinstall java and set clear class path...
    that means in dos prompt set classpath=new classpath then try to run cludscape, same should for j2ee, and deploytool in the same prompt.
    ( can u check what are the paths available in ur system by set | more command in ur system dos prompt )
    can u inform me after u solving this problem....
    i will try my level best to find out a solution
    [email protected]

  • Servlet + EJB + Jsp

    Hello,
    I have an EJB CMP, called NewsBean. It's an EJB on a table News (Each line in the table is a Newspaper articles).
    I have a JSP page, to look the news list.
    And I have a servlet to prepare the data for the JSP page : The servlet call the Bean to access from the data base, the list of news
    The bean gives the list of articles with the methode findByLiNews
    My question is :
    - What must the JSP use? The EJB? Do the JSP call mybean.findByLiNews('Article1").
    - Do the servlet call the method mybean.findByLiNews?
    Di the servlet creates an other bean to be used by the JSP page?
    Thank's for your help

    I would recommnd you to follow some standard design pattern for J2EE applications. Check j2ee 1.4 tutorial for proper ways to dsign/code your apps: http://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html
    Speaking of your particular example I'd call bean methods strait from a JSP page - it is more proper and easier, see how this is done in Duke's Bank application: http://java.sun.com/j2ee/1.4/docs/tutorial/doc/Ebank4.html#wp79996

  • Roles and ProgrammaticLogin

    Hi,
    I'm using the ProgrammaticLogin class to the authenticate a user against an LDAP realm. The authentication aspect works fine and I can successfully retrieve the Principal's name from the method call request.getUserPrincipal().getName().
    The problem I'm having is that every call to request.isUserInRole( "groupname" ) throws a NullPointerException. How is the authenticated user's role stored in the session?
    Derek

    Hi there,
    I'm having a problem. It would be very nice to see your help...
    - I downloaded j2eetutorial14 and tried to deploy the Duke's Bank Application. Moreover, I read its manual (for deploying, packaging...) and I noticed the following instructions:
    5. Expand the Security node in the Admin Console tree.
    6. Expand the Realms node.
    Select the file realm to add users you want to enable to access applications running in this realm.
    Select the admin-realm to add users you want to enable as system administrators of the Application Server.
    7. Click the Manage Users button.
    Click New to add a new user to the realm.
    8. Enter the correct information into the User ID, Password, and Group(s) fields.
    Then I started the Application Server, and logged in the server by addressing: http://localhost:4848/asadmin
    with the admin account. The trouble was I didn't see the "Manage Users button" when expading the "Security" node. So I could not add new users and groups.
    Something went wrong??? Pls help me, Thanks!

  • Break EAR into WAR + JAR

    I have been able to successfully deploy the EAR file for Dukes bank example application that comes with JEE 5.0 Tutorial. I'm now trying to deploy the EJB JAR and Web App WAR file separately but when I do so I get an HTTP 403. Researching this, it seems to me that the security context is not propagating from WAR module to the EJB module. If so, how do I make it work. My goal is to ultimately have these two (EJB and WAR) on two separate servers. TIA

    Please ignore. It was a simply a case of sun-application.xml having security-role-mapping but sun-web.xml not having it. I still do get some EJB method invocation exceptions due to security restraints but I think it should be a matter of specifying something in the sun-ejb-jar.xml.

  • Connecting java file to jsp

    Hi i'm working on a jsp file and i want my jsp file to access the methods in a java file of mine.I have an idea its got something to do with beans. But i have no knowledge about beans. does anyone know how i can acheive it.

    The following ( from the java tutorial with samples is downloadable) gave me the clarity in understanding how .jsp interact with classes (modified beans)
    This tutorial is available at
    http://java.sun.com
    and follow thelinks for the tutorial.
    Here Goes.....
    Home | Download | PDF | API | FAQ | Search | Feedback | History
    JavaBeans Components
    JavaBeans components are Java classes that can be easily reused and composed together into applications. Any Java class that follows certain design conventions is a JavaBeans component.
    JavaServer Pages technology directly supports using JavaBeans components with standard JSP language elements. You can easily create and initialize beans and get and set the values of their properties.
    JavaBeans Component Design Conventions
    JavaBeans component design conventions govern the properties of the class and govern the public methods that give access to the properties.
    A JavaBeans component property can be
    Read/write, read-only, or write-only
    Simple, which means it contains a single value, or indexed, which means it represents an array of values
    A property does not have to be implemented by an instance variable. It must simply be accessible using public methods that conform to the following conventions:
    For each readable property, the bean must have a method of the form
    PropertyClass getProperty() { ... }
    For each writable property, the bean must have a method of the form
    setProperty(PropertyClass pc) { ... }
    In addition to the property methods, a JavaBeans component must define a constructor that takes no parameters.
    The Duke's Bookstore application JSP pages bookstore.jsp, bookdetails.jsp, catalog.jsp, and showcart.jsp use the database.BookDB and database.BookDetails JavaBeans components. BookDB provides a JavaBeans component front end to the access object database.BookDBAO. The JSP pages showcart.jsp and cashier.jsp access the bean cart.ShoppingCart, which represents a user's shopping cart.
    The BookDB bean has two writable properties, bookId and database, and three readable properties: bookDetails, numberOfBooks, and books. These latter properties do not correspond to any instance variables but rather are a function of the bookId and database properties.
    package database;
    public class BookDB {
    private String bookId = "0";
    private BookDBAO database = null;
    public BookDB () {
    public void setBookId(String bookId) {
    this.bookId = bookId;
    public void setDatabase(BookDBAO database) {
    this.database = database;
    public BookDetails getBookDetails() throws
    BookNotFoundException {
    return (BookDetails)database.getBookDetails(bookId);
    public List getBooks() throws BooksNotFoundException {
    return database.getBooks();
    public void buyBooks(ShoppingCart cart)
    throws OrderException {
    database.buyBooks(cart);
    public int getNumberOfBooks() throws BooksNotFoundException {
    return database.getNumberOfBooks();
    Creating and Using a JavaBeans Component
    To declare that your JSP page will use a JavaBeans component, you use a jsp:useBean element. There are two forms:
    <jsp:useBean id="beanName"
    class="fully_qualified_classname" scope="scope"/>
    and
    <jsp:useBean id="beanName"
    class="fully_qualified_classname" scope="scope">
    <jsp:setProperty .../>
    </jsp:useBean>
    The second form is used when you want to include jsp:setProperty statements, described in the next section, for initializing bean properties.
    The jsp:useBean element declares that the page will use a bean that is stored within and is accessible from the specified scope, which can be application, session, request, or page. If no such bean exists, the statement creates the bean and stores it as an attribute of the scope object (see Using Scope Objects). The value of the id attribute determines the name of the bean in the scope and the identifier used to reference the bean in EL expressions, other JSP elements, and scripting expressions (see Chapter 16). The value supplied for the class attribute must be a fully qualified class name. Note that beans cannot be in the unnamed package. Thus the format of the value must be package_name.class_name.
    The following element creates an instance of mypkg.myLocales if none exists, stores it as an attribute of the application scope, and makes the bean available throughout the application by the identifier locales:
    <jsp:useBean id="locales" scope="application"
    class="mypkg.MyLocales"/>
    Setting JavaBeans Component Properties
    The standard way to set JavaBeans component properties in a JSP page is by using the jsp:setProperty element. The syntax of the jsp:setProperty element depends on the source of the property value. Table 12-3 summarizes the various ways to set a property of a JavaBeans component using the jsp:setProperty element.
    Table 12-3 Valid Bean Property Assignments from String Values Value Source Element Syntax
    String constant <jsp:setProperty name="beanName"
    property="propName" value="string constant"/>
    Request parameter <jsp:setProperty name="beanName"
    property="propName" param="paramName"/>
    Request parameter name that matches bean property <jsp:setProperty name="beanName"
    property="propName"/>
    <jsp:setProperty name="beanName"
    property="*"/>
    Expression <jsp:setProperty name="beanName"
    property="propName" value="expression"/>
    <jsp:setProperty name="beanName"
    property="propName" >
    <jsp:attribute name="value">
    expression
    </jsp:attribute>
    </jsp:setProperty>
    1. beanName must be the same as that specified for the id attribute in a useBean element.
    2. There must be a setPropName method in the JavaBeans component.
    3. paramName must be a request parameter name.
    A property set from a constant string or request parameter must have one of the types listed in Table 12-4. Because constants and request parameters are strings, the web container automatically converts the value to the property's type; the conversion applied is shown in the table.
    String values can be used to assign values to a property that has a PropertyEditor class. When that is the case, the setAsText(String) method is used. A conversion failure arises if the method throws an IllegalArgumentException.
    The value assigned to an indexed property must be an array, and the rules just described apply to the elements.
    Table 12-4 Valid Property Value Assignments from String Values Property Type Conversion on String Value
    Bean Property Uses setAsText(string-literal)
    boolean or Boolean As indicated in java.lang.Boolean.valueOf(String)
    byte or Byte As indicated in java.lang.Byte.valueOf(String)
    char or Character As indicated in java.lang.String.charAt(0)
    double or Double As indicated in java.lang.Double.valueOf(String)
    int or Integer As indicated in java.lang.Integer.valueOf(String)
    float or Float As indicated in java.lang.Float.valueOf(String)
    long or Long As indicated in java.lang.Long.valueOf(String)
    short or Short As indicated in java.lang.Short.valueOf(String)
    Object new String(string-literal)
    You use an expression to set the value of a property whose type is a compound Java programming language type. The type returned from an expression must match or be castable to the type of the property.
    The Duke's Bookstore application demonstrates how to use the setProperty element to set the current book from a request parameter in the database bean in bookstore2/web/bookdetails.jsp:
    <c:set var="bid" value="${param.bookId}"/>
    <jsp:setProperty name="bookDB" property="bookId"
    value="${bid}" />
    The following fragment from the page bookstore2/web/bookshowcart.jsp illustrates how to initialize a BookDB bean with a database object. Because the initialization is nested in a useBean element, it is executed only when the bean is created.
    <jsp:useBean id="bookDB" class="database.BookDB" scope="page">
    <jsp:setProperty name="bookDB" property="database"
    value="${bookDBAO}" />
    </jsp:useBean>
    Retrieving JavaBeans Component Properties
    The main way to retrieve JavaBeans component properties is by using the JSP EL expressions. Thus, to retrieve a book title, the Duke's Bookstore application uses the following expression:
    ${bookDB.bookDetails.title}
    Another way to retrieve component properties is to use the jsp:getProperty element. This element converts the value of the property into a String and inserts the value into the response stream:
    <jsp:getProperty name="beanName" property="propName"/>
    Note that beanName must be the same as that specified for the id attribute in a useBean element, and there must be a getPropName method in the JavaBeans component. Although the preferred approach to getting properties is to use an EL expression, the getProperty element is available if you need to disable expression evaluation.
    All of the material in The J2EE(TM) 1.4 Tutorial is copyright-protected and may not be published in other works without express written permission from Sun Microsystems.
    hope this helps
    regards,

Maybe you are looking for