• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

onClick function call with a scriptlet parameter

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Is this a valid function call from nclick?

nClick="editGroup('(less than sign, percentage sign)obGroupBeanArray[i].getRoleId(percentage sign, greater than sign)');"

I have attached this nclick function to an image. I havent tested it with my servlet yet, but I guess we can pass a parameter to a function that is called by nclick. The parameter can be a scriptlet or not, this is what I need to know. It would be either the above way or

nClick="editGroup('(lesser than sign, percentage sign)=obGroupBeanArray[i].getRoleId(percentage sign, greater than sign)');"

this way. Am I wrong?

This page is not taking the correct came of the nclick method, therefore i have trimmed the 'o' from the beginning to get it posted anyhow.
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Repeat (this comes up only about several times a week) after me: Javascript can not execute scriptlet code in real time, scriptlet code is executed on the server before the client gets the page and javascript on the client after the client gets the page.

Scriptlet code CAN generate Javascript, bu Javascript can NOT order scriptlet code to execute.

You CAN create Javascript that calls another servlet or JSP and does something with its output but that's not what you're trying to do.
 
Murad Iqbal
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a solution to this problem?
 
Murad Iqbal
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I mean, how can I call a function passing it a parameter? The parameter is not fixed as there are array of buttons on which i will be putting the on-click function. The values inside the called method are taken from a VO passed by servlet.
 
Arthur, where are your pants? Check under this tiny ad.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic