Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Struts html link tag

 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to pass a parameter to action from my jsp using struts html link tag.



My struts-config.xml looks like this...



My action class is..



When I run the code, it says JSPG0218E: Error failed to locate setter method for attribute action in tag class org.apache.struts.taglib.html.LinkTag. Can you suggest what is wrong?

This is what I want to achieve: I want to call my InvoiceAction from the jsp to fetch the invoice info from DB and display it on another invoiceInfo.jsp  page ( I would like the 2nd jsp on a different window like a popup or something )
 
Bartender
Posts: 9583
13
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Struts 1 is past end of life and is not supported.  
That said, the error JSPG0218E is usually caused when a custom JSP tag references a property that the corresponding tag class does not have a setter for.  Looking at the documentation for LinkTag, it does, in fact, have an "action" property.  
What version of Struts 1 are you using?
 
santosh batta
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The app is using struts 1.0. As you said, it does look like they removed the action attribute when they customized it. Is there a way that I can use href or some other way that I can call the action?
 
Joe Ess
Bartender
Posts: 9583
13
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm thinking the action attribute was added in a later version. I'm looking at the Struts 1.3 documentation and it does have the action attribute.
You could try upgrading Struts to a later version but that may have other side effects.
Another option is to use Java code in a scriptlet to construct your link, but that is considered "bad practice"
 
santosh batta
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree. So, I switched to use href to accomplish it. This is how, I am doing it..


The onclick method is..



When I click on the link, it opens a new window and displays default error page. I believe the action is not called (the sysout I put in the action is not printed on the console). I'm not sure if my href approach is correct. Can you please suggest, how I should use it to call the action? Your help is much appreciated.
 
Joe Ess
Bartender
Posts: 9583
13
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the popup window have an address bar?  If not, turn it on and see what the URL is.
Look at the source code of the page in the browser.  The generated "a" tag is probably different from the html:link tag.
 
Been there. Done that. Went back for more. But this time, I took this tiny ad with me:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!