Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to call javascript function from my jsp Page?

 
moh sak
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic