aspose file tools*
The moose likes JSP and the fly likes Accessing javabean method in onClick? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Accessing javabean method in onClick?" Watch "Accessing javabean method in onClick?" New topic
Author

Accessing javabean method in onClick?

Lon Allen
Ranch Hand

Joined: May 24, 2001
Posts: 67
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

Joined: Aug 02, 2002
Posts: 14
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

Joined: May 24, 2001
Posts: 67
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accessing javabean method in onClick?