struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mohan Radhakrishnan <>
Subject RE: Problem while opening file in Action servlet
Date Wed, 19 Mar 2003 11:23:02 GMT

   If your problem is that you need to check if that file is there or not ,
then this might help

		if( getServlet().
resource ) == null ){
			logger_.debug("Not found" );
		} else {
			logger_.debug("Found" );


-----Original Message-----
From: Laurent de Menditte []
Sent: Wednesday, March 19, 2003 4:45 PM
Subject: Problem while opening file in Action servlet


I'm using Struts 1.1 rc1, Tomcat 4.1.18
I've written this Action class:
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)
    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.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message