Win a copy of Spring in Action (5th edition) this week in the Spring 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
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Struts html link tag  RSS feed

 
Ranch Hand
Posts: 77
  • 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: 9548
12
Linux Mac OS X 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: 77
  • 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: 9548
12
Linux Mac OS X 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: 77
  • 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: 9548
12
Linux Mac OS X 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!