Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

jsp and javascript

Status
Not open for further replies.

porto2001

Programmer
Mar 7, 2001
24
PT
I have a simple problem...

I have an if condition to prevent a undefined eval...
something like this:

if(eval('document.all.But<%= MenuNumber %>0') != undefined){
var rightcl=eval('document.all.But<%= MenuNumber %>'+i);
}

the problem came when i run some jsp's....when the page is compiling and constructing, the source code of the page never reach the end, in some point it breaks and doesn't make the rest of the jsp code.
In the server there isn't any exception, aparently everything went well to the server.

I don't have any clue about this problem....if someone knows waht the problem is i will appreciate....thanks
 
As far as I know you cannot use jsp tags in the javascript section.Because jsp tags are determined in server but javascript codes are run in client.
Try to pass your dynamic values as an argument instead. Salih Sipahi
Software Engineer.
City of Istanbul Turkey
ssipahi@yonbilgi.com
 
Where does the source code end, before or after the script? And what does <%=MenuNumber %> resolve to? JSP can be mixed with JavaScript, but you have to keep track of which language rules apply to what, which code runs where, when and in what order, which can get tricky.

petey
 
I agree with petey. If JSP cannot mixed with javascript, it will be a very great problem!
As for porto, I have such kind of experience a lot and it is painful(all seems ok but it simply doesnt work). My suggestion is as follow:
1. Try to block some unnecessary code to make to whole thing simple(for debug)
2. Print the varible MenuNumber to check its value.
3. Check whether there is null value or not.
4. look at HTML carefully, it may be HTML error.

 
the code is divided in <forms>, and before the end of each form there is a <input type=hidden...> with some parameters the code always breaks there but not in the exactly same point. I checked the menunumber many times and it's always correct.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top