Web app directory structure

Is there some standard directory structure when building J2EE web application that consists for example JSP pages, servlets, EJB components, pictures etc.

place all your jsps in "jsp" folder under the project folder.
Create a folder called "WEB-INF" under the project folder which contains all your servlets, and web.xml and taglib.tld files. Your servlets that is .class files should be in a folder "classes" under "WEB-INF".
The .html files and picture files are under the project folder.
I hope it will help you some how.
But, the directory structure depends upon the Framework you are using such as Struts, Spring or Axis.

Similar Messages

  • IPhone Web App Directory

    Does anyone know if there is a version of the Apple iPhone web app directory formatted for the iPhone? Every time I go to load the page it displays full.

    Why not use your desktop or laptop computer to create collection of bookmarks for the iPhone.
    In Safari the top left collection on my bookmarks bar is called iPhone. Those bookmarks synch automatically with the iPhone.
    Matt

  • Web Application directory structure

    Please can someone help me with directing me to any online guide as to how webapp could be created and web.xml configuration in Sun Application server 8.
    I do not understand the directory structure of sun, unlike Tomcat the webapps contains all the virtual context part with a default ROOT direct set in the server.xml as the default docbase.
    Now, where is the default ROOT in Sun server? Where can I put my index file. When I create a web context, where will I put it? Does J2EE has similar WEB-INF structure in Tomcat? Does it have web.xml to configure the webapp
    Finally, I have written a simple EJB called Hello World using stateless protocol. I have my Hello.class, HelloHome.class and HelloBean.class. I also have ejb-jar.xml for container configuration. I have jar then up to hello.jar and have deployed them. Now I want to access the beans, Home bean to be precises. I have written a hello.jsp and I put it in the orignal directory where the main index.html file is in Sun server which is /user/Sun/AppServer/domains/domain1/docroot, I got errors.
    Could someone shade a light on this please.
    Thanks Guys.
    NB
    Do not point me to online reference
    I have awared max point for this question

    The developer's guide discusses in pretty clear terms how to deploy a J2EE app from a directory structure.
    The tomcat directory structure is really the same as a packaged war which once you read the documentation you will see is basically no different with SJSAS.
    You need to deploy an application. See previous posts on how to have docroot be the top level (search for posts by janluehe)

  • IPhone Official Web App Directory?

    Has anyone heard about this? Any word on which apps will be included?
    Apple to launch official iPhone Web applications directory
    http://www.appleinsider.com/articles/07/10/10/appleto_launch_official_iphone_web_applicationsdirectory.html

    I still think appleopolis.com has a better set up, when I can put my favorites on a screen to select from. But its another positive step for Apple and the iPhone, Keep it up guys...your getting there!!!

  • Apps Directory Structure

    Hi,
    With the help of many good posts on this forum I got 11.5.10.2 Apps running on Suse Linux 9.0. I installed Vision Demo database and the installation location is
    /opt/oracle
    under this directory following directories have been created by rapidinstall
    visappl
    viscomn
    visdata
    visdb
    visora
    Could someone please educate me about this directory structure.
    Also where should my environment variables like ORACLE_BASE and ORACLE_HOME point, which environment files should I put these env variables so that these get applied after reboot automatically.
    Thanks in advance.
    Ravi Singh
    Message was edited by:
    Ravi-2006

    Hi Ravi
    Let me answer to your query...
    What all i understand you want to know the file structure, as you have installed vission DB thus
    visappl - APPL_TOP
    viscomn - COMMON_TOP
    visdata - data_top (data top for appl utilies 806 home)
    visdb - database
    visora - ora_top
    There are 2 oracle home
    1) 9i oracle_home which I feel must be -- visdb
    and
    2) 806 oracle home which is visdata
    8.0.6 oracle home is ussed for apps utlities adpatch/adclone etc
    when you source different environment file you then see the difference
    FYI
    appl_top env file --> $APPL_TOP APPS<SID>_server.env
    let me know if you still have doubt
    [email protected]
    +9810285180

  • J2EE Enterprise App Directory Structure

    Can anyone point me to a resource that descibes the recomended development directory structure for a J2EE app with EJB? MyEclipse create three directories:
    J2EEAppName
    J2EEAppNameEJB
    J2EEAppNameWeb
    But I don't know where to put the shared classes, etc. I want to do it right.. Any help would be greatly appreciated.
    Paul

    For anyone else looking for an answer to the recommended directory structure...
    See this link:
    http://java.sun.com/blueprints/code/projectconventions.html

  • Oracle apps directory structure

    Hi,
    I am currently studying the Oracle Apps system admin self study cds....
    But there is no mention of the following
    Environment Files and Oracle Applications File System
    Could someone provide me with information or document regarding
    Product Directories
    APPL_TOP Directories (common_top etc)
    Common Components Directory
    Java Files and Directories.
    Ta
    sunny

    Hi,
    Please refer to the following documents.
    - Oracle Applications Concept
    - Maintaining Oracle Applications Documentation Set
    - Oracle Applications System Administrator's Guide Documentation Set
    Applications Releases 11i and 12
    http://www.oracle.com/technology/documentation/applications.html
    Regards,
    Hussein

  • Java Web App for EP5 SP5

    Hi
    Recently I developed a Java web app for a Portal client.  The client is on EP5 SP5 with ITS and LDAP servers (a 3 server architecture).  I then used the deployment tool to create the necessary ear file and then successfully deployed it to the SAP J2EE Engine.  I then navigated to the following url:
    http://<portal_server>:8100/<web_app>/welcome.jsp
    However I am having trouble with the following:
    1) the jsp pages are not being rendered properly.  in fact welcome.jsp does not have any jsp tags at all but I am still getting a compiling exception.  as soon as I change the extension to .html the page is displayed fine.  issue: why am i not able to view the jsp pages.  error: com.inqmy.services.servlets_jsp.jsp.CompilingException ID 17013
    2) the web app I have developed utilises the sapjco functionality to connect to the relevant R3 system.  in my web app directory structure I have included the necessary sapjco.jar in the WEB-INF/lib directory but get the attached jco error. (I shouldnt need to set the classpath since the sapjaco.jar file must get picked up from WEB-INF/lib directory).  Error: At times I get a NoClassDefFoundError stopping at the line which requires the sapjco.jar file (where it uses JCo.Pool class) and at other times I get the "could not load middleware layer".
    I have tried numerous things to fix it but in vain.  Any thoughts around how I could go about resolving the issues will be greatly appreciated. 
    Willing to provide screenshots if required.
    Cheers
    Ankit

    Hi Alon
    Thanks a lot for the info!!
    I have read the doco you asked me to have a look at and it sounds reasonable.  But the question that I have is that is it possible to successfully include the relevant jar's in the application's WEB-INF\lib folder?? I ask this since I would expect the SAP j2ee class loader to look at the required jar's in the WEB-INF\lib folder?!? (Also the section on "Adding a Reference from a Deployed Application to a Service or Library" talks about an app that may want to use resources from OUTSIDE the application EAR.)
    So if I use any jar's such as sapjco, xerces, activation and mail I will need to add them to the library.txt if they are not already there (which they should be since the portal uses them) and then add the reference in reference.txt.
    Your thoughts will be appreciated.
    Cheers
    Ankit

  • SAP EP5 SP5 Java web app problem

    Hi
    Recently I developed a Java web app for a Portal client. The client is on EP5 SP5 with ITS and LDAP servers (a 3 server architecture). I then used the deployment tool to create the necessary ear file and then successfully deployed it to the SAP J2EE Engine. I then navigated to the following url:
    http://<portal_server>:8100/<web_app>/welcome.jsp
    However I am having trouble with the following:
    1) the jsp pages are not being rendered properly. in fact welcome.jsp does not have any jsp tags at all but I am still getting a compiling exception. as soon as I change the extension to .html the page is displayed fine. issue: why am i not able to view the jsp pages. error: com.inqmy.services.servlets_jsp.jsp.CompilingException ID 17013
    2) the web app I have developed utilises the sapjco functionality to connect to the relevant R3 system. in my web app directory structure I have included the necessary sapjco.jar in the WEB-INF/lib directory but get the attached jco error. (I shouldnt need to set the classpath since the sapjaco.jar file must get picked up from WEB-INF/lib directory). Error: At times I get a NoClassDefFoundError stopping at the line which requires the sapjco.jar file (where it uses JCo.Pool class) and at other times I get the "could not load middleware layer".
    I have tried numerous things to fix it but in vain. Any thoughts around how I could go about resolving the issues will be greatly appreciated.
    Willing to provide screenshots if required.
    Cheers
    Ankit

    Hi Ravi
    I used the SAP J2EE Engine Deploy Tool to create the war and ear archives as well as deploy the ear archive.  As I used this tool I included the required jar files inclusing the sapjco.jar inside WEB-INF\lib of the web archive (WAR).  I tested this in a tomcat environment before deploying it to the portal environment.
    1) The screendump is as below:
    Internal Server Error 500!
    com.inqmy.services.servlets_jsp.server.jsp.CompilingException: ID17013: Error in compiling : java.io.IOException: CreateProcess: javac -encoding UTF8 -nowarn C:\SAP_J2EEngine6.20\alone\services\servlet_jsp\work\jspTemp\changePassword\work\jsp_welcome1092865716140.java -classpath ".;.\system-lib\boot.jar;.\system-lib\jaas.jar;;.;.\additional-lib\jnet.jar;.\additional-lib\jdbc20.jar;.\services\iiop\iiop.jar;.\services\servlet_jsp\servlet_jsp.jar;.\services\p4\p4.jar;.\additional-lib\mail.jar;.\services\dbpool\dbpool.jar;.\additional-lib\connector.jar;.\additional-lib\activation.jar;.\services\deploy\deploy.jar;.\additional-lib\jta.jar;.\services\ts\ts.jar;.\additional-lib\jsse.jar;.\additional-lib\servlet.jar;.\additional-lib\ejb11.jar;.\additional-lib\jms.jar;.\services\ejb\ejb.jar;;C:\SAP_J2EEngine6.20\alone\services\servlet_jsp\work\jspTemp\changePassword\root\WEB-INF\lib\activation.jar;C:\SAP_J2EEngine6.20\alone\services\servlet_jsp\work\jspTemp\changePassword\root\WEB-INF\lib\inqmyxml.jar;C:\SAP_J2EEngine6.20\alone\services\servlet_jsp\work\jspTemp\changePassword\root\WEB-INF\lib\jcoapi.jar;C:\SAP_J2EEngine6.20\alone\D
         at com.inqmy.services.servlets_jsp.server.jsp.JSPParser.parse(JSPParser.java:296)
         at com.inqmy.services.servlets_jsp.server.jsp.JSPServlet.getClassName(JSPServlet.java:333)
         at com.inqmy.services.servlets_jsp.server.jsp.JSPServlet.service(JSPServlet.java:207)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.inqmy.services.servlets_jsp.server.RunServlet.runSerlvet(RunServlet.java:136)
         at com.inqmy.services.servlets_jsp.server.ServletsAndJspImpl.startServlet(ServletsAndJspImpl.java:856)
         at com.inqmy.services.httpserver.server.RequestAnalizer.checkFilename(RequestAnalizer.java:598)
         at com.inqmy.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:260)
         at com.inqmy.services.httpserver.server.Response.handle(Response.java:164)
         at com.inqmy.services.httpserver.server.HttpServerFrame.request(HttpServerFrame.java:909)
         at com.inqmy.core.service.context.container.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:36)
         at com.inqmy.core.cluster.impl3.ParserRunner.run(ParserRunner.java:30)
         at com.inqmy.core.thread.impl0.ActionObject.run(ActionObject.java:46)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.inqmy.core.thread.impl0.SingleThread.run(SingleThread.java:132)
    As advised by you I included the inqmyxml.jar file in the WEB-INF\lib folder for this application.  But it doesnt seem to have made a difference.
    2) for the second issue where sapjco.jar isnt found the error is as seen below.  At line 42 in R3.java I make a  JCO call -
    pool = JCO.getClientPoolManager().getPool(POOL_NAME);
    Error Dump below:
    java.lang.NoClassDefFoundError
         at R3.(R3.java:42)
         at ChangePassword.doPost(ChangePassword.java:76)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.inqmy.services.servlets_jsp.server.InvokerServlet.service(InvokerServlet.java:126)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.inqmy.services.servlets_jsp.server.RunServlet.runSerlvet(RunServlet.java:136)
         at com.inqmy.services.servlets_jsp.server.ServletsAndJspImpl.startServlet(ServletsAndJspImpl.java:856)
         at com.inqmy.services.httpserver.server.RequestAnalizer.checkFilename(RequestAnalizer.java:598)
         at com.inqmy.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:260)
         at com.inqmy.services.httpserver.server.Response.handle(Response.java:164)
         at com.inqmy.services.httpserver.server.HttpServerFrame.request(HttpServerFrame.java:909)
         at com.inqmy.core.service.context.container.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:36)
         at com.inqmy.core.cluster.impl3.ParserRunner.run(ParserRunner.java:30)
         at com.inqmy.core.thread.impl0.ActionObject.run(ActionObject.java:46)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.inqmy.core.thread.impl0.SingleThread.run(SingleThread.java:132)
    I would have expected EP5 to be able to find the appropriate jar files.  Especially since it has its own library of jar files to work with.  I was reading some J2EE Engine doco and came across two files library.txt and reference.txt.  Do I need to maintain these files as I deploy my application?
    Your thoughts will be appreciated.
    Cheers

  • Web Apps FAQ

    Hello,
    I am working on knowledge base entries for developing Web Applications with Sun ONE Studio. I would be interested in whether any of the following are helpful.
    Also, are there other entries you think should be added? Other comments? Corrections?
    Thanks
    Web Apps FAQ
    Creating a Web Application
    Q: Where do I put my JSP files in my web module.
    A: JSP files can go into the web module's document base directory or any
    of its subdirectories except for the subdirectories under WEB-INF. For example,
    the following is correct:
    correctWebModStructure
    + login.jsp
    ++ JSP_files
    +++ shop.jsp
    + WEB-INF
    ++ Classes
    ++ lib
    ++ web.xml
    The following is incorrect:
    incorrectWebModStructure
    + WEB-INF
    ++ login.jsp     
    ++ JSP_files
    +++ shop.jsp     
    ++ Classes
    ++ lib
    ++ web.xml
    Note that with the incorrect structure, the JSP files will compile but
    they will not run on a server.
    Q: Where should I put my servlet source and binary files when I create
    and execute a web module from the IDE?
    A: Your compiled classes must go in the appropriate package directory
    under <web mod document root>/WEB-INF/Classes. The easiest place to
    put the source code is in the same directory as the compiled class. To
    put your source code in a different directory, see "Can I put my source code in
    a different directory from WEB-INF/classes?"
    Note that when a class is imported by another class or by a JSP file, the
    class MUST be in a named namespace (package).
    Q: Where do I put my libraries (JAR files) in a web module?
    A: You can put the libraries in one of several places:
    o If the JAR file will be used only by the module, put it in the
    WEB-INF/lib directory.
    o If the JAR file will be shared by multiple web modules look at the server's
    documentation to find out how to make the library available across web
    modules.
    - If you are using the Sun One Application server, you can either copy
    the JAR into the <instance_dir>/lib directory (such as
         <AppServerInstallDir>\domains\domain1\server1\lib) or edit the
         classpath-suffix attribute of the java-config element in the
         server.xml file. For details about server.xml, see the Sun ONE Application
         Server Administrator�s Configuration File Reference. You must
         restart the server.
    - If you are using the internal Tomcat server, put the JAR file into one of
    the following directories:
    <ide-install-dir>/jwsdp/lib/
    <ide-install-dir>/jwsdp/common/classes
    <ide-install-dir>/jwsdp/common/lib/
    <ide-install-dir>jwsdp/shared/classes
    <ide-install-dir>/jwsdp/shared/lib/
    Note that for compilation, a JAR file must either be mounted as as an
              archive file or the JAR file must be put into <ide-install-dir>\lib\ext.
    When you add a JAR file to WEB-INF/lib directory tree, the IDE mounts
              the JAR file for you automatically.
    Q: Can I put my source code in a different directory from WEB-INF/classes?
    A: Yes. For example, say you have a directory structure as follows:
    myWebApp
    + WEB-INF
    ++ Classes
    +++ myPkg
    + src
    ++ myPkg
    1. In the Filesystems tab, mount myWebApp and separately mount src.
    The Explorer should look like this:
    <path>/myWebApp
    <path>/myWebApp: /WEB-INF/classes <-IDE automatically mounts this
    <path>/src
    2. Open Tools > Options > Building > External Compilation and select this Target:
    <path>/myWebApp: /WEB-INF/classes
    (By default, this setting is project wide, if you click the >> column, you
    can set it at the user or default level.)
    3. Whenever you create a Java file under /WEB-INF/classes, the IDE automatically
    adds a servlet entry and a mapping in the web.xml. Because you are putting
    your source elsewhere, you will have to enter these entries manually, or do
    the following.
    1. Right-click the web.xml node, and choose Properties.
    2. In the Deployment panel of the web.xml properties window,
    click the ellipses (...) in the Servlets value field to display
    the Servlets Property editor.
    In Servlets Property editor, click Add to display the Add Servlet dialog box.
    In the Add Servlet dialog box, type, or browse for, the servlet class name.
    Type in the name by which you want to identify the servlet.
    3. Click the Edit button for Mappings and add the mapping for the servlet.
    4. Click OK to close the Add Servlet dialog box, then click OK to close
    the Servlets property editor.
    Note: If you don't add the web.xml entries, you might get an error like the
    following:
    "The requested object does not exist on this server.
    The link you followed is either outdated, inaccurate,
    or the server has been instructed not to let you have it.
    Please inform the site administrator of the referring page."
    Q: Why do I get invalid package name when I try to add a package to my
    web module.
    You have two options for creating packages in a web module.
    1. Create a package in a subdirectory of WEB-INF/classes.
    2. Create a package in a directory that is not in the WEB-INF tree and
    put the compiled class in the WEB-INF tree. For example, if you have the
    following directory structure, set the compilation target to WEB-INF/classes.
    myWebMod
    + src
    ++ pkg1
    + WEB-INF
    ++ classes
    +++ pkg1
    ++ lib
    In either case, the WEB-INF/classes directory must be mounted. The IDE
    does this automatically when you create a web module or turn a directory
    into a web module.
    To set the compilation target, choose Tools > Options > Building >
    External Compilation and select the target. In this example, you would
    select:
    <path>/myWebMod: /WEB-INF/classes
    Do not use a directory structure like this:
    myWebMod
    + WEB-INF
    ++ src << wrong
    ++ classes
    You can alternatively keep your source code in the appropriate package
    directory under WEB-INF/classes.
    Editing JSP Files
    Q: JSP code completion does not work now that I use the Jakarta recommended
    directory structure and use Ant to build and deploy my web applications? Can
    I fix this?
    To make code completion work, you must mount the following libraries and
    directories in the Filesystems tab of the Explorer window. Mounting a parent
    directory does not work.
    * <working-directory>/src
    * <working-directory>/build
    * Every .jar file that is copied by the build script to
              <working-directory>/build/WEB-INF/lib. (The IDE automatically mounts
                   all the jar files in WEB-INF/lib when you mount working-directory/build.)
    * Any other libraries that are used by the web application, such as
              libraries that have been deployed to the server.
    Deploying a Web Application
    Q: Can I change the URL that is used to execute a JSP page? For example,
    instead of http://localhost/welcome.jsp, can I have the URL be
    http://localhost/shopping/welcome.jsp?
    A: Yes, right-click on the WEB-INF and choose Properties from the contextual
    menu. In the Properties window, type /<name>. For example, type
    /shopping
    Note that youu can use servlet mappings in the web.xml file to control the
    mappings of URLs to servlets.
    Q: Is there a way to copy the compiled code to the server for testing
    without having to create a WAR file?
    A: Yes, this is the default action when you right-click the WEB-INF
    node and choose Deploy from the contextual menu.
    With Internal and External Tomcat installations, the deploy action causes
    the IDE to change the server's configuration file to add a context entry,
    which points to the document root of your working version of the web
    application. For example
    /myApp -> C:\My Working Directory\myApp
    When you deploy to the Sun ONE application server using the IDE's Deploy
    action, the IDE copies the web application's directory structure to
    the server's <instance>/applications/j2ee-modules directory.
    Q: How do I create a WAR file and deploy the WAR file onto different servers.
    A: To create a WAR file, right click the WEB-INF node and choose Export WAR
    file. See the online help for details about adding and filtering out
    components.
    Look at the server's documentation to find out how to deploy the WAR file
    to the server. Here is an example of deploying a WAR file to the Sun ONE
    Application Server 7:
    asadmin deploy user myusername password mypassword \
    -host localhost port 4848 type web contextroot /myApp instance server1 \
    c:\apps\myapp.war
    Note that when you deploy to a server that is registered with the IDE,
    you do not need to create a WAR file. Instead, you can right-click on the
    WEB-INF node and choose Deploy.
    Compiling a Web Application
    Q: Why do I get compiler errors when I compile from the IDE even though
    I don't get errors when I compile from the command line?
    As the IDE's classpath is derived from the mounted filesystems, the problem
    is most likely caused by not mounting the necessary filesystems. For the
    following web app, you must mount in the Explorer AWebApp, WEB-INF/classes
    (this directory is mounted automatically when you create a web app or
    turn a directory into a web app), and every JAR file in the WEB-INF/lib
    directory (which is also done automatically). Note that all classes and
    JAR files that the application needs must be in AWebApp/WEB-INF or
    AWebApp/lib or the server's location for shared libraries and classes.
    Otherwise, the module may compile but it won't run in the server.
    AllMyWebApps
    + AWebApp
    ++ WEB-INF
    +++ classes
    +++ lib
    ++++ a.jar
    ++++ b.jar
    Q: Why do I get a "cannot resolve symbol" compiler error message for my JSP.
    A: Check the import statements in your JSP file. The import statement must
    specify the fully qualified class name (package name plus class), and the
    class must be in a namespace. The namespace restriction is because the Javac
    bytecode compiler in J2SE 1.4.0 is more strict than in previous
    versions in enforcing compliance with the Java Language Specification,
    and thus rejects import statements that import a type from an unnamed namespace.
    Valid import statement:
    <%@page import="org.alpha.beta.MyBean" %>
    Also, make sure your compiled classes are in a subfolder of
    <web-module>/WEB-INF/classes, such as, for the above bean,
    <web-module>/WEB-INF/classes/org/alpha/beta/MyBean.class.
    Note that you will also get this error if you have created a link under
    WEB-INF/classes to a package in another directory. Your package must
    physically exist in the WEB-INF/classes directory.          
    Q: Why do I get " '.' expected" when my JSP is compiled.
    The Javac bytecode compiler in J2SE 1.4.0 is more strict than in previous
    versions in enforcing compliance with the Java Language Specification, and
    thus rejects import statements that import a type from an unnamed namespace.
    For example, if you have an import statement like the following, the compiler
    expects the imported class to be in a package. Therefore, the compiler
    assumes that MyBean is a package and expects the package name to be followed
    by a period (.) and either a subpackage or a class. To resolve the problem,
    put the bean in a package.
    INVALID IMPORT STATEMENT:
    <%@page import="MyBean" %>
    VALID IMPORT STATEMENT
    <%@page import="MyPackage.MyBean" %>
    Q: Why do I get a package does not exist error message when the package exists?
    A: The problem might be that you have not mounted the web module at the
    correct point. You must mount the directory that is directly above the WEB-INF
    directory. For example, if you have the following directory structure
    you must mount the webApp1 filesystem. When you specifically mount
    webApp1, the IDE recognizes the filesystem as a web module. The IDE
    automatically mounts WEB-INF/classes, so that it is in the IDE's classpath,
    and provides the execute and deploy actions when you right-click on the
    WEB-INF node:
    allMyWebApps
    + webApp1
    ++ WEB-INF
    +++ Classes
    ++++ myPkg
    You can also get this error message when you do not put your Classes directory
    under WEB-INF. For example, if you put the Classes directory in web-info, you
    will get this error message.
    You will get this error if you have created a link under WEB-INF/classes
    to a package in another directory. Your package must physically exist in
    the WEB-INF/classes directory.                    
    Running Web Applications
    Q: Why do I get the 404 error message "The requested resource is not available"?
    Why do I get the error message "The requested object does not exist on
    this server"?
    A: If you get either of these errors on a servlet, check the servlet's entry
    in the web.xml. The entry should be similar to the following:
    <servlet>
    <servlet-name>myServlet</servlet-name>
    <servlet-class>org.alpha.beta.MyServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>myServlet</servlet-name>
    <url-pattern>/MyServlet</url-pattern>
    </servlet-mapping>
    The name can be any name as long as it is the same in both mappings.
    The class must be the fully qualified class name. The pattern
    must be a pattern that matches the URI that invokes the servlet. In
    this case, the pattern matches the URI http://localhost:8081/MyServlet.
    Q: Why do I get a Generated Servlet error "Class not found."
    A: This error can occur if the class is not in a package. To resolve the
    problem, put the class in a package.
    If the class is in a package and you still get this message,
    check the import statements in your JSP file. The import statement must
    specify the fully qualified class name (package name plus class).
    For example:
    <%@page "org.alpha.beta.CustomerBean" %>
    Q: Why do I get the error message "Unable to load class" when my JSP calls
    a class from a library?
    This message usually appears because the library's JAR file is not in the
    WEB-INF/lib directory. The server expects all of the web app's JAR files
    to either be in the WEB-INF/lib directory or in the server's
    shared library directory.
    For more information, search for the "File Location in a Web Module" topic
    in the online help.
    Q: Why do I get an error message during JSP compilation that a tld file is not
    found when the file is there?
    A: The problem might be that you have not put the tld file in the correct
    place. It should go in the WEB-INF directory.
    This problem also happens if have not mounted the web module at the
    correct point.
    You must mount the directory that is directly above the WEB-INF directory. For
    example, if you have the following directory structure you must mount the
    myWebApp1 filesystem. When you specifically mount webApp1, the IDE recognizes
    the filesystem as a web module. The IDE automatically mounts WEB-INF/classes,
    which in turn adds the path to the IDE's classpath and provides the execute
    and deploy actions when you right-click on the WEB-INF node:
    allMyWebApps
    + webApp1
    ++ WEB-INF
    +++ Classes
    ++++ myPkg
    Another cause of the problem could be that the uri in your taglib statement
    is incorrect. For example, this statement is wrong:
                        <%@ taglib uri="struts-html.tld" prefix="html" %> <- Incorrect
    Instead, it should be:
                        <%@ taglib uri="WEB-INF/struts-html.tld" prefix="html" %> <- Correct
    Q: Why do I get a java.lang.ClassNotFoundException when I run my JSP file?
    Everything compiles successfully and the source editor does JSP code completion
    for the class. However, when I execute, the runtime system can't find the new
    classes.
    A: There are several causes of this error. Here are some things to check.
    1. If the class is in a library, make sure the JAR file is in the
    WEB-INF/lib directory or the server's directory for shared libraries.
    Otherwise, make sure the class is in a package under the WEB-INF/Classes
    directory.
    When compiling, the IDE builds the classpath from the mounted filesystems.
    However, when you use the deploy action, the IDE only deploys the classes,
    libraries, and files that are stored in the mounted web module.
    2. Make sure all usebean statements use a fully qualified name for
    the class name.
    WRONG:
    <jsp:useBean id="myBean" class="MyBean" scope="request" />
    CORRECT:
    <jsp:useBean id="myBean" class="org.alpha.beta.MyBean" scope="request" />
    Q. Why am I getting a 500 Internal Server Error? My application compiled but
    when I try to run it, I get an Internal Server Error.
    A: There are several reasons for internal server errors. The "root cause" or
    the "Exception" information can help to narrow in on the problem. Here are
    some common causes:
    a) One common reason is that the compiled classes are not in the right directory
    or a required library (JAR file) is not in the WEB-INF/lib directory.
    When you compile, the IDE uses the classpath to find the resources. However,
    when you deploy an application, the application must strictly follow the
    web module directory structure:
    <document root directory>
    + JSP, HTML and other public files
    + WEB-INF
    ++ web.xml
    ++ <tld files>
    ++ classes
    +++ <pkg 1>
    +++ <pkg 2>
    ++ lib
    +++ <.jar>
    For more information, search for the "File Location in a Web Module" topic
    in the online help.
    b) If you are connecting to a database, make sure the driver is put in the
    server's shared library directory or common library directory.
    c) An error occurs when the server compiles the JSP into a servlet. For example,
    the import or usebean statement is not using the fully qualified class
    name for the bean. The following statements show an incorrect and a correct
    import statement.
    import="MyBean" << wrong
    import="com.myCompany.MyBean" << correct
    In this case, the "Exception" or "Root Cause" might be "Class <bean name> not
    found in import."
    Note that a bean must always be in a package. A bean cannot be put into the
    WEB-INF/classes directory. Instead, it must be in a WEB-INF/classes
    subdirectory.
    Accessing Databases from Web Applications
    Q: I put my database driver in WEB-INF/lib but I still can't access the
    database. What do I do?
    A: If your application performs queries or run statements through JDBC, then
    putting the driver in WEB-INF is sufficient. However, if you are connecting to
    the database through the server, you need to put the driver in the
    server's shared library directory or the server's common library directory.
    You must also set up a connection pool in the server.xml file. See the
    documentation for your server on the specifics, as the details vary for
    each server.

    Hello,
    I am working on knowledge base entries for developing Web Applications with Sun ONE Studio. I would be interested in whether any of the following are helpful.
    Also, are there other entries you think should be added? Other comments? Corrections?
    Thanks
    Web Apps FAQ
    Creating a Web Application
    Q: Where do I put my JSP files in my web module.
    A: JSP files can go into the web module's document base directory or any
    of its subdirectories except for the subdirectories under WEB-INF. For example,
    the following is correct:
    correctWebModStructure
    + login.jsp
    ++ JSP_files
    +++ shop.jsp
    + WEB-INF
    ++ Classes
    ++ lib
    ++ web.xml
    The following is incorrect:
    incorrectWebModStructure
    + WEB-INF
    ++ login.jsp     
    ++ JSP_files
    +++ shop.jsp     
    ++ Classes
    ++ lib
    ++ web.xml
    Note that with the incorrect structure, the JSP files will compile but
    they will not run on a server.
    Q: Where should I put my servlet source and binary files when I create
    and execute a web module from the IDE?
    A: Your compiled classes must go in the appropriate package directory
    under <web mod document root>/WEB-INF/Classes. The easiest place to
    put the source code is in the same directory as the compiled class. To
    put your source code in a different directory, see "Can I put my source code in
    a different directory from WEB-INF/classes?"
    Note that when a class is imported by another class or by a JSP file, the
    class MUST be in a named namespace (package).
    Q: Where do I put my libraries (JAR files) in a web module?
    A: You can put the libraries in one of several places:
    o If the JAR file will be used only by the module, put it in the
    WEB-INF/lib directory.
    o If the JAR file will be shared by multiple web modules look at the server's
    documentation to find out how to make the library available across web
    modules.
    - If you are using the Sun One Application server, you can either copy
    the JAR into the <instance_dir>/lib directory (such as
         <AppServerInstallDir>\domains\domain1\server1\lib) or edit the
         classpath-suffix attribute of the java-config element in the
         server.xml file. For details about server.xml, see the Sun ONE Application
         Server Administrator�s Configuration File Reference. You must
         restart the server.
    - If you are using the internal Tomcat server, put the JAR file into one of
    the following directories:
    <ide-install-dir>/jwsdp/lib/
    <ide-install-dir>/jwsdp/common/classes
    <ide-install-dir>/jwsdp/common/lib/
    <ide-install-dir>jwsdp/shared/classes
    <ide-install-dir>/jwsdp/shared/lib/
    Note that for compilation, a JAR file must either be mounted as as an
              archive file or the JAR file must be put into <ide-install-dir>\lib\ext.
    When you add a JAR file to WEB-INF/lib directory tree, the IDE mounts
              the JAR file for you automatically.
    Q: Can I put my source code in a different directory from WEB-INF/classes?
    A: Yes. For example, say you have a directory structure as follows:
    myWebApp
    + WEB-INF
    ++ Classes
    +++ myPkg
    + src
    ++ myPkg
    1. In the Filesystems tab, mount myWebApp and separately mount src.
    The Explorer should look like this:
    <path>/myWebApp
    <path>/myWebApp: /WEB-INF/classes <-IDE automatically mounts this
    <path>/src
    2. Open Tools > Options > Building > External Compilation and select this Target:
    <path>/myWebApp: /WEB-INF/classes
    (By default, this setting is project wide, if you click the >> column, you
    can set it at the user or default level.)
    3. Whenever you create a Java file under /WEB-INF/classes, the IDE automatically
    adds a servlet entry and a mapping in the web.xml. Because you are putting
    your source elsewhere, you will have to enter these entries manually, or do
    the following.
    1. Right-click the web.xml node, and choose Properties.
    2. In the Deployment panel of the web.xml properties window,
    click the ellipses (...) in the Servlets value field to display
    the Servlets Property editor.
    In Servlets Property editor, click Add to display the Add Servlet dialog box.
    In the Add Servlet dialog box, type, or browse for, the servlet class name.
    Type in the name by which you want to identify the servlet.
    3. Click the Edit button for Mappings and add the mapping for the servlet.
    4. Click OK to close the Add Servlet dialog box, then click OK to close
    the Servlets property editor.
    Note: If you don't add the web.xml entries, you might get an error like the
    following:
    "The requested object does not exist on this server.
    The link you followed is either outdated, inaccurate,
    or the server has been instructed not to let you have it.
    Please inform the site administrator of the referring page."
    Q: Why do I get invalid package name when I try to add a package to my
    web module.
    You have two options for creating packages in a web module.
    1. Create a package in a subdirectory of WEB-INF/classes.
    2. Create a package in a directory that is not in the WEB-INF tree and
    put the compiled class in the WEB-INF tree. For example, if you have the
    following directory structure, set the compilation target to WEB-INF/classes.
    myWebMod
    + src
    ++ pkg1
    + WEB-INF
    ++ classes
    +++ pkg1
    ++ lib
    In either case, the WEB-INF/classes directory must be mounted. The IDE
    does this automatically when you create a web module or turn a directory
    into a web module.
    To set the compilation target, choose Tools > Options > Building >
    External Compilation and select the target. In this example, you would
    select:
    <path>/myWebMod: /WEB-INF/classes
    Do not use a directory structure like this:
    myWebMod
    + WEB-INF
    ++ src << wrong
    ++ classes
    You can alternatively keep your source code in the appropriate package
    directory under WEB-INF/classes.
    Editing JSP Files
    Q: JSP code completion does not work now that I use the Jakarta recommended
    directory structure and use Ant to build and deploy my web applications? Can
    I fix this?
    To make code completion work, you must mount the following libraries and
    directories in the Filesystems tab of the Explorer window. Mounting a parent
    directory does not work.
    * <working-directory>/src
    * <working-directory>/build
    * Every .jar file that is copied by the build script to
              <working-directory>/build/WEB-INF/lib. (The IDE automatically mounts
                   all the jar files in WEB-INF/lib when you mount working-directory/build.)
    * Any other libraries that are used by the web application, such as
              libraries that have been deployed to the server.
    Deploying a Web Application
    Q: Can I change the URL that is used to execute a JSP page? For example,
    instead of http://localhost/welcome.jsp, can I have the URL be
    http://localhost/shopping/welcome.jsp?
    A: Yes, right-click on the WEB-INF and choose Properties from the contextual
    menu. In the Properties window, type /<name>. For example, type
    /shopping
    Note that youu can use servlet mappings in the web.xml file to control the
    mappings of URLs to servlets.
    Q: Is there a way to copy the compiled code to the server for testing
    without having to create a WAR file?
    A: Yes, this is the default action when you right-click the WEB-INF
    node and choose Deploy from the contextual menu.
    With Internal and External Tomcat installations, the deploy action causes
    the IDE to change the server's configuration file to add a context entry,
    which points to the document root of your working version of the web
    application. For example
    /myApp -> C:\My Working Directory\myApp
    When you deploy to the Sun ONE application server using the IDE's Deploy
    action, the IDE copies the web application's directory structure to
    the server's <instance>/applications/j2ee-modules directory.
    Q: How do I create a WAR file and deploy the WAR file onto different servers.
    A: To create a WAR file, right click the WEB-INF node and choose Export WAR
    file. See the online help for details about adding and filtering out
    components.
    Look at the server's documentation to find out how to deploy the WAR file
    to the server. Here is an example of deploying a WAR file to the Sun ONE
    Application Server 7:
    asadmin deploy user myusername password mypassword \
    -host localhost port 4848 type web contextroot /myApp instance server1 \
    c:\apps\myapp.war
    Note that when you deploy to a server that is registered with the IDE,
    you do not need to create a WAR file. Instead, you can right-click on the
    WEB-INF node and choose Deploy.
    Compiling a Web Application
    Q: Why do I get compiler errors when I compile from the IDE even though
    I don't get errors when I compile from the command line?
    As the IDE's classpath is derived from the mounted filesystems, the problem
    is most likely caused by not mounting the necessary filesystems. For the
    following web app, you must mount in the Explorer AWebApp, WEB-INF/classes
    (this directory is mounted automatically when you create a web app or
    turn a directory into a web app), and every JAR file in the WEB-INF/lib
    directory (which is also done automatically). Note that all classes and
    JAR files that the application needs must be in AWebApp/WEB-INF or
    AWebApp/lib or the server's location for shared libraries and classes.
    Otherwise, the module may compile but it won't run in the server.
    AllMyWebApps
    + AWebApp
    ++ WEB-INF
    +++ classes
    +++ lib
    ++++ a.jar
    ++++ b.jar
    Q: Why do I get a "cannot resolve symbol" compiler error message for my JSP.
    A: Check the import statements in your JSP file. The import statement must
    specify the fully qualified class name (package name plus class), and the
    class must be in a namespace. The namespace restriction is because the Javac
    bytecode compiler in J2SE 1.4.0 is more strict than in previous
    versions in enforcing compliance with the Java Language Specification,
    and thus rejects import statements that import a type from an unnamed namespace.
    Valid import statement:
    <%@page import="org.alpha.beta.MyBean" %>
    Also, make sure your compiled classes are in a subfolder of
    <web-module>/WEB-INF/classes, such as, for the above bean,
    <web-module>/WEB-INF/classes/org/alpha/beta/MyBean.class.
    Note that you will also get this error if you have created a link under
    WEB-INF/classes to a package in another directory. Your package must
    physically exist in the WEB-INF/classes directory.          
    Q: Why do I get " '.' expected" when my JSP is compiled.
    The Javac bytecode compiler in J2SE 1.4.0 is more strict than in previous
    versions in enforcing compliance with the Java Language Specification, and
    thus rejects import statements that import a type from an unnamed namespace.
    For example, if you have an import statement like the following, the compiler
    expects the imported class to be in a package. Therefore, the compiler
    assumes that MyBean is a package and expects the package name to be followed
    by a period (.) and either a subpackage or a class. To resolve the problem,
    put the bean in a package.
    INVALID IMPORT STATEMENT:
    <%@page import="MyBean" %>
    VALID IMPORT STATEMENT
    <%@page import="MyPackage.MyBean" %>
    Q: Why do I get a package does not exist error message when the package exists?
    A: The problem might be that you have not mounted the web module at the
    correct point. You must mount the directory that is directly above the WEB-INF
    directory. For example, if you have the following directory structure
    you must mount the webApp1 filesystem. When you specifically mount
    webApp1, the IDE recognizes the filesystem as a web module. The IDE
    automatically mounts WEB-INF/classes, so that it is in the IDE's classpath,
    and provides the execute and deploy actions when you right-click on the
    WEB-INF node:
    allMyWebApps
    + webApp1
    ++ WEB-INF
    +++ Classes
    ++++ myPkg
    You can also get this error message when you do not put your Classes directory
    under WEB-INF. For example, if you put the Classes directory in web-info, you
    will get this error message.
    You will get this error if you have created a link under WEB-INF/classes
    to a package in another directory. Your package must physically exist in
    the WEB-INF/classes directory.                    
    Running Web Applications
    Q: Why do I get the 404 error message "The requested resource is not available"?
    Why do I get the error message "The requested object does not exist on
    this server"?
    A: If you get either of these errors on a servlet, check the servlet's entry
    in the web.xml. The entry should be similar to the following:
    <servlet>
    <servlet-name>myServlet</servlet-name>
    <servlet-class>org.alpha.beta.MyServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>myServlet</servlet-name>
    <url-pattern>/MyServlet</url-pattern>
    </servlet-mapping>
    The name can be any name as long as it is the same in both mappings.
    The class must be the fully qualified class name. The pattern
    must be a pattern that matches the URI that invokes the servlet. In
    this case, the pattern matches the URI http://localhost:8081/MyServlet.
    Q: Why do I get a Generated Servlet error "Class not found."
    A: This error can occur if the class is not in a package. To resolve the
    problem, put the class in a package.
    If the class is in a package and you still get this message,
    check the import statements in your JSP file. The import statement must
    specify the fully qualified class name (package name plus class).
    For example:
    <%@page "org.alpha.beta.CustomerBean" %>
    Q: Why do I get the error message "Unable to load class" when my JSP calls
    a class from a library?
    This message usually appears because the library's JAR file is not in the
    WEB-INF/lib directory. The server expects all of the web app's JAR files
    to either be in the WEB-INF/lib directory or in the server's
    shared library directory.
    For more information, search for the "File Location in a Web Module" topic
    in the online help.
    Q: Why do I get an error message during JSP compilation that a tld file is not
    found when the file is there?
    A: The problem might be that you have not put the tld file in the correct
    place. It should go in the WEB-INF directory.
    This problem also happens if have not mounted the web module at the
    correct point.
    You must mount the directory that is directly above the WEB-INF directory. For
    example, if you have the following directory structure you must mount the
    myWebApp1 filesystem. When you specifically mount webApp1, the IDE recognizes
    the filesystem as a web module. The IDE automatically mounts WEB-INF/classes,
    which in turn adds the path to the IDE's classpath and provides the execute
    and deploy actions when you right-click on the WEB-INF node:
    allMyWebApps
    + webApp1
    ++ WEB-INF
    +++ Classes
    ++++ myPkg
    Another cause of the problem could be that the uri in your taglib statement
    is incorrect. For example, this statement is wrong:
                        <%@ taglib uri="struts-html.tld" prefix="html" %> <- Incorrect
    Instead, it should be:
                        <%@ taglib uri="WEB-INF/struts-html.tld" prefix="html" %> <- Correct
    Q: Why do I get a java.lang.ClassNotFoundException when I run my JSP file?
    Everything compiles successfully and the source editor does JSP code completion
    for the class. However, when I execute, the runtime system can't find the new
    classes.
    A: There are several causes of this error. Here are some things to check.
    1. If the class is in a library, make sure the JAR file is in the
    WEB-INF/lib directory or the server's directory for shared libraries.
    Otherwise, make sure the class is in a package under the WEB-INF/Classes
    directory.
    When compiling, the IDE builds the classpath from the mounted filesystems.
    However, when you use the deploy action, the IDE only deploys the classes,
    libraries, and files that are stored in the mounted web module.
    2. Make sure all usebean statements use a fully qualified name for
    the class name.
    WRONG:
    <jsp:useBean id="myBean" class="MyBean" scope="request" />
    CORRECT:
    <jsp:useBean id="myBean" class="org.alpha.beta.MyBean" scope="request" />
    Q. Why am I getting a 500 Internal Server Error? My application compiled but
    when I try to run it, I get an Internal Server Error.
    A: There are several reasons for internal server errors. The "root cause" or
    the "Exception" information can help to narrow in on the problem. Here are
    some common causes:
    a) One common reason is that the compiled classes are not in the right directory
    or a required library (JAR file) is not in the WEB-INF/lib directory.
    When you compile, the IDE uses the classpath to find the resources. However,
    when you deploy an application, the application must strictly follow the
    web module directory structure:
    <document root directory>
    + JSP, HTML and other public files
    + WEB-INF
    ++ web.xml
    ++ <tld files>
    ++ classes
    +++ <pkg 1>
    +++ <pkg 2>
    ++ lib
    +++ <.jar>
    For more information, search for the "File Location in a Web Module" topic
    in the online help.
    b) If you are connecting to a database, make sure the driver is put in the
    server's shared library directory or common library directory.
    c) An error occurs when the server compiles the JSP into a servlet. For example,
    the import or usebean statement is not using the fully qualified class
    name for the bean. The following statements show an incorrect and a correct
    import statement.
    import="MyBean" << wrong
    import="com.myCompany.MyBean" << correct
    In this case, the "Exception" or "Root Cause" might be "Class <bean name> not
    found in import."
    Note that a bean must always be in a package. A bean cannot be put into the
    WEB-INF/classes directory. Instead, it must be in a WEB-INF/classes
    subdirectory.
    Accessing Databases from Web Applications
    Q: I put my database driver in WEB-INF/lib but I still can't access the
    database. What do I do?
    A: If your application performs queries or run statements through JDBC, then
    putting the driver in WEB-INF is sufficient. However, if you are connecting to
    the database through the server, you need to put the driver in the
    server's shared library directory or the server's common library directory.
    You must also set up a connection pool in the server.xml file. See the
    documentation for your server on the specifics, as the details vary for
    each server.

  • Directory Structure for multiple applications at one host

    Can I have multiple (more than one) WEB-INF directory structures in the public_html directory for different web applications? If I do this, how do setup the url-pattern in the Servlet Mapping tag in the web.xml file? How do I setup the URL that calls the servlet from the HTML that has been send to the user�s browser?

    If I understand your question, you want multiple contexts. All App Servers/Web Servers allow you to setup multiple contexts. Normally if your root context is in /home/myhome/app_server/
    then you would setup multiple contexts by creating a folder for each context:
    /home/myhome/app_server/context1/
    /home/myhome/app_server/context2/
    Each would have their own full application/website. And the way to reference these would be as such:
    if the domain, www.mydomain.com, is mapped to /home/myhome/app_server/
    www.mydomain.com/context1/
    www.mydomain.com/context2/
    I think that is what you were asking. Hope it helps

  • Serializing a JavaBean to the WEB-INF directory or subdirectories

    Hello, I'm hoping someone can help me on this.
    I'm working with two scenarios in WSAD Enterprise Edition 5.0.0.2 for
    serializing a JavaBean (called AddressBean) to the following location
    in my Web application:
    /WEB-INF/classes/resources/serializable
    The data corresponding to the bean I'm serializing is being stored in
    a file with a name that makes it unique on the file system (e.g.
    jeff.ser, jill.ser). In the first scenario, I start by getting a
    FileOutputStream, then an ObjectOutputStream which is then used to
    write my JavaBean as needed. All of this is done in the first
    scenario from a JSP located in:
    myWebApp/Web Content/jsp/JSP1.jsp
    That works fine and as I'd expect. However, I'm not able to do that
    in the second scenario. In this scenario, I created an additional
    method in the bean itself that will actually serialize an object of
    its own type to the same directory structure that I showed above (i.e.
    under the WEB-INF directory). That is, in my bean, I have the
    following:
    public void writeDataToFile(AddressBean bean, String path) {
    FileOutputStream fos = null;
    ObjectOutputStream oos = null;
    try {
    fos = new FileOutputStream(path);
    oos = new ObjectOutputStream(fos);
    oos.writeObject(bean);
    oos.close();
    catch(Exception e) {
    e.printStackTrace();
    In this scenario, another JSP (call it JSP2.jsp) is creating an
    instance of AddressBean by using the jsp:useBean tag. The real path
    for the .ser file is figured out in the JSP code (same as was done in
    JSP1.jsp), and then I delegate the serialization part to the bean
    itself like so:
    // In JSP2.jsp
    <jsp:useBean id="ab" class="examples.beans.simple.AddressBean" />
    AddressBean address = (AddressBean) pageContext.getAttribute("ab");
    // get the path
    String path = ...
    String realPath = application.getRealPath(path);
    // write the object
    address.writeDataToFile(ab, realPath);
    What happens is that I get a FileNotFoundException while trying to
    create the FileOutputStream in the writeDataToFile() method in
    AddressBean at runtime. The message in the console states:
    java.io.FileNotFoundException:
    C:\WINNT\Profiles\myself\Personal\IBM\wsad\myworkbench\myWebApp\Web
    Content\ (Access is denied)
    The source file for AddressBean is located at:
    myWebApp/Java Source/examples.beans.simple.AddressBean
    WHAT is going on here!? I know that everything stored underneath the
    WEB-INF directory is not served to clients so I'm also assuming that
    whatever stored in that directory or its subdirectories is not
    accessible to clients by default. The only real difference between
    the two scenarios that I've described is that in the second one, the
    attempt to get a FileOutputStream is being made by a resource (i.e.
    AddressBean) that is outside of the "Web Content" directory structure
    in WSAD. However, the "Java Source" directory, which contains the
    package housing my AddressBean class, is also under myWebApp so I'm
    not seeing what the problem is at the moment.
    If anyone has any ideas, suggestions, solutions, please let me know.
    I'm stumped. Thank you!
    Jeff

    I figured it out, and it was my mistake. The problem was in a method defined in my AddressBean class that would take a String argument and use it to help create a unique file name (i.e. one with a .ser extension to contain the serialized bean data) for purposes of serialization later.
    Basically, I was using a local variable in the method unintentionally instead of the instance variable that I had defined in the bean so my path value was null at runtime--hence the FileNotFoundException.
    I'm still not sure why the (Access is denied) message was appearing, but I suspect it was b/c the absolute path that I'd end up with at runtime wasn't kosher; or, not having a destination .ser file was the problem.
    In any event, I fixed the mistake and could serialize a JavaBean in several ways:
    1. From a JSP directly
    2. By using a method defined in the JavaBean itself
    3. By passing on the request, which contained the JavaBean as an attribute, to a servlet that took care of the serialization
    Jeff

  • Where to put persistent (writeable) files in web apps?

    I want to persist a small amount of data from a web-app, saving when the app is stopped and reloading when started.
    This will be done from a ContextListener, and I plan simply to serialise a small table when the context is destroyed.
    The question is, where should I put the file? Obviously I could simply specify an absolute directory, probably via an environmental entry (so as to specify it in the server, since it would be dependant on server configuration). I'd far rather have something more automatic.
    I suppose I could put it somewhere under WEB-INF, but that doesn't seem right, the web-app directory should be read-only.
    Servlet engines typically have a writable working directory where they keep compiled JSPs and persisted sessions, but is there a standard way of getting to it?

    Well, now I'm not so sure anymore. But I have some
    checkboxes I want to share among different
    applications. So why can you share classes and jar
    files and can not share JSP's?Sounds like more trouble than it's worth. Disk space is cheap. I'd deploy them with each app.
    The only thing that would make me hesitate is the DRY principle. In that case, I might have "common" JSPs in my version control. I'd have the Ant script from each Web app check out the same "common" JSPs and build them into WARs. That would keep those JSPs common and not violate DRY. JMO - MOD

  • Apple Web apps versus 3rd party Web apps

    There would appear to be some confusion regarding the use of Web apps on the iPhone; specifically, whether the iPhone warranty is voided if a Web app not currently offered on the Apple site at: http://www.apple.com/webapps/, is used on the iPhone. The issue came to light when a poster suggested using the iPhone Pixel Fix Web app (http://www.ebaspace.com/iphone-app/#_home), intended to resolve issues with stuck or dead pixels on the screen.
    My understanding is that the use of any Web app that is not Apple approved automatically voids the iPhone warranty, no matter how innocuous it may seem or be. However, it may be that some users consider 3rd party Web apps, such as iPhone Pixel Fix, to be "allowed", as they run on locked/legal iPhones, and are not downloaded onto the phone.
    As usual, I am happy to be corrected if I am wrong. May I have your thoughts, advice etc.?
    Cheers.

    jia10,
    Web apps were available even before Apple posted the web apps directory. The information about each web app in the web apps directory is supplied by the submitter which is usually the author. Being included in the web apps directory does not indicate endorsement, recommendation, etc on the part of Apple, it is a directory of available web apps.
    No web app should be able to void your warranty, regardless of the site it is posted to, unless it were to exploit a known or unknown security hole. For example, there was a web app that would exploit a security hole to "jailbreak" the iPhone. That was fixed in a previous update to the iPhone.
    The Pixel fix web app cycles the colors on the iPhone screen several times using Javascript. It does not install anything on the screen. Essentially it tries to do the opposite of screen burn in. Whether or not it will work, I do not know.
    However, using a web-based application that does not overwrite system files or modify the file system, does not void your warranty.
    Installing third-party native applications or files that require you to crack the iPhone file system could potentially cause damage to the iPhone's firmware, and would void your warranty.
    Hope this helps,
    Nathan C.

  • Mapping of Web App context root and the physical directory of the web app

    I'm running Weblogic 7.0 on Windows2000.The physical directory of my web application
    is D:\WL8\weblogic81\TestDeploy\build\TestWebApp and under these directory I have
    my JSPS, static HTML and WEB-INF. I define the context path of this web app in
    the weblogic.xml ;-
    <weblogic-web-app>
         <context-root>/testapp</context-root>
    </weblogic-web-app>
    As a result of deploying this web app in the server (or it may be created manually
    also), the following entry gets inserted in the server's config.xml ,-
    <Application Deployed="true" Name="TestWebApp"
    Path="D:\WL8\weblogic81\TestDeploy\build" TwoPhase="true">
    <WebAppComponent Name="TestWebApp" Targets="myserver" URI="TestWebApp"/>
    </Application>
    Now, whenever I make a request of the form "http://localhost:7001/testapp/..",
    it's properly executing my web app. My question is, how does the container knows
    that for any request for the web app with context path as 'testapp', it has to
    server files from D:\WL8\weblogic81\TestDeploy\build\TestWebApp. In the above
    process, nowhere such mapping is specified. I expected something like Tomcat's
    server.xml, where in docbase we clearly specify this mapping between the context
    path and the physical directory. Please help.

    Let me give some more details and hopefully this will make things clearer.
    Say you deploy /foo/bar/myweb.war and in myweb.war you configure a
    context-root of /rob
    During deployment, the server creates an ApplicationMBean with a path of
    /foo/bar/. It then creates a WebAppComponent with a uri of myweb.war.
    Next, deployment calls back on the web container and tells it to deploy
    the WebAppComponent. The web container reads the myweb.war, parses
    descriptors etc. The web container then updates its data structures to
    register that myweb.war has a context path of /rob. (It has to figure
    out all the other servlet mappings as well.)
    When a request for /rob/foo comes in, the web container consults its
    data structures to determine which webapp and servlet receives the
    request. This is not a linear search of all webapps and servlets.
    There's much better ways to do pattern matching.
    Hope this clears things up. Let me know if you still have questions.
    -- Rob
    Arindam Chandra wrote:
    Thanks for the answer. Still one thing is not clear. Whatever context path I declare
    for my web app as the value of <context-root> element in the weblogic.xml (in
    my example it's "/testapp"), it is no where mapped with the "URI" attribute (or
    any other attribute, sub-element whatsoever in the <Application> element).
    Application Deployed="true" Name="TestWebApp"
    Path="D:\WL8\weblogic81\TestDeploy\build" TwoPhase="true">
    <WebAppComponent Name="TestWebApp" Targets="myserver" URI="TestWebApp"/>
    </Application>
    So when a request of the form http://myweblogic.com:7001/testapp/... arrives at
    the server, how does the server knows that it has to serve this request with files
    from D:\WL8\weblogic81\TestDeploy\build\TestWebApp ? It should not be like the
    web container iterates thru all the web application entries in config.xml and
    tries to match with one context-root declaration. I repeat, I expected some mapping
    similar to Tomcat's server.xml, where in the <docbase> element u clearly specify
    the mapping between the context path and the physical directory
    Rob Woollen <[email protected]> wrote:
    Arindam Chandra wrote:
    I'm running Weblogic 7.0 on Windows2000.The physical directory of myweb application
    is D:\WL8\weblogic81\TestDeploy\build\TestWebApp and under these directoryI have
    my JSPS, static HTML and WEB-INF. I define the context path of thisweb app in
    the weblogic.xml ;-
    <weblogic-web-app>
         <context-root>/testapp</context-root>
    </weblogic-web-app>
    As a result of deploying this web app in the server (or it may be createdmanually
    also), the following entry gets inserted in the server's config.xml,-
    <>So the server will look for your web application at the Application Path
    (D:\WL8\weblogic81\TestDeploy\build|) + the web uri (TestWebApp). So
    it
    maps the context-root you've specified /testapp to that path.
    It's a little clearer in the case where you had a full-fledged EAR.
    Then you'r application path would map to the "root" of the EAR, and the
    uris would point to the various modules (eg webapps.)
    -- Rob
    Now, whenever I make a request of the form "http://localhost:7001/testapp/..",
    it's properly executing my web app. My question is, how does the containerknows
    that for any request for the web app with context path as 'testapp',it has to
    server files from D:\WL8\weblogic81\TestDeploy\build\TestWebApp. Inthe above
    process, nowhere such mapping is specified. I expected something likeTomcat's
    server.xml, where in docbase we clearly specify this mapping betweenthe context
    path and the physical directory. Please help.

Maybe you are looking for