This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes How to exit from the for loop in jsp scriptlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to exit from the for loop in jsp scriptlet" Watch "How to exit from the for loop in jsp scriptlet" New topic
Author

How to exit from the for loop in jsp scriptlet

RameshKumar Mathiyazhgan
Greenhorn

Joined: Mar 30, 2013
Posts: 1
]Hi Friends,

I am using JSP scriptlet in javascript and now facing one issue. I am using JSP FOR loop in javascript, but i dont know how to exit from that loop if my javascript condition is true which i have written inside the JSP FOR loop. PFB my code kindly anyone help me in this. Thanks in advance.

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41125
    
  45
It looks like you misunderstand how JSP works - JSP runs on the server, whereas JavaScript runs on the client (the browser). You can't mix them in the way you're trying to do here.


Ping & DNS - my free Android networking tools app
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

RameshKumar Mathiyazhgan wrote:I am using JSP FOR loop in javascript

No. You are not. Not at all.

You seem to be under the impression that the JavaScript and the JSP code will execute at the same time. They do not. The JSP executes on the server before the page is sent to the browser. The JavaScript executes on the client after the page has been sent.

You can't just mix them up and expect them to execute together. Please read this article to understand how JSP works.

Also, putting Java code into a JSP is bad practice that has been obsolete for 12 years! 12 years! Do you not think it's time to catch up to 2013?

[Edit: Ulf was quick on the draw and snuck his post in there before me]


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
 
subject: How to exit from the for loop in jsp scriptlet
 
Similar Threads
Yes or No Confirmation alert Msg Box??
Is there something better then event.pageX/Y?
JSP And Javascript - How to
cloning labels
document.forms[0].elements.focus() is not working in IE 7.0+ and FF 3.0