Eclipse web directory confusion / naming problems

In my Eclipse project called DicDist in a workspace called C:\_eclipse\ , I have a web directory that when I call :
getServlet().getServletContext().getRealPath("/pictures/") ,
it resolves to :
C:\_eclipseworkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\webapps\DocDist\pictures\
but when I created the "/pictures/" directory I created the directory in the eclipse project, I created it as c:\_eclipseworkspace\DocDist\pictures
The result is when I save files uploaded by my application,it saves saves them in this obscure eclipse only directory
rather than where logically it should be saved .
In other pages of the application, when I go to retrieve the files via a reference to "/pictures/myfile.jpg' etc.., it can't find them because Eclipse has dumped them into it's own internal directory under c:\_eclipseworkspace\DocDist\.metadata.\.plugins\...etc
For me ,it seems the servlet context should be
c:\_eclipseworkspace\DocDist
not
c:\_eclipseworkspace\DocDist\.metadat.plugins\etc....
Can anyone tell me what gives or give me advice on how to keep my directory names straight?
Bascially, all I am trying to do is upload files to the webserver via my app and then let user download them later via the same app.
If property files are the best way to go ,I'm not sure how to use property files in my app to do this.
Thanks

Eclipse doesn't deploy your webapp into your workspace.
It copies all the files that it needs elsewhere on the disk, and runs the webapp from there.
That is why the servletContext realPath is pointing elsewhere on your computer.
That is not necessarily a problem once you have deployed the web application out into a proper server, because it won't necessarily copy things around like that so much.
I would still probably put the pictures directory outside of the webapp, because the web application files can sometimes be deleted (particularly if you deploy it as a WAR)
There are various ways to provide the value
- as a context parameter in web.xml
In your web.xml
<context-param>
  <param-name>pictureDirectory</param-name>
  <param-value>c:\pictures</param-value>
</context-param>You can then get this value with servlletContext.getInitParameter("pictureDirectory");

