This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JSP and the fly likes passing javascript variable in java method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » JSP
Bookmark "passing javascript variable in java method" Watch "passing javascript variable in java method" New topic

passing javascript variable in java method

Rishi Yagnik
Ranch Hand

Joined: Jan 04, 2001
Posts: 84
I have got javascript variable and i want to pass tht variable to java method
do somebody have any idea how do i go about it ?
following is the javascript function
<script language="javascript">
function isFieldEnabled(jsfieldName,tagId)
//assignment to java variable from javascript
String fieldName = jsfieldName;
boolean fieldStatus = user.getUserProfile().isProfileFieldEnalbled(fieldName);
document[getNetuiTagName("parentForm")][getNetuiTagName(tagId)].disabled = true ;
I want to pass a jsfieldName(javascript variable) in isProfileFieldEnalbled of user class how do i do that ?
waiting for positive response
Rishi Yagnik
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
To pass the variable you need to submit a form to pass it to the server since you are talking about client/server interaction.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63208

Can't be done.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: passing javascript variable in java method
It's not a secret anymore!