wood burning stoves*
The moose likes JSP and the fly likes How to call javascript function from my jsp Page? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to call javascript function from my jsp Page?" Watch "How to call javascript function from my jsp Page?" New topic
Author

How to call javascript function from my jsp Page?

moh sak
Ranch Hand

Joined: May 11, 2005
Posts: 78
hi all, this is my first subscribtion on this site hope u help me.

i have a jsp page that i use to add ,delete, and update student record ! when i call this page i send the command in a request and check if its add or delete or update , the problem is if the command is add the id field must be disabled else it must be enabled !! i did this but it does not work :


<%
String command = request.getParameter("command");
if(command.equals("add")){
<script>
setDisabled();
</script>
}
%>




<script>
function setDisables(){
document.main.id.disabled=false;
}
</script>
[ May 11, 2005: Message edited by: Bear Bibeault ]
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904



Groovy
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
If I am not wrong, on which event you wanna call this method?
Because JSP renders on server-side and the javascript is a client-side technology.
moh sak
Ranch Hand

Joined: May 11, 2005
Posts: 78
thanx 4 ur replays , and i forget to close the scriptlet %> in here only.

i am trying to call this method when i redirect to that page if i select the delete student option from the main page menue ! hope this will be more spec.
moh sak
Ranch Hand

Joined: May 11, 2005
Posts: 78
Originally posted by Adeel Ansari:
If I am not wrong, on which event you wanna call this method?
Because JSP renders on server-side and the javascript is a client-side technology.


thanx 4 ur replays , and i forget to close the scriptlet %> in here only.

i am trying to call this method when i redirect to that page if i select the delete student option from the main page menue ! hope this will be more spec.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60821
    
  65

moh sak,

JavaRanch is a community of people from all over the world, many of who are not native English speakers. While using abbreviations like "u" instead of spelling out "you", and "thanx 4 ur" instead of "thanks for your", may be convenient when text messaging your friends on a cell phone or in a chat room, it presents an extra challenge to those that are already struggling with English. Additionally, such shortcuts may confound automated translation tools that patrons of the Ranch may be making use of.

I would like to ask for your help in making the content of JavaRanch a little easier to read for everybody that visits here by not using such abbreviations.

thanks,
bear
Forum Bartender


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to call javascript function from my jsp Page?
 
Similar Threads
Calling a new JSP form a Spring Controller using Ajax
using ajax and struts iterate tags
jsp and navigation or jsp calling javascript function
Error: DispatchMapping[/login] does not define a handler property
example for ImageButtonBean using DispatchAction class