Menu

ActionForm class not found

Anonymous
2002-09-24
2002-09-24
  • Anonymous

    Anonymous - 2002-09-24

    Hi!

    I have a problem with the MockStrutsTestCase:
    after I managed to get the damn thing running (it couldn't find the struts-config.xml), I receive am error message saying that the ActionForm classes could NOT be found.
    Where should I put them?
    Why can't I choose another directory where my struts-config file is? Why MUST be /WEB-INF/struts-config.xml?! Maybe I have a directory foodir where my struts-config file lays. I've tried with setConfigFile(), but no good. Does this method really work?
    I hope I get some answer soon enough, before I find a solution by myself. :o)

    Marius

     
    • Deryl Seale

      Deryl Seale - 2002-09-24

      If you want help, Marius, you need to provide some more information about what is going wrong.

      You mentioned that some classes could not be found -- are you sure your CLASSPATH is set up properly?  Perhaps you're missing a few items in there.

      As for your questions about the configuration file, the short answer is that the '/WEB-INF/struts-config.xml' default is due to the way that ActionServlet looks for the configuration file.

      But as you noted, you can use setConfigFile -- and trust me, it works -- to point to a different file if you want.  The only trick is to set your CLASSPATH properly.  As it is stated in many places, you have to set it to point to the the directory that *contains* the path you set in this method.

      You might also want to check the README.txt file in the examples directory, which clearly lays out the steps required to run the example test cases.

      -d.

       
    • Anonymous

      Anonymous - 2002-09-24

      So, I made a batch file, which calls javac and java with the classpath arguments. Al least, it compiles.
      When I've tried setConfigFile() to some other directory, didn't work. Must be that directory in the CLASSPATH? Why? This means that when I change my appication, or when I have more apps, then must be all included in CLASSPATH. This sounds not very good to me.
      Your argument about /WEB-INF/struts-config.xml is not very solid, because in Struts it's posible to set some config things, which can be then passed to whatever struts needs. Or am I wrong?
      One more thing: the example runs, no problemo, but in example it says:

      setRequestPathInfo("/login");

      I've try to copy this template, but

      setRequestPathInfo("/action.name");

      didn't work. It works when I add the ".do" suffix and then I get the ActionForm class is missing. Otherwise, it can't find my action named only "action", not "action.name".
      Well, I think I've bothered you enough 4 2day. :)
      I'm waiting for your answers, but I feel that it's all about some stupid setting thing, as usual...

      Marius

       

Log in to post a comment.