• 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

Accessing javabean method in onClick?

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a textarea field in a form that gets populated with a string of data that a method in a JavaBean returns. The textarea is initially populated with the text when the page is brought up using the following code:

I want to be able to access the JavaBean method at other times to update the data displayed in the textarea via clicking on an INPUT type=BUTTON through the ONCLICK property of the button. Any ideas how I can do this. Apparently the ONCLICK property will only accept Javascript methods and not JavaBean method calls.
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JavaScript is clientside and JavaBeans are stored serverside. So they can't interact without a roundtrip to the server.
If you need the bean data via an onClick, store it to <input type="hidden" ...> fields.
 
Lon Allen
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you ellaborate alittle on that response? I would assume that this would mean just submitting the form and setting the input TYPE to "submit" instead of "button." In this case the text that is in the textarea is getting posted back to the server, which is something I want to avoid. The data I plan to display can get quite lengthy and I would rather just make a call to get the data from the bean and the data only flows from the server to the client. What is your suggestion?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic