Win a copy of Getting started with Java on the Raspberry Pi this week in the Raspberry Pi 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Liutauras Vilda
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Piet Souris

Commandlink not calling method in the bean

 
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,



I have other fields in the form,
On click of the download link, the page simply refreshes but doesn't call the fileDownload method in the bean...any idea where am wrong?
 
Saloon Keeper
Posts: 27273
193
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's generally one of 2 things:

1. You didn't declare fileDownload as a public no-argument method returning a String in the backing bean.

2. You have a problem with some of the data that's being sent when you click the link. The JSF messages tag will usually display a message, if that's the problem.
 
Mary Cole
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is my filedownload method.. It doesn't even log the first log message


[ March 28, 2008: Message edited by: Mary Cole ]
 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If it is an action (as opposed to actionListener) it should return a String. the string triggers navigation.

Also you want to ensure there are no javascript errors on your page.
 
Mary Cole
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried with the action listenertoo...with no luck. The form has many other fileds with a link to the download field. I have 2 different beans in the form and the commanlink for one of the form works and downloads the file...but the same code for the other form and other bean in the same page doesn't call the method. The form gets submitted populationg the bean except calling this method
 
Bob Good
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are there any javascript errors on the page? If you are using IE, look in the bottom left corner of status line...Done it say 'Done' or 'Error'?
 
Mary Cole
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I was calling the filedownlad method using a command link and sepecifying the action as beanname.fileDownload. The problem which am facing now is , the response i get contains the whole file (from DB)inaddition to the html elements which is on the form. as the page refreshes on click of the link .. Is there any way to download only the file contents ignoring the other fields which is on the page and without submitting the whole page.
[ April 03, 2008: Message edited by: Mary Cole ]
 
Bob Good
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This kind of code will send a file to the browser. It assumes 'doc' has the file contents. Make sure file has a known extension (pdf, doc, rtf, etc):

 
You get good luck from rubbing the belly of a tiny ad:
Low Tech Laboratory
https://www.kickstarter.com/projects/paulwheaton/low-tech-0
reply
    Bookmark Topic Watch Topic
  • New Topic