This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes how to call java method in java script and return type should be setted as title Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how to call java method in java script and return type should be setted as title" Watch "how to call java method in java script and return type should be setted as title" New topic
Author

how to call java method in java script and return type should be setted as title

anish reddy
Ranch Hand

Joined: Apr 19, 2008
Posts: 74
can any one give information on how to call java method in java script and return type from that method should be setted as title for the html.
code snippets do that.
Ivan Jozsef Balazs
Rancher

Joined: May 22, 2012
Posts: 867
    
    5
Are you talking about an applet? Its public methods are available to javascript.
anish reddy
Ranch Hand

Joined: Apr 19, 2008
Posts: 74
i want to call in html ,i am using java 1.6.is it possible to call in scriplet of html
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60766
    
  65

To call back to the server requires the use of Ajax.

Using jQuery (recommended), it as easy as: $('title').load('/path/to/servlet');

The servlet should return the text to be inserted into the title element.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60766
    
  65

P.S. If you don't understand why you can't just call a Java method from the browser, please read this article to understand how JSP operates and why you can't do that.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: how to call java method in java script and return type should be setted as title
 
Similar Threads
How to define focus() method in JS
Creating a masked popup in JavaScript
how to get the return value from java method by shell script
Quick Question
INSERT THE VALUE OF A FORM FIELD INTO A JAVA STRING (without page refresh)