Directory structure web-inf

HI,
first of all sorry for asking such an easy question , but it is bugging me for a long time..
actually i am building a web application in which user has the ability to upload his images under directory
web-inf
-->images
now these images can be viewed online bcz they are under web-inf...but the problem is i am working on production server and i have to replace the war after some changes or bug fixing. what ever images user has uploaded will be deleted as i replace the war..
if i save these images outside the server then . obviously i cant access them online...only if i copy them back in web-inf again and then give link to user..
can anybody suggest me what should b the suitable solution for this problem-..and i dont want to store images in database.. :-)

actually . !
let me explain you the whole scenario...i dont want to save image under
webinf/images/
..because i am continuously updating and war file by replacing it..if i store image in image folder then what ever is in that folder will be deleted when i will replace it with the new one.......so what i did, i place images in some other folder say
c:/userUploadedImage
now i want to show the stored image to the online user in html image tag.....
....as you can understand..the image stored at c:/... cant be shown online.....right ?
so what i am doing is that i am copying the requested image from c:/... to webinf/images. when user need that image to view it....
that might sound bad...
but this was quiet easy to implement...and the servlet approach doesnt fits in the scenario anywhere... ??? perhaps may b i am missing some thing...

Similar Messages

  • Obtain parent directory of WEB-INF from within a servlet

    hi to everyone!
    i have got a directory containing a WEB-INF directory (with web.xml and all the other stuff necessary). Hoy is it possible to obtain the parent directory of WEB-INF directory FROM WITHIN A SERVLET, put in lib directory?
    let's say:
    A----WEB-INF---classes
    ---lib----MyServlet.jar
    ---tlds
    ---dtds
    How can I get A from within MyServlet.jar? Please help. Thank's a lot...
    Wendigo

    getServletContext().getRealPath("WEB-INF")

  • Tomcat directory structure + jsp

    Hi all,
    I have been trying for a long time now to setup my tomcat-directory as described, but I don't get my application running... My directory structure is currently as follows:
    d:\
        webapp\
             web\
                  WEB-INF\
                        classes\
                             servlet
                        libThe path for tomcat is set to d:\webapp\web, where my JSPs are. From the JSPs, I start some applets - the problem is, where do I have to put them? They are in the directory project; if I put this directory in WEB-INF/classes, they are not found. If I put them directly in the web-directory, they are found, but not the classes they depend on... I can then put all the classes I need in the web-directory, and my application runs, but as far as I understood, this is not the supposed setting :-( And besides, the only reason for the WEB-INF directory would then be the servlets inside (which run without problems!)
    Might I do something wrong in calling the applets? In the moment, I start them with <applet code="project/Start.class"> Or do I need to change something in the web.xml file?
    Thanks for any hints,
    Thea

    but as far as I understood, this is not the supposed setting That IS the appropriate setting.
    An applet runs on the client machine.
    Therefore the client has to download all the class files to run the applet.
    The client cannot download any classes that are under WEB-INF. WEB-INF directory is for the server only.
    Therefore any classes needed to run your applet must be outside of the WEB-INF folder, so they can be downloaded.
    JSP/Servlet code runs on the server side. The code for this you can put under WEB-INF, and it will only be available to the server. That way you have your application, but don't have the code freely downloadable.
    Cheers,
    evnafets

  • WebLogic 8.1 SP6 NoClassDefFoundError for jar in WEB-INF/lib dir (Solaris)

    Hi,
    I am getting a NoClassDefFoundError for a class that is contained in the WEB-INF/lib folder of my ear/war file.
    The strange thing is that this only fails when i try to deploy to production. In UAT (also on Solaris) and in Windows (test) the exact same versions of the deployment / ear file everything seems fine and the class is accessed.
    When i added the jar file to the classpath i experienced a "Unsupported major.minor version...." of this class error so i am reluctant to go down that route and anyway would rather consistent deployment between the systems.
    I would REALLY appreciate any suggestions as to what might be the cause or what i could try.
    Thanks,
    David

    Thanks for your replies. Sorry if i didn't post enough information for you...
    I appear to have found the problem (i managed to recreate in Windows) but have no idea why this is occuring.
    In the startManagedWebLogic.cmd file, if i specify "set JAVA_OPTIONS= xxxxxx" then the system will not pick up this one jar file. This appears to be the case even with "set JAVA_OPTIONS=-Dweblogic.attribute=value -Djava.attribute=value" which i assume is a default value as i can't remember having set it... The moment i comment out this set JAVA_OPTIONS line then the system is able to find the jar file.
    (Answering your questions:
    - The class in question is being referenced from another class also contained in a jar file in the WEB-INF/lib directory
    - the WEB-INF is part of the WAR which is contained in the EAR which is deployed on my server)
    For now i am ok but know that in a future build i am going to have to use the JAVA_OPTIONS parameter so would really appreciate any suggestions as to why this might be happening.
    Thanks,
    David

  • Copying files from same directory as *.java files and moving to WEB-INF/classes/ package name

    In our current application we have the following source directory structure:
              src -
              - com
              - edeploy
              - subdirs ... (many directories here)
              - jsp
              -subdirs ... (many directories here)
              In com.edeploy.subdirs, there exists *.java files, and *.gxq files (query
              files). I would like to modify my build.cmd script to copy the *.gxq files
              into the same directory as the class files.
              Here's my script so far:
              @REM Create list of files to compile
              DIR /S /B /A:-D src\com\*.java >class.list
              @REM Create list of query files
              DIR /S /B /A:-D src\com\*.gxq >query.list
              @REM Compile
              javac -d stage\WEB-INF\classes @class.list
              @REM Copy query files into class directory
              .......... code needed here ......
              Can anyone help me with this?
              Thanks,
              Matt
              

    You may want to check out:
              http://jakarta.apache.org/ant/index.html
              Gary
              "Matt Raible" <[email protected]> wrote in message
              news:[email protected]..
              > In our current application we have the following source directory
              structure:
              >
              > src -
              > - com
              > - edeploy
              > - subdirs ... (many directories here)
              > - jsp
              > -subdirs ... (many directories here)
              >
              >
              > In com.edeploy.subdirs, there exists *.java files, and *.gxq files (query
              > files). I would like to modify my build.cmd script to copy the *.gxq
              files
              > into the same directory as the class files.
              >
              > Here's my script so far:
              >
              > @REM Create list of files to compile
              > DIR /S /B /A:-D src\com\*.java >class.list
              >
              > @REM Create list of query files
              > DIR /S /B /A:-D src\com\*.gxq >query.list
              >
              > @REM Compile
              > javac -d stage\WEB-INF\classes @class.list
              >
              > @REM Copy query files into class directory
              > .......... code needed here ......
              >
              > Can anyone help me with this?
              >
              > Thanks,
              >
              > Matt
              >
              >
              

  • Directory Structure ?s for an Exploded Web Application

    We have an application that consists only of JSPs and Servlets, no
    EJBs. I am researching whether or not it's worthwhile to start using
    EJBs. We're also migrating from Weblogic 5 to 6.1. I've managed to
    migrate our application fine and have it up and running on WLS 6.1.
    I'm confused about the exploded directory structure, the
    application.xml file, where to put the EJBs and whether or not I have
    to jar them. Here's our current directory structure:
    DefaultWebApp/               JSPs here
    DefaultWebApp/WEB-INF          web.xml and weblogic.xml here
    DefaultWebApp/WEB-INF/classes     Servlets and other classes here
    DefaultWebApp/WEB-INF/lib     do my un-jar-ed EJBs go here?
    I've been reading a lot of BEA's documentation, particularly
    ‘Deploying an Exploded J2EE Application' and a ‘Web Application PDF',
    and looking for relevant threads on the weblogic.developer.interest
    groups. It looks like the application.xml should go in a new
    DefaultWebApp/META-INF directory. But where do the EJBs go?
    I also see some directory structures with another /web directory
    that's confusing me.
    Oh, I've also managed to compile and jar up a trial Stateless Session
    EJB. Then I think I ‘auto-deployed' it into the /applications
    directory, and Weblogic seems to recognize it. But when I tried to
    reference it in a JSP, I got an error message ‘class x is public,
    should be declared in a file named x.java'. I'm assuming this is
    related to the application.xml, where I need to define the ejb
    directory.
    Thanks.

    To deploy your web app together with your EJBs, you need to create
    an "EAR" structure. Both your webapp and your EJB jars will be within
    this new structure, at the same level. You may jar up your EJBs, or you
    may explode their structure, it's up to you.
    The resulting structure should look something like below:
    EnterpriseApp/ <-- new top level
    EnterpriseApp/META-INF/
    EnterpriseApp/META-INF/application.xml
    EnterpriseApp/lib/ <-- shared libraries (if any)
    EnterpriseApp/EJB/ <-- ejbs go here
    EnterpriseApp/EJB/META-INF/ejb-jar.xml
    EnterpriseApp/EJB/META-INF/weblogic-ejb-jar.xml
    EnterpriseApp/EJB/com/your/ejb/classes/here
    EnterpriseApp/WebApp/ <-- move your current app here
    EnterpriseApp/WebApp/index.jsp <-- JSPs goes here
    EnterpriseApp/WebApp/other.jsp
    EnterpriseApp/WebApp/WEB-INF/web.xml
    EnterpriseApp/WebApp/WEB-INF/weblogic.xml
    EnterpriseApp/WebApp/WEB-INF/lib <-- ui libraries go here
    EnterpriseApp/WebApp/WEB-INF/classes <-- servlets go here
    The above structure is identical to the structure to an EAR file, only "exploded"
    as actual files and directories instead of being "jarred" into a single EAR file.
    Your application.xml in this case would specify something like:
    <application>
    <display-name>EnterpriseApp</display-name>
    <description>My Enterprise Application</display-name>
    <module>
    <ejb>EJB</ejb>
    </module>
    <module>
    <web>
    <web-uri>WebApp</web-uri>
    <context-root>/yourAppRoot</context-root>
    </web>
    </module>
    </application>
    And in config.xml you would have an entry similar to:
    <Application Deployed="true" Name="EnterpriseApp"
    Path=".\config\mydomain\applications\EnterpriseApp">
    <WebAppComponent Name="ui" Targets="myserver" URI="WebApp"/>
    <EJBComponent Name="ejb" Targets="myserver" URI="EJB"/>
    </Application>
    regards,
    -Ade

  • 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

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

  • Weblogic only deploys 'WEB-INF' directory....

    Hi,
    I desperatly try to deploy an exploded war file - but it seems weblogic just pics the web-inf folder & leaves everything else behind. Deployment failes because during startup the application tries to access a file stored outside the WEB-INF, which would be the top-level of the war archive.
    Anyone knows why this is the case? Is this configureable somehow?
    Weblogic version is 11g (10.3.2) under Windows....

    Thanks for the quick response!
    It's a Webservice using Axis.
    I know that during startup, a servlet tries to load stuff like configuration details, logging details etc. "Unfortunatly" those files are stored in a config folder on the "root" level of the war file.
    In essence, the structure looks like this:
    ---| some_webservices.war
    ------| WEB-INF
    ---------| lib
    ---------| ..........
    ------| META-INF
    ------| config
    ---------| ...some files...
    If i deploy the whole thing as a archive, the applicaton works fine - but if I explode the war file & choose to deploy the root folder, weblogic just grabs the web-inf folder, copies it to the server & starts the application (which leads to the problem).
    To answer your other questions:
    - no there are no "weblogic" errors in the logfile - the only error comes from the application, because it tries to load a file from the config directory...

  • Why cant I access a WEB-INF directory?

    Hi,
    I had a war file from a book that I did jar xvf on. It created a directory structure of the nature
    <TOMCAT>/ex0101/WEB-INF/etc...
    If I go to
    http://localhost:8080/ex0101it works
    If I create anotherDirectory inside ex0101, and do
    http://localhost:8080/ex0101/ANOTHER-DIRECTORYit works
    But If I do
    http://localhost:8080/ex0101/WEB-INFI get:
    HTTP Status 404 - /ex0101/WEB-INF/WHY?

    The WEB-INF directory is designated to be hidden from
    the end user. It is used for configuration files
    like web.xml, struts-config.xml, and other "utility"
    files. For security purposes, the end user is not
    allowed to browse this directory directly.oh thank you so much, I was sitting here going crazy, I looked at the directory property and it was not hidden on Windows, so I was so confused, but I guess it is hidden in Tomcat, thanks a lot, you are a truly kind man

  • Changing the directory Structure of Jsp and web.xml files

    Hi,
    I am using the JDeveloper 11g preview. Can any one tell me how to change the Jsp and web.xml files ( not in WEB-INF directory of the application) to another directory.
    Thanks in Advance
    Gopal

    Hi Frank,
    Is it possible for me to change the folder structure which JDeveloper is providing for web project?
    By default JDeveloper is giving the following folder structure.
    In the project's root folder there is a public_html and src folder along with .jpr file.
    In public_html folder thre is an WEB-INF folder and a jsp file
    In WEB-INF folder there is an classes folder along with web.xml file.
    I need to have the following folder structure :
    The WEB-INF folder should be in root folder of project not in public_html folder
    src folder must be in WEB-INF folder.
    Thanks in Advance
    Anil Golla

  • Directory structure of web sphere

    i did not get the directory structure of the web sphere 6.1 to deploy a sample application like webapps->dirname->WEB-INF->classes etc in tomcat server.
    The project is developed under tomcat but it has to be convert to the web sphere.

    please google..
    http://www.exforsys.com/tutorials/websphere/websphere-v5.0-workbench-basics-create-j2ee-projects.html
    http://publib.boulder.ibm.com/infocenter/wpfhelp/v6r1m2/index.jsp?topic=/com.bowstreet.designer.doc/designer/c_devenv_dir_structure.htm

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

  • Directory Structures in sun one Web Server 6.1

    I am struggling to run my j2ee application on newly set up sun one web server 6.1 on my pc.
    Can somebody please help me expalining directory structure in detail for sun one web server 6.1?
    Where should I place my java beans and it's class files?
    what should WEB-INF -> lib folder contains?
    I make war file using j2ee deployment tool. Do i need to change anything in web.xml and sun-web.xml?
    Thanks in advance.

    Thanks chris.
    It looks better now. still it gives following errors in error log. I only have java beans not the EJB.
    here are the error.
    [20/Oct/2003:11:35:59] info ( 632): Internal Info: loading servlet /peoplechannel/SearchLDAPIn.jsp
    [20/Oct/2003:11:35:59] warning ( 632): Internal error: newInstance failed (servlet class=_jsps._peoplechannel._SearchLDAPIn_jsp): java.lang.IllegalAccessException: Class com.iplanet.server.http.servlet.NSServletEntity can not access a member of class jsps.peoplechannel._SearchLDAPIn_jsp with modifiers "public"
    [20/Oct/2003:11:35:59] warning ( 632): Internal error: Failed to get GenericServlet. (uri=/peoplechannel/SearchLDAPIn.jsp,SCRIPT_NAME=/peoplechannel/SearchLDAPIn.jsp)
    what's the syntax to change loading precompiled jsp to force web server to compile jsp?
    I really need urgent help.
    Thanks,
    naimesh

  • Find path to Web-inf directory from root

    Hi All,
    I have a application for which the "config.txt" file is placed in "Web-inf" directory. I want to get the complete path to this file so that I can access it and read config info.
    I am able to acheive this if I write the following piece of code and it gives me the complete path.
    String configPath = getServletContext().getRealPath("config.txt");
    My problem is that this code works only if the class extends from HttpServlet. I want to get the complete path to this file from a normal java bean, where I don't have the servlet context.
    If there is any alternative way to achieve this or if somehow I can get the servlet context in the java bean then please let me know. We use iPlanet 6.0 server.
    Thanks for your help.
    RM

    Thanks for your reply. Do you mean, I should use
    getResourceasStream() method which return inputstream.
    But even that would require servletcontext object ?No it doesn't require the servlet context; if it did, you'd still be able to get the servlet context from the servlet itself.
    Maybe I have not understood, your approach. Can you
    please give me some example.
    class SomeServlet extends HttpServlet {
        // servlet stuff
        private void handleConfiguration() {
            InputStream configStream = getClass().getResourceAsStream("config.txt"); // may return null
            YourBean bean = getYourBeanInstance();
            bean.someMethod(configStream);
            // close configStream
    public class YourBean {
        public void someMethod(InputStream configStream) {
            // handle configStream
    }

Maybe you are looking for

  • Dispatcher gets stopped

    Dear All, I am facing a problem with IDES system. When I start the SAP from MMC console in windows 2003 with oracle database (ECC 5.0) the dispatcher gets stopped immediately after it tries to start the work process. All the work process ends up and

  • How to find out the selected line in the table control

    Hi Guys, i have a requirement like this. i have table control and the internal table for that table control as IT_CASE. this internal table i declared as CHECKBX, MATNR, QUANTITY. but when i am enter the values in the table control i am getting the v

  • ATI Radeon 9800 Pro Wierd Lines    Bad Card     --   The solution

    After updating my Computer to 10.4.8, I frequently had odd lines and Weird Colored Shapes dancing across my screen. Restarting was the only thing that solved the problem but It started becoming more frequent as time went on, Every 30 minutes having t

  • IPhoto 08

    Whilst using iPhoto 08 the screen reverted to thumbnails with no photos - just a dashed rectangular grey shape with the photo ref. number beneath. When re-entering iPhoto message comes up: "Rebuilding thumbnail cache" but then nothing happens. I've l

  • Validation: more than one Other Source Dimension Member

    Hi BPC Experts, Is it possible to identify more than one Other Source Dimension Member in Validation Business Rules settings? For example, we need to use all DataSources that belong to IFRS roll up. If yes, what is the format? Thanks. Mila