Similar Messages

  • Save to web directory name is not valid error

    Hi, I typed my question a second ago and it took me to another screen.  I apologize if there is a duplicate somewhere else.
    I was trying to spare some room on my C: drive so when I went to save for web last time, I decided to save the images and html on D: drive instead of C:.    Ever since then, when I go to save for web I get this error message: "Could not complete this operation.  The directory name is not valid".   I even uninstalled PS and reinstalled it to see if the factory default settings might override whatever I screwed up!  Didn't help.  
    I really appreciate your help, I'm on a deadline working on my website and need this fixed so quickly!!!!!
    Thank you!
    Stacy

    Redncuda2 wrote:
    I hate to be a pest and a dummy but.... I can't seem to find a file "AppData" anywhere…
    That wouldn't be a "file" but a directory, also called a folder.
    So you would first look for a directory/folder named "Users", inside which you should find a directory/folder labeled with your own name (as a user).  Inside said directory/folder named after you there should be the directory/folder labeled "AppData".  If you cannot find the latter, then STOP immediately .  It would mean that we are not communicating at all and you're in danger of causing great harm to your machine! 
    Redncuda2 wrote:
    While I'm at it, one quick question.... Do I have to keep both sets of Photoshop files one set under "Program Files" and one set under Program Files (x86)? Or can I choose which set to keep?
    STOP AT ONCE !   I don't remotely understand what you're trying to say there, and that means that there's definitely a serious miscommunication here.  I said nothing about "sets of Photoshop files", nor do I understand what you mean by that. 
    Hopefully a Windows user will chime in to undo whatever confusion I caused and maybe even post a screenshot or two to show you what to do.
    Sorry about all of this.    I should have shut up right after post #5.  My bad! 

  • Apache web directory password protection

    Hello all,
    I seem to be having a problem password protecting a web directory. I have my .htpasswd file and all of my directory info set up in my httpd.conf file but when I go to this directory via the web, I get prompted for a username and password but when I enter my username and the password that is in my .htpasswd file, it simply keeps prompting me for my password as if the user or the password is incorrect. Can anyone give me any hints as to how I can fix this?

    lovell,
    hi. glad you got it working. as for setting the permissions...
    for our server, which is FreeBSD but essentially no different, i setup basic auth directories as follows:
    username = My Admin User in all cases. I am assuming that www is the owner:group of the server process.
    I chown -R the directory to username:www. I then set the permissions on the directory to 0750 which allows rwx for the user and r-x for the group. the execute bit should be set on the directory to allow traversal by the webserver.
    as for the files in the directory, the chown -R of the directory should set all content ownership to username:www. Then I chmod all contents to 0640. this allows the owner to read and write and the webserver to read only. this does not allow any permission for folks outside of the owner or members of the www group (e.g. via terminal or ssh).
    now, the auth method of the webserver should be able to determine who has read access to the files. in your case, this is for the user 'lmcilwain'. e.g. only the user entering the proper credentials into the authorization box should be able to view the files (at least through their browser).
    remember, too, that basic auth passes passwords in plain-text, so if bad people want to intercept your password and username, they can do this if they really want to.
    that being said, basic auth is ok for things like pdf documents and whatnot. i wouldn't put anything terribly important in a directory 'protected' by basic auth, however.
    cheers,
    b
    some macs, some bsds, some tuxs   Mac OS X (10.4.4)  

  • Per-user web directory on nss volume

    Is possible to use directories in nss volume as per-user web directory for apache virtual hosts ?
    How I set permission for it ?
    Vogl Lubomir

    vogl,
    It appears that in the past few days you have not received a response to your
    posting. That concerns us, and has triggered this automated reply.
    Has your problem been resolved? If not, you might try one of the following options:
    - Visit http://support.novell.com and search the knowledgebase and/or check all
    the other self support options and support programs available.
    - You could also try posting your message again. Make sure it is posted in the
    correct newsgroup. (http://forums.novell.com)
    Be sure to read the forum FAQ about what to expect in the way of responses:
    http://forums.novell.com/faq.php
    If this is a reply to a duplicate posting, please ignore and accept our apologies
    and rest assured we will issue a stern reprimand to our posting bot.
    Good luck!
    Your Novell Product Support Forums Team
    http://support.novell.com/forums/

  • Error instantiating web-application:Application named 'javasso' is in stopp

    Hi,
    I am getting the following error while logging to Oracle Application Console.
    "Error instantiating web-application:Application named 'javasso' is in stopped"
    Environment details are as under:
    SOA suite: 10.1.3.1
    Oracle Database: 11.1.0
    I started getting this error after doing the following steps. Earlier everything was working fine.
    1. Created a connection pool and Datasource in JDBC resources under administration on 10g DB which worked fine.
    2. Attempted creating a connection pool on 11g DB which said connectiion successful when testing connetion. But once finalised and then again tried testing it gave an error saying " Invalid user name/password ".
    3. Since I know the username and password were correct, I tried changing 'ORCL' in the URL with the tns alias ORCL_421.
    4. Since I changed the URL, i was prompted to restart the defaults.
    5. Once I clicked on restart, after long time the browser still showed the timer rotating. So I refreshed the browser and it showed the application server was up.
    6. I went to check the JDBC resources and all the CONNECTION POOLs and DataSources are vanished.
    7. I logged out and then when i am trying to login again, I am getting the above error.
    8. I tried launching ESB and got the similar error but this time for esb "Application named 'esb-dt' is in stopped state."
    I am not sure why this is happening. AScontrol.log has the following error stack:
    [EMUI_14_42_51_/console/logoff] ERROR em.console doGet.303 - java.lang.IllegalStateException: Response has already been committed
    java.lang.IllegalStateException: Response has already been committed
         at com.evermind.server.http.EvermindHttpServletResponse.resetBuffer(EvermindHttpServletResponse.java:1854)
         at com.evermind.server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:249)
         at com.evermind.server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:50)
         at com.evermind.server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:193)
         at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:283)
         at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:198)
         at oracle.sysman.emSDK.svlt.PageHandler.render(PageHandler.java:796)
         at oracle.sysman.emSDK.svlt.PageHandler.handleRequest(PageHandler.java:398)
         at oracle.sysman.emSDK.svlt.EMServlet.myDoGet(EMServlet.java:765)
         at oracle.sysman.emSDK.svlt.EMServlet.doGet(EMServlet.java:283)
         at oracle.sysman.ias.studio.app.StudioConsole.doGet(StudioConsole.java:297)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
         at oracle.sysman.ias.studio.app.BrowserVersionFilter.doFilter(BrowserVersionFilter.java:75)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
         at oracle.sysman.ias.studio.app.MultipleJVMFilter.doFilter(MultipleJVMFilter.java:85)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17)
         at oracle.sysman.ias.studio.app.PostLogonFilter.doFilter(PostLogonFilter.java:80)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17)
         at oracle.sysman.ias.studio.app.ShortHostnameRedirectFilter.doFilter(ShortHostnameRedirectFilter.java:68)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:436)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:619)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448)
         at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:117)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:110)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
         at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
         at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    Appreciate if anyone can help resolve this issue.
    Thanks and Regards
    AT

    Check your server.xml. You need a line like:<application auto-start="false" name="staging-load" path="c:\staging-load.ear"/>

  • Get file list from URL/web directory

    Hey guys,
    I have created a script for After Effects that can download multiple images from URLs that are given in an array. Now ideally what I want, is to get all the filenames of the files in a certain browsable web directory to be put in an array.
    Unfortunately, I can't seem to figure out how to do this. Does someone have the knowledge here to help me out?
    Thanks in advance,
    Jorge

    This is more difficult to do than it seems. Since the files are on a remote web server, you need to find some way to get the server to divulge its local file structure, which is not something most servers will do. The absolute best way is to have control over the web server and run some server-side code (PHP, node.js, whatever) to generate the file list on the server side and then fetch it with your client/extension/script. Other than that it's almost impossible to get a 3rd party server to divulge its file structure as far as I know, mainly for security reasons. So the #1 question is: do you have control over the server/website that you're trying to fetch from or not?

  • Web service empty relationship problem

    hi all,
    I have a pretty simple web service. Two entities, a citizen and a business. A citizen is able to register 0..n businesses. There is a WS which reads the citizen. When the business key list in citizen is empty the web service wont return the citizen (portal request failed could not execute web service operation). When at least one relation is defined all works fine.
    I've tested the web service. The problem occurs only with VC.
    thanks for your help,
    regards, felix

    Hi Ankur,
    no, not exactly...
    The webservice is tested with an id as input and returns some string values (name, firstname...) and a list of references to other objects. When this list is empty...(depending on the back end system)
    part of the SOAP message:
    <ns1:businessRef xmlns:ns1='urn:com.sap.bureg001.core.besrv.citizen' xmlns:pns='urn:java/lang'></ns1:businessRef>
    ... visual composer returns an error.
    when this list is not empty (again depending on database entries in the back end)
    part of the SOAP message:
    <ns1:businessRef xmlns:ns1='urn:com.sap.bureg001.core.besrv.citizen' xmlns:pns='urn:java/lang'><pns:String>c22bc900-dec3-11db-cdce-00505625e523</pns:String>
    </ns1:businessRef>
    ... visual composer does not return an error but returns the values like the service is supposed to do.
    Testing the web service with Web Services Navigator both scenarios are working without problems.
    thanks for your fast response,
    felix

  • Authentication on web directory

    Good day.
    I must to write a file in a web directory from servlet.
    I should want to restrict to a specific user the read/write/execute permission.
    In this mode my servlet not write a file from a servlet (permission denied).
    FileOutputStream fos = new FileOutputStream(getServletContext().getRealPath("/mcfoto/foto1.png"));
    How can I set the username (and the password) qualified to create a file in it?
    Best regards.
    Stefano Errani

    Good day.
    I've tried to set the permission directory at read only and then I've tried to write a file in it.
    The result is an error for permission denied.
    I believe not to have understood the answer.
    Best regards.
    Stefano Errani

  • Un-Named Problem

    This is my Server Program
    import javax.swing.*;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    class Validation
         Object object;
         public static Vector v1=new Vector(1,1);
         Vector vctUsername = new Vector(1,1);
         public Validation(String ipAddress1, String message1)
              message1.trim();
              if(checkIP(ipAddress1))
              else
                   v1.add(ipAddress1);
                   System.out.println("IP Added");
              String check = new String(String.valueOf(message1.charAt(0)));
              if(message1.length()==0)
              else if(message1.equals("A"))
                   System.out.println("Join in Message .. not to be sent");
              else if(check.equals("�"))
                   StringTokenizer str = new StringTokenizer(message1,"�");
                   String username13 = (str.nextToken());
                   String dust13 = (str.nextToken());
                   System.out.println(dust13);
                   if(dust13.equals(new String(" has joined the conversation")));
                   System.out.println(username13);
                   vctUsername.add(username13);
                   NewServer.listNames.setListData(vctUsername);
              else
                   for(int i=0; i<v1.size(); i++)
                        try
                             object = v1.elementAt(i);
                             Socket socket = new Socket(object.toString(),4001);
                             System.out.println("Connection formed with Client "+object.toString());
                             ObjectOutputStream toClient = null;
                             toClient = new ObjectOutputStream(socket.getOutputStream());
                             toClient.writeObject(message1);
                             toClient.flush();
                             System.out.println("Message "+message1+"to IP -- "+object.toString());
                             toClient.close();
                             socket.close();
                        catch(ConnectException e1)
                             for(int ii=0; ii<v1.size(); ii++)
                                  Object object1 = v1.elementAt(ii);
                                  if(object1.toString().equals(object.toString()))
                                       v1.removeElementAt(ii);
                                       vctUsername.removeElementAt(ii);
                                       NewServer.listNames.setListData(vctUsername);
                                  else
                        catch(Exception e)
                             System.out.println("Error : "+e);
         public boolean checkIP(String ipAddress2)
              for(int i=0; i < v1.size(); i++)
                   Object object = v1.elementAt(i);
                   if(object.toString().equals(ipAddress2))
                        return true;
              return false;
    public class NewServer
         public static JList listNames;
         private     ServerSocket chatSocket;
         public NewServer()
              Object object;
              JFrame frameMain = new JFrame("Server");
              JPanel panelMain = new JPanel();
              JTextArea textAreaDisplay = new JTextArea(25,50);
              JScrollPane scrollPaneBoard = new JScrollPane(textAreaDisplay);
              listNames = new JList();
              frameMain.getContentPane().add(panelMain);
              frameMain.setVisible(true);
              frameMain.setSize(200,200);
              panelMain.add(scrollPaneBoard);
              panelMain.add(listNames);
              textAreaDisplay.setLineWrap(true);
              try
                   chatSocket = new ServerSocket(4000);
              catch(BindException e)
                   JOptionPane.showMessageDialog(frameMain, new String("Port Address in use"));
                   System.exit(0);
              catch(Exception e)
                   System.out.println("Error 1 "+e);
              while(true)
                   try
                        System.out.println("Waiting for connections .. ");
                        Socket client = chatSocket.accept();
                        String inetAddress = String.valueOf(client.getInetAddress());
                        StringTokenizer str = new StringTokenizer(inetAddress,"/");
                        String hostName = (str.nextToken());
                        String ipAddress = (str.nextToken());
                        System.out.println("Accepted connection from : "+hostName+" : "+ipAddress);
                        new Validation(ipAddress, "A");
                        try
                             ObjectInputStream fromClient = null;
                             client.setSoTimeout(1000);
                             fromClient = new ObjectInputStream(client.getInputStream());
                             String x;
                             x = (String) fromClient.readObject();
                             textAreaDisplay.append(x);
                             textAreaDisplay.append("\n");
                             new Validation(ipAddress, x);
                        catch(Exception e)
                             System.out.println("Error 3 "+e);
                   catch(NullPointerException e)
                        JOptionPane.showMessageDialog(frameMain, new String("An unexpected error occured while starting the Server -- Error - "+e));
                        System.exit(0);
                   catch(Exception e)
                        System.out.println("Error 2 "+e);
         public static void main(String args[])
              new NewServer();
    this is my Client Program
    import java.io.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.net.*;
    import javax.swing.*;
    public class NewClient
         JFrame frameMain1;
         JPanel panelMain1;
         JTextArea textAreaDisplay;
         JScrollPane scrollPaneDisplay;
         JTextField textFieldMessage;
         Socket socket;     
         ObjectInputStream fromServer;
         ServerSocket inputServerSocket;
         String username123;
         public NewClient(String username12)
              frameMain1 = new JFrame("Client");
              panelMain1 = new JPanel();
              textAreaDisplay = new JTextArea(25,50);
              scrollPaneDisplay = new JScrollPane(textAreaDisplay);
              textAreaDisplay.setLineWrap(true);
              panelMain1.add(scrollPaneDisplay);
              System.out.println("coming 1");
              textFieldMessage = new JTextField(50);
              panelMain1.add(textFieldMessage);
              textFieldMessage.addKeyListener(new listener());
              frameMain1.getContentPane().add(panelMain1);
              frameMain1.setSize(200,200);
              frameMain1.setVisible(true);
              System.out.println("coming 3");
              try
                   socket = new Socket("192.168.16.1",4000);
                   inputServerSocket = new ServerSocket(4001);
                   ObjectOutputStream toServer = new ObjectOutputStream(socket.getOutputStream());
                   toServer.writeObject("� "+username12+" � has joined the conversation");
                   toServer.flush();
                   toServer.close();
              catch(UnknownHostException e)
                   JOptionPane.showMessageDialog(frameMain1, new String("Host Not Found "+e));
                   System.exit(0);
              catch(ConnectException e)
                   JOptionPane.showMessageDialog(frameMain1, new String("Connection Failed Because "+e));
                   System.exit(0);
              catch(BindException e)
                   JOptionPane.showMessageDialog(frameMain1, new String("Client Application already running or Port in use"));
                   System.exit(0);
              catch(Exception e)
                   JOptionPane.showMessageDialog(frameMain1, new String("An unexpected Error occured "+e));
                   System.exit(0);
              try
                   while(true)
                        Socket listener = inputServerSocket.accept();
                        ObjectInputStream fromClient = null;
                        listener.setSoTimeout(1000);
                        fromServer = new ObjectInputStream(listener.getInputStream());
                        String input = (String) fromServer.readObject();
                        textAreaDisplay.append("\n");
                        textAreaDisplay.append(input);
                        fromServer.close();
                        listener.close();
              catch(Exception e)
                   JOptionPane.showMessageDialog(frameMain1, new String("An unexpected Error occured "+e));
         class listener implements KeyListener
              public void keyTyped(KeyEvent e)
              public void keyReleased(KeyEvent e)
              public void keyPressed(KeyEvent e)
                   int code = e.getKeyCode();
                   if(code == KeyEvent.VK_ENTER)
                        String message12 = textFieldMessage.getText();
                        message12.trim();
                        if(message12.length()==0)
                        else
                             try
                                  Socket socket1;
                                  socket1 = new Socket("192.168.16.1",4000);
                                  ObjectOutputStream toServer = new ObjectOutputStream(socket1.getOutputStream());
                                  String messageTyped;
                                  messageTyped = (username123+" says::"+message12);
                                  toServer.writeObject(messageTyped);
                                  toServer.flush();
                                  textFieldMessage.setText("");
                                  toServer.close();
                                  socket1.close();
                             catch(ConnectException e1)
                                  JOptionPane.showMessageDialog(frameMain1, new String("Server Down"));
                                  System.exit(0);
                             catch(Exception e2)
                                  JOptionPane.showMessageDialog(frameMain1, new String("Error : "+e2));
                                  System.exit(0);
         public static void main(String args[])
              new NewClient("Guest_Null");
    and this is the program ...thru which i am calling ... Newclient
    import java.awt.event.*;
    import javax.swing.*;
    import java.awt.*;
    import java.sql.*;
    public class Prashant extends JFrame
         //----frameMain objects
         JFrame frameMain = new JFrame("");     
         //----panelMain objects
         JPanel panelMain = new JPanel();
         CardLayout c1 = new CardLayout();
         //----panelAdministrator
         JPanel panelAdministrator = new JPanel();
         JTable table = new JTable();
         //----panelWelcome objects
         JPanel panelWelcome = new JPanel();
         String stringFirstName2 = new String("User");
         JLabel labelFirstName1=new JLabel("");
         //----panelLogin objects
         JPanel panelLogin = new JPanel();
         JLabel labelUsername2 = new JLabel("Username");
         JTextField textFieldUsername2 = new JTextField(10);
         JLabel labelPassword1 = new JLabel("Password");
         JPasswordField passwordFieldPassword1 = new JPasswordField(10);
         JButton buttonLogin = new JButton("Login");
         JButton buttonNewUser = new JButton("New User, Sign Up");
         //----panelInsertData objects
         JPanel panelInsertData = new JPanel();
         JLabel labelUsername1 = new JLabel("Username");
         JTextField textFieldUsername1 = new JTextField(10);
         JLabel labelPassword = new JLabel("Password");
         JPasswordField passwordFieldPassword = new JPasswordField(10);
         JLabel labelReTypePassword = new JLabel("Re-Type Password");
         JPasswordField passwordFieldReTypePassword = new JPasswordField(10);
         JLabel labelFirstName = new JLabel("First Name");
         JTextField textFieldFirstName = new JTextField(10);
         JLabel labelLastName = new JLabel("Last Name");
         JTextField textFieldLastName = new JTextField(10);
         JLabel labelPhoneNumber = new JLabel("Phone Number");
         JTextField textFieldPhoneNumber = new JTextField(10);
         JLabel labelAddress = new JLabel("Address");
         JTextArea textAreaAddress = new JTextArea("",10,10);
         JScrollPane scrollPaneAddress = new JScrollPane(textAreaAddress);
         ClickListen ClickListener = new ClickListen();
         JButton buttonSubmit = new JButton("Submit");
         //----panelRetieveData objects
         JPanel panelRetieveData = new JPanel();
         JButton testButton = new JButton("Retieve Data");
         //----panelUsernameSearch
         JPanel panelUsernameSearch = new JPanel();
         JLabel labelUsername = new JLabel("Username");
         JTextField textFieldUsername = new JTextField(10);
         JButton buttonCheckForAvailability = new JButton("Check");
         public void frameMain()
              frameMain.setResizable(true);
         public void panelMainClass()
              frameMain.getContentPane().add(panelMain);
              panelMain.setLayout(c1);
         public void panelWelcome()
              panelMain.add(panelWelcome, "panelWelcome");
              panelWelcome.setLayout(null);
              panelWelcome.add(labelFirstName1);
              labelFirstName1.setBounds(10,10,200,25);
         public void panelAdministrator()
              panelMain.add(panelAdministrator,"panelAdministrator");
              panelAdministrator.add(table);
         public void panelLogin()
              frameMain.setSize(195,160);
              frameMain.setVisible(true);
              panelLogin.setLayout(null);
              panelMain.add(panelLogin, "panelLogin");
              c1.show(panelMain, "panelLogin");
              panelLogin.add(labelUsername2);
              labelUsername2.setBounds(10,10,100,25);
              panelLogin.add(textFieldUsername2);
              textFieldUsername2.setBounds(75,10,100,25);
              panelLogin.add(labelPassword1);
              labelPassword1.setBounds(10,40,100,25);
              panelLogin.add(passwordFieldPassword1);
              passwordFieldPassword1.setBounds(75,40,100,25);
              panelLogin.add(buttonLogin);
              buttonLogin.setBounds(10,70,165,25);
              buttonLogin.addActionListener(ClickListener);
              panelLogin.add(buttonNewUser);
              buttonNewUser.setBounds(10,100,165,25);
              buttonNewUser.addActionListener(ClickListener);
         public void panelUsernameSearch()
              panelMain.add(panelUsernameSearch,"panelUsernameSearch");
              panelUsernameSearch.setLayout(null);
              panelUsernameSearch.add(labelUsername);
              labelUsername.setBounds(10,10,60,25);
              panelUsernameSearch.add(textFieldUsername);
              textFieldUsername.setBounds(75,10,100,25);
              panelUsernameSearch.add(buttonCheckForAvailability);
              buttonCheckForAvailability.setBounds(10,40,165,25);
              buttonCheckForAvailability.addActionListener(ClickListener);
         public void panelInsertDataClass()
              panelInsertData.setLayout(null);
              panelMain.add(panelInsertData, "panelInsertData");
              labelUsername1.setBounds(10,10,100,25);
              panelInsertData.add(labelUsername1);
              textFieldUsername1.setBounds(115,10,100,25);
              textFieldUsername1.setEnabled(false);
              textFieldUsername1.setText("Prashant");
              panelInsertData.add(textFieldUsername1);
              labelPassword.setBounds(10,40,100,25);
              panelInsertData.add(labelPassword);
              passwordFieldPassword.setBounds(115,40,100,25);
              panelInsertData.add(passwordFieldPassword);
              labelReTypePassword.setBounds(10,70,100,25);
              panelInsertData.add(labelReTypePassword);
              passwordFieldReTypePassword.setBounds(115,70,100,25);
              panelInsertData.add(passwordFieldReTypePassword);
              labelFirstName.setBounds(10,100,100,25);
              panelInsertData.add(labelFirstName);
              textFieldFirstName.setBounds(115,100,100,25);
              panelInsertData.add(textFieldFirstName);
              labelLastName.setBounds(10,130,100,25);     
              panelInsertData.add(labelLastName);
              textFieldLastName.setBounds(115,130,100,25);
              panelInsertData.add(textFieldLastName);
              labelPhoneNumber.setBounds(10,160,100,25);
              panelInsertData.add(labelPhoneNumber);
              textFieldPhoneNumber.setBounds(115,160,100,25);
              panelInsertData.add(textFieldPhoneNumber);
              labelAddress.setBounds(10,190,100,25);
              panelInsertData.add(labelAddress);
              textAreaAddress.setLineWrap(true);
              scrollPaneAddress.setBounds(115,190,100,75);
              panelInsertData.add(scrollPaneAddress);
              panelInsertData.add(buttonSubmit);          
              buttonSubmit.addActionListener(ClickListener);
              buttonSubmit.setBounds(10,270,205,25);
         public void panelRetieveDataClass()
              panelMain.add(panelRetieveData, "panelRetieveData");               
              panelRetieveData.add(testButton);
         class ClickListen implements ActionListener
              public void actionPerformed(ActionEvent evt)
                   Object obj = evt.getSource();
                   if(obj==buttonLogin)
                        String stringUsername2 = new String(textFieldUsername2.getText());
                        if(stringUsername2.length()==0)
                             JOptionPane.showMessageDialog(frameMain, new String("Username field cannot be left empty"));
                        else
                             String stringPassword1 = new String(passwordFieldPassword1.getPassword());
                             if(stringPassword1.length()==0)
                                  JOptionPane.showMessageDialog(frameMain,new String("Password field cannot be left empty"));
                             else
                                  if(stringUsername2.equals("Administrator"))
                                       if(stringPassword1.equals("Prashant"))
                                            JOptionPane.showMessageDialog(frameMain,new String("Welcome Mr.Prashant"));
                                            c1.show(panelMain, "panelAdministrator");
                                       else
                                            JOptionPane.showMessageDialog(frameMain,new String("Invalid Password"));
                                  else
                                       try
                                            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                                            Connection con2;
                                            con2 = DriverManager.getConnection("jdbc:odbc:prashant","user1","");
                                            PreparedStatement stat2 = con2.prepareStatement("select * from prashant_registration where username = ? AND cpassword = ?");
                                            stat2.setString(1, stringUsername2);
                                            stat2.setString(2, stringPassword1);
                                            ResultSet result;
                                            result = stat2.executeQuery();
                                            if(result.next())
                                                 JOptionPane.showMessageDialog(frameMain,new String("Login successful"));
                                                 stringFirstName2 = result.getString(3);
                                                 labelFirstName1.setText("Welcome "+stringFirstName2);
                                                 new NewClient(stringUsername2);
                                                 c1.show(panelMain, "panelWelcome");
                                            else
                                                 JOptionPane.showMessageDialog(frameMain,new String("Login Failed"));
                                                 textFieldUsername2.setText("");
                                                 passwordFieldPassword1.setText("");
                                       catch(Exception e)
                                            System.out.println("error" +e);
                   if(obj==buttonNewUser)
                        c1.show(panelMain, "panelUsernameSearch");
                        frameMain.setSize(190,100);
                        frameMain.setVisible(true);
                   if(obj==buttonCheckForAvailability)
                        String stringUsername = textFieldUsername.getText();
                        if(stringUsername.length()==0)
                             JOptionPane.showMessageDialog(frameMain,new String("Username cannot be left blank"));
                        else
                             try
                                  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                                  Connection con1;
                                  con1 = DriverManager.getConnection("jdbc:odbc:prashant","user1","");
                                  PreparedStatement stat1 = con1.prepareStatement("select * from prashant_registration where username = ?");
                                  stat1.setString(1, textFieldUsername.getText());
                                  ResultSet result;
                                  result = stat1.executeQuery();
                                  if(result.next())
                                       JOptionPane.showMessageDialog(frameMain,new String("Username is not Avaiable, Click Ok, to choose someother username"));
                                       textFieldUsername.setText("");
                                  else
                                       JOptionPane.showMessageDialog(frameMain, new String("Username is available, Click Ok, to move to the next step"));
                                       textFieldUsername1.setText(textFieldUsername.getText());
                                       frameMain.setSize(230,330);
                                       frameMain.setVisible(true);
                                       c1.show(panelMain, "panelInsertData");
                             catch(SQLException sqlex)
                                  System.out.println ("SQLState: " + sqlex.getSQLState () + "");
                                  System.out.println ("Message: " + sqlex.getMessage() + "");
                                  System.out.println ("Vendor ErrorCode: " + sqlex.getErrorCode() + "");
                             catch(Exception ex1)
                                  System.out.println("Error ex1" +ex1);
                   if(obj==buttonSubmit)
                        String stringPassword = new String(passwordFieldPassword.getPassword());
                        if(stringPassword.length()==0)
                             JOptionPane.showMessageDialog(frameMain, new String("Password field cannot be left empty"));
                        else
                             String stringReTypePassword = new String(passwordFieldReTypePassword.getPassword());
                             if(stringReTypePassword.length()==0)
                                  JOptionPane.showMessageDialog(frameMain, new String("Please ReType the password"));
                             else
                                  if(stringPassword.equals(stringReTypePassword))
                                       if((new String(textFieldFirstName.getText())).length()==0)
                                            JOptionPane.showMessageDialog(frameMain,new String("FirstName cannot be left blank"));
                                       else
                                            if((new String(textFieldLastName.getText())).length()==0)
                                                 JOptionPane.showMessageDialog(frameMain,new String("LastName cannot be left blank"));
                                            else
                                                 if((new String(textFieldPhoneNumber.getText())).length()==0)
                                                      JOptionPane.showMessageDialog(frameMain,new String("Phone Number cannot be left blank"));
                                                 else
                                                      if((new String(textAreaAddress.getText())).length()==0)
                                                           JOptionPane.showMessageDialog(frameMain,new String("Address Cannot Be Left Blank"));
                                                      else
                                                           try
                                                                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                                                                Connection con;
                                                                con = DriverManager.getConnection("jdbc:odbc:prashant","user1","");
                                                                PreparedStatement stat2 = con.prepareStatement("insert prashant_registration values(?,?,?,?,?,?, getDate(), getDate())");
                                                                stat2.setString(1,textFieldUsername1.getText());
                                                                stat2.setString(2,stringPassword);
                                                                stat2.setString(3,textFieldFirstName.getText());
                                                                stat2.setString(4,textFieldLastName.getText());
                                                                stat2.setString(5,textFieldPhoneNumber.getText());
                                                                stat2.setString(6,textAreaAddress.getText());
                                                                stat2.executeUpdate();
                                                                JOptionPane.showMessageDialog(frameMain,new String("Your Details have been registered"));
                                                                c1.show(panelMain, "panelRetieveData");
                                                           catch(SQLException ex)
                                                                System.out.println ("SQLState: " + ex.getSQLState () + "");
                                                                System.out.println ("Message: " + ex.getMessage() + "");
                                                                System.out.println ("Vendor ErrorCode: " + ex.getErrorCode() + "");
                                                           catch(Exception e)
                                                                JOptionPane.showMessageDialog(frameMain,new String("Error encountered while entering data in the database: "+e));
                                  else
                                       JOptionPane.showMessageDialog(frameMain,new String("Passwords doesnt match"));
         public static void main(String args[])
              Prashant prashant = new Prashant();
              prashant.frameMain();
              prashant.panelMainClass();
              prashant.panelLogin();
              prashant.panelWelcome();
              prashant.panelAdministrator();
              prashant.panelUsernameSearch();
              prashant.panelInsertDataClass();
              prashant.panelRetieveDataClass();
    I dont know what the problem is .... the Client program's frame is EMPTY
    my faculty and my fellow programmers said ...the program is getting hanged or something is getting overlapped
    please try and let me know what could be the possible problem could be .... people in here and myself ..couldnt solve it ... because i am not getting any error message or exception ... so it is a
    **Un-Named Problem**
    I will be really thankful to you ...if u could help me out

    When you post code, please use [code] and [/code] tags as described in Formatting Help on the message entry page. It makes it much easier to read.

  • Networking techniques to explore the web directory.

    Hi all,
    I want to list all the file names present in a Web directory using URL methods. Can anybody suggest me how could i do this using Core Java APIs?
    Thanks in advance!

    Some web servers can be configured to list the files in a given directory if the URL points to that directory and there isn't any kind of default content. But that trick is being used less and less these days, it seems.
    If the server doesn't want to provide a list of files (either automatically generated or written by a web designer) then a client can't force the server to do so.
    If there are a bunch of example files on a site, you can try to see if the server will auto-list them. If not, you can use Google perhaps to get a list of the URLs.

  • Listing files on a web directory

    Hi,
    I would like to write an application that looks at a certain web directory and reports when a new file is uploaded onto that directory, and returns the URL of the file. I am looking for something like the 'File' class' listFiles() method, to determine if a new file has been uploaded, but I can't find an analogous funtion for directories on the web. Can someone point me in the right direction here?
    Thanks,
    Chester

    Sorry, I should have searched the forum first.....I found an answer.
    -chester (new to these forums)

  • Does Apache in 10.6 support Web directory protection using .htpasswd?

    I am trying to protect a directory on my mac os 10.6 Web Sharing server using .htpasswd to no avail. I am creating an .htaccess and an .htpasswd file in the directory with what I think are proper configurations. Has anyone done this successfully? Am I missing something? Does the default setup in Snow Leopard allow for this? Is there a better way? Are these too many questions in a row?

    It was my understanding that one creates the .htpasswd file inside the directory that one is protecting, no?
    You can do that, but it's hardly recommended. Ideally the password file should be completely outside of the web directory since that makes it harder for someone to get access to it. If it's anywhere in the web directory tree then there's a chance that a remote user could get access to it (via some as-yet-unknown web server compromise) and there go all your passwords.
    .htaccess has to be in the directory it relates to, but .htpasswd can (and should) be elsewhere.
    and then created an .htaccess file alongside it with the entry shown in my original post.
    Sure, but that .htaccess file includes the path to the .htpasswd file to use for authentication.
    Just edit that line to the full path to your .htpasswd file.
    I'm not sure but I don't even see sever logs where I expected at:
    /private/var/log/httpd/access_log
    Under Apache 2 the logs are in /var/log/apache2/
    Also it appears that there are two apache2 folders:
    /etc/apache2/
    /private/etc/apache2/
    It doesn't matter. /etc is really a symlink to /private/etc. It's there mostly for compatiblity with unix apps that expect /etc.

  • Quicktime pro -I have exported two mp4 to web formats with no problems.  all of a sudden it is now stopping and shutting down.  I am on a pc with windows 7  Help!

    Quicktime pro -I have exported two mp4 to web formats with no problems.  all of a sudden it is now stopping and shutting down.  I am on a pc with windows 7  Help!

    Is the problem limited to a specific file that you're exporting?

  • TestStand sub-sequence naming problem: "Step" column doesn't match "View" menu

    Refer to the attached screenshoot; when I rename the sub-sequences in the "Step" column to the left, these names don't show up in the "View" menu pull-down list shown on the right. What's going on here?
    All my sequences are in one .seq file.
    Attachments:
    Sequence Naming Problem.gif ‏31 KB

    They're not supposed to. When you rename a step, that's not the same thing as renaming a sub-sequence. Say you have a sub-sequence called x, you could have steps called "call sequence x_1", "call sequence x_2", "call sequence x_3", etc., all calling the same sub-sequence. It's no different than the different labels you might have every time you call a pass/fail step.

  • Web directory permissions

    would it be bad to give the user _www (uid 70) read permission to the entire web directory via ACL and also give "others" no access? i'm wondering about how to best secure the web server data.
    the default seems to be 775. if we have afp filesharing enabled on this volume, then people can poke around and view other directory contents if "others" is set to 'read'... but changing "others" to "none" restricts apache.
    thanks

    would it be bad to give the user _www (uid 70) read permission to the entire web directory via ACL and also give "others" no access?
    No. You should give at least one account full access to it so that the process of editing the pages is simpler.
    (36263)

