• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

getting Nosuchmethod exception even though there's unspecified method in the code

 
Ranch Hand
Posts: 417
  • Number of slices to send:
    Optional 'thank-you' note:
I am having an issue with the struts (1.x) code when a cancel button is clicked. Here's the java code with action methods:





And here's how all the methods are called from the JSP (customerApproveType.jsp) and they all work fine when the Approve and Save buttons are clicked.



However, as soon as cancel button is clicked, I keep getting:



Why is it happening like this even though I have the following method in the code to handle cancel button related operations I believe?


 
Saloon Keeper
Posts: 15619
366
  • Number of slices to send:
    Optional 'thank-you' note:
What makes you think the unspecified() method should be called?
 
Jack Tauson
Ranch Hand
Posts: 417
  • Number of slices to send:
    Optional 'thank-you' note:

Stephan van Hulst wrote:What makes you think the unspecified() method should be called?



Since there is no onclick event of the cancel button like it's there for other buttons like onclick="this.form.meth.value='save'" (for example). Please explain if my thinking is incorrect here. I guess I can define an action method for the cancel button and call it like "onclick="this.form.meth.value='cancel'" but I was hoping that unspecified method would take care of it.


Thanks!
 
Stephan van Hulst
Saloon Keeper
Posts: 15619
366
  • Number of slices to send:
    Optional 'thank-you' note:
No, what I mean is, why would the cancel tag specifically call a method named "unspecified"? Why not "other" or "cancel" or any other arbitrary name?

Where did you get the method name "unspecified" from?
 
Marshal
Posts: 28262
95
  • Number of slices to send:
    Optional 'thank-you' note:
This post from 18 years ago here seems to think there should be an "unspecified" method as well: Unspecified method. And there's other pages out on the web which suggest something like
These seem to be for Struts 1, some say so and others are so ancient they must be Struts 1. But then the question seems to be about Struts 1 as well. There's also a post from 10 years ago here Struts 1 No Longer Supported in which it's mentioned that the last release of Struts 1 was 15 years ago and that it was de-supported because of security issues.

I don't know the answer to the OP's question except to guess that the "unspecified" method described there isn't in a class which extends DispatchAction; using @Override would test that immediately. (Full disclosure: I'm not a Struts programmer.)
 
Marshal
Posts: 4533
572
  • Number of slices to send:
    Optional 'thank-you' note:

Jack Tauson wrote:Since there is no onclick event of the cancel button like it's there for other buttons like onclick="this.form.meth.value='save'" (for example). Please explain if my thinking is incorrect here. I guess I can define an action method for the cancel button and call it like "onclick="this.form.meth.value='cancel'" but I was hoping that unspecified method would take care of it. ...


As you already mentioned, there is no onclick handler defined for the Cancel button.  Is the event bubbling/propagating upwards and being handled by another element?
 
Ron McLeod
Marshal
Posts: 4533
572
  • Number of slices to send:
    Optional 'thank-you' note:
I have never looked at Stuts before, but I am guessing that it uses convention over configuration, and that at runtime, it using reflection/introspection to try and locate the appropriate class and method to handle the event.

Most likely if you examine the URL of the request which was triggered by clicking on the Cancel button, it will become more clear which method was expected but not found.
 
Jack Tauson
Ranch Hand
Posts: 417
  • Number of slices to send:
    Optional 'thank-you' note:

Stephan van Hulst wrote:No, what I mean is, why would the cancel tag specifically call a method named "unspecified"? Why not "other" or "cancel" or any other arbitrary name?

Where did you get the method name "unspecified" from?



The code I'm looking at is 12 years old so I've no idea. But I will try to investigate based on what others have suggested.
 
Jack Tauson
Ranch Hand
Posts: 417
  • Number of slices to send:
    Optional 'thank-you' note:

Ron McLeod wrote:Most likely if you examine the URL of the request which was triggered by clicking on the Cancel button, it will become more clear which method was expected but not found.



You mean examine the URL in the network tab of the web browser (which shows up after pressing F12 in Firefox)?
 
Stephan van Hulst
Saloon Keeper
Posts: 15619
366
  • Number of slices to send:
    Optional 'thank-you' note:
