File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Can parameters be scriptlet in onclick? If not, alternate? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Can parameters be scriptlet in onclick? If not, alternate?" Watch "Can parameters be scriptlet in onclick? If not, alternate?" New topic
Author

Can parameters be scriptlet in onclick? If not, alternate?

Murad Iqbal
Ranch Hand

Joined: Dec 09, 2003
Posts: 90


is the method i am calling on onclick inside the image source tag. The function i am calling is:

function editGroupAccess(editGroupAccessId)
{
setCmd('assignAccess');
document.frmReport.submit();
}

Kindly inform, what is the method to call this function in a written in a jsp file when a button is clicked. There are rows in a table which have these buttons on which i am planting the onclick function. The parameter passed to the method called in the onclick cant be a scriptlet? Any alternate ways?
Abhijeet Gholkar
Greenhorn

Joined: Jun 11, 2002
Posts: 25
Originally posted by Murad Iqbal:


is the method i am calling on onclick inside the image source tag. The function i am calling is:

function editGroupAccess(editGroupAccessId)
{
setCmd('assignAccess');
document.frmReport.submit();
}

Kindly inform, what is the method to call this function in a written in a jsp file when a button is clicked. There are rows in a table which have these buttons on which i am planting the onclick function. The parameter passed to the method called in the onclick cant be a scriptlet? Any alternate ways?



If i have properly understood u r question, this could be u r answer.

U can use scriplets inside u r javascript function call as follows

<A href='editGroupAccess("<%=editGroupAccessId%>")'><img src="C:\Documents and Settings\murad\Desktop\onclicktag.jpg"/></A>

Where editGroupAccessID is a java variable which can be initialized to certain value using normal java code. It will be replaced by normal javaScript function parameter when page is converted to html.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60992
    
  65

Gholkar,

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" is 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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can parameters be scriptlet in onclick? If not, alternate?