File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

onClick function call with a scriptlet parameter

 
Murad Iqbal
Ranch Hand
Posts: 90
  • 0
  • 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.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • 0
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a solution to this problem?
 
Murad Iqbal
Ranch Hand
Posts: 90
  • 0
  • 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic