Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing javabean method in onClick?

 
Lon Allen
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • 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.
 
Jeff Black
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • 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
  • 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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic