User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 455,964 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,630 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 3706 | Replies: 2
Reply
Join Date: Nov 2007
Posts: 3
Reputation: kaleeswaranm is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
kaleeswaranm kaleeswaranm is offline Offline
Newbie Poster

How to pass value from jsp to javascript

  #1  
Nov 20th, 2007
Hi,

Can any one tell me how to pass a value from jsp to javascript both being different files.. ie a.jsp , b.js.. I have a hidden value in jsp i want to get its value in the javascript file.
thank you,
kaleeswaran
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2007
Location: Brisbane, Australia
Posts: 215
Reputation: sillyboy is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 13
sillyboy's Avatar
sillyboy sillyboy is offline Offline
Posting Whiz in Training

Re: How to pass value from jsp to javascript

  #2  
Nov 20th, 2007
you can just call a javascript function from your jsp page. This will not be possible with Java objects though (to my understanding).
Reply With Quote  
Join Date: Nov 2007
Posts: 1
Reputation: hvardhanu is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
hvardhanu hvardhanu is offline Offline
Newbie Poster

Troubleshooting Re: How to pass value from jsp to javascript

  #3  
Nov 27th, 2007
getting a value from jsp to js.. hmm sounds interesting. It's one of the most fundamental problem encountered by developers..

First of all your different js file should be included in the jsp..
like
 <script language="JavaScript" src="../../js/imaster_code.js"></script></td>

then in the js file you may have a function which may look like

function openMethod(target,countSel) {
        
        document.forms[0].selectedNumber.value = countSelected;

/* do something here with the value */
}

in your jsp keep the accessed variable like

<html:hidden property="selectedNumber"/>
this will to a great extent solve your problem
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 9:03 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC