File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

LookupDispatchAction only firing execute, not mapped methods

 
Stu Quinn
Ranch Hand
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good day,

After reviewing numerous posts and on-line tutorials I am having trouble identifying the problem with my sample struts code.

My action class extends LookupDispatchAction. If I include the execute method in my action class that is the only method that gets fired. If I do not include the execute method I receive the following error message.

  • [6/4/10 14:43:21:730 PDT] 0000001d RequestProces W org.apache.struts.action.RequestProcessor processException Unhandled Exception thrown: class javax.servlet.ServletException
    [6/4/10 14:43:21:761 PDT] 0000001d ServletWrappe E SRVE0068E: Could not invoke the service() method on servlet action. Exception thrown : javax.servlet.ServletException: Request[/customerEdit2] does not contain handler parameter named submitMethod



  • With any luck this will be obvious to somebody. I am just getting starting with Struts and I am stuck at this point.

    I am using JDK 1.4 and Struts 1.1.


    Here is a snippet of the action class (without the execute):


    Here is a snippet of the struts-config.xml (it also references the resources file, but I did not include that in the snippet).



    Here is the resources file:



    Here is a snippet of the .jsp




    Thanks for any help here.

    p.s. I welcome any opinions on the prefered methods for calling multiple methods from the Action class.
     
    David Newton
    Author
    Rancher
    Posts: 12617
    IntelliJ IDE Ruby
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    If you include an execute(...) method the behavior of the default LookupDispatchAction is overridden.

    Did you check on the wire to see if the parameter's being sent? It *looks* like it should work, although it's been awhile since I've used it.
     
    Stu Quinn
    Ranch Hand
    Posts: 35
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I am not sure what you mean by "looking on the wire" however I have looked at the actionmapping object passed into the execute method and parameter equals "submitMethod".

    Thanks,
    Stu

     
    Stu Quinn
    Ranch Hand
    Posts: 35
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Although I stated I was "following the example" there was one important difference. I had a been using simple menu and was navigating to a few different .jsp & action variants as I was learning Struts.

    When I go directly to the .jsp that utilized the LookupDispatchAction it is working fine. Only when navigating from another .jsp which used the standard Action was it failing. Perhaps there are limitations regarding mixing and matching the different types of actions.


     
    David Newton
    Author
    Rancher
    Posts: 12617
    IntelliJ IDE Ruby
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I'm not really sure what you mean by that. The form with the submit tags will only submit to a single action (hence action class); there's no mix and match. I think I'm misunderstanding you.
     
    Stu Quinn
    Ranch Hand
    Posts: 35
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    David,

    Sorry I was not very clear. Yes, I only have one action class backing my .jsp form. What I meant was perhaps I was causing myself a problem because I was navigating off of my menu page and that menu page was using Action rather than DispatchAction. Of course, there may be something else wrong. However I wanted to communicate to folks reading the post that the code as written does actually work. The problem likes outside the scope of what I had originally posted and this is moving into a new question (can I use Action for one page and LookupDispatchAction for another page). Time to get back to reading the book and trying a few things.

    Thanks for your interest and your feedback is appreciated.
     
    I agree. Here's the link: http://aspose.com/file-tools
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic