struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Laurent de Menditte" <ldeme...@webtiss.com>
Subject Problem while opening file in Action servlet
Date Wed, 19 Mar 2003 11:14:55 GMT
Hi,

I'm using Struts 1.1 rc1, Tomcat 4.1.18
I've written this Action class:
--------------------------------
import java.io.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import mypackage.API;

public class MyAction extends Action {

 public ActionForward execute(ActionMapping mapping,
   ActionForm form,
   HttpServletRequest request,
   HttpServletResponse response)
   throws IOException, ServletException {

    String cible = new String("success");
    try {
        String ConfigurationFile = "test.ini";
        FileInputStream Fin = new FileInputStream(ConfigurationFile);
        API api = new API();
    } catch (Exception e)
    {
        e.printStackTrace();
    }
    ... 
    return (mapping.findForward(cible));
    }
}
---------------------------------
and my problem is that I catch a FileNotFoundException because the test.ini file can't be
found.
I've got the same problem while creating the API object: a configuration file is also needed
during that creation and can't be found.
How can I solve this problem?
I just want to add that I can't modify the API class, so that I can't specify the full path
of the configuration file.

Thanks for your answers.
Laurent
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message