Maybe you are looking for

  • Automated loading and executing array of presets sequentially

    Hi, I have built a system that allows a user to set certain parameters and send those parameters to another program using an event case.  In order to have my controls update in real time I had to use nested while loops.  The inner loop contains the c

  • I lost all my bookmarks when I updated to IOS 7.  How can I retrieve them?

    After upgrading to IOS7, where are my bookmarks?  They disappeared.

  • Problem with StructDescriptor

    Hello gurus I'm having a problem with StructDescriptor when I try to use it to get info form a DB using this syntax: StructDescriptor sd = StructDescriptor.createDescriptor("Structure Name",connection); It only happens when a DataSource is used, when

  • My iMovie isn't opening in Lion 10.7.1

    I upgraded to OS X Lion on my Mid 2010 27inch iMac when it first came out, iMovied opended and worked great. Recently it wont open at all, should I retaill iLife 11 or reinstall Lion?? If anyone has any answer please let me know. Thanks,

  • Premiere EL 11 - project initial settings question

    Hi, Properties of the recorded video (by a JVC handycam) are as follows: - AVC 720 x 576 pixel - 16:9 - 25 fps - PAL - 8 bit - Interlaced - Bit (poxel*frame) 0.558 Properties of pictures I wish to use are: - 1944 x 2592 or 2592 x 1944 - 300 dpi - 24