Please show us:

  • AbstractCustomerApproveTypeAction
  • struts-config.xml

  •  
    Jack Tauson
    Ranch Hand
    Posts: 417
    • Number of slices to send:
      Optional 'thank-you' note:
    Please find the shorter version of both files below:


    AbstractCustomerApproveTypeAction




    struts-config.xml where the bean is defined for CustomerApproveTypeAction

     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    reply
      Bookmark Topic Watch Topic
    • New Topic
    vceplus-200-125    | boson-200-125    | training-cissp    | actualtests-cissp    | techexams-cissp    | gratisexams-300-075    | pearsonitcertification-210-260    | examsboost-210-260    | examsforall-210-260    | dumps4free-210-260    | reddit-210-260    | cisexams-352-001    | itexamfox-352-001    | passguaranteed-352-001    | passeasily-352-001    | freeccnastudyguide-200-120    | gocertify-200-120    | passcerty-200-120    | certifyguide-70-980    | dumpscollection-70-980    | examcollection-70-534    | cbtnuggets-210-065    | examfiles-400-051    | passitdump-400-051    | pearsonitcertification-70-462    | anderseide-70-347    | thomas-70-533    | research-1V0-605    | topix-102-400    | certdepot-EX200    | pearsonit-640-916    | itproguru-70-533    | reddit-100-105    | channel9-70-346    | anderseide-70-346    | theiia-IIA-CIA-PART3    | certificationHP-hp0-s41    | pearsonitcertification-640-916    | anderMicrosoft-70-534    | cathMicrosoft-70-462    | examcollection-cca-500    | techexams-gcih    | mslearn-70-346    | measureup-70-486    | pass4sure-hp0-s41    | iiba-640-916    | itsecurity-sscp    | cbtnuggets-300-320    | blogged-70-486    | pass4sure-IIA-CIA-PART1    | cbtnuggets-100-101    | developerhandbook-70-486    | lpicisco-101    | mylearn-1V0-605    | tomsitpro-cism    | gnosis-101    | channel9Mic-70-534    | ipass-IIA-CIA-PART1    | forcerts-70-417    | tests-sy0-401    | ipasstheciaexam-IIA-CIA-PART3    | mostcisco-300-135    | buildazure-70-533    | cloudera-cca-500    | pdf4cert-2v0-621    | f5cisco-101    | gocertify-1z0-062    | quora-640-916    | micrcosoft-70-480    | brain2pass-70-417    | examcompass-sy0-401    | global-EX200    | iassc-ICGB    | vceplus-300-115    | quizlet-810-403    | cbtnuggets-70-697    | educationOracle-1Z0-434    | channel9-70-534    | officialcerts-400-051    | examsboost-IIA-CIA-PART1    | networktut-300-135    | teststarter-300-206    | pluralsight-70-486    | coding-70-486    | freeccna-100-101    | digitaltut-300-101    | iiba-CBAP    | virtuallymikebrown-640-916    | isaca-cism    | whizlabs-pmp    | techexams-70-980    | ciscopress-300-115    | techtarget-cism    | pearsonitcertification-300-070    | testking-2v0-621    | isacaNew-cism    | simplilearn-pmi-rmp    | simplilearn-pmp    | educationOracle-1z0-809    | education-1z0-809    | teachertube-1Z0-434    | villanovau-CBAP    | quora-300-206    | certifyguide-300-208    | cbtnuggets-100-105    | flydumps-70-417    | gratisexams-1V0-605    | ituonline-1z0-062    | techexams-cas-002    | simplilearn-70-534    | pluralsight-70-697    | theiia-IIA-CIA-PART1    | itexamtips-400-051    | pearsonitcertification-EX200    | pluralsight-70-480    | learn-hp0-s42    | giac-gpen    | mindhub-102-400    | coursesmsu-CBAP    | examsforall-2v0-621    | developerhandbook-70-487    | root-EX200    | coderanch-1z0-809    | getfreedumps-1z0-062    | comptia-cas-002    | quora-1z0-809    | boson-300-135    | killtest-2v0-621    | learncia-IIA-CIA-PART3    | computer-gcih    | universitycloudera-cca-500    | itexamrun-70-410    | certificationHPv2-hp0-s41    | certskills-100-105    | skipitnow-70-417    | gocertify-sy0-401    | prep4sure-70-417    | simplilearn-cisa    |
    http://www.pmsas.pr.gov.br/wp-content/    | http://www.pmsas.pr.gov.br/wp-content/    |