First and foremost, this is 2012. Scriptlets and Java code inside a JSP has been discredited since 2002. That's 10 years ago. You should not be putting code into a JSP at this point. See what a mess your JSP is with all the mixed syntax?
You should bring your JSP knowledge up to date using the JSTL and EL, and stop putting Java code into the JSP.
Problems like this are just one of the many reasons that scriptlets are not longer acceptable.
Thank you sir for this good suggestion. But at now i am in beginner level so that's why i do this silly mistake in coding.
I must try to resolve this and adopt your suggestion.
But now can you please give me solution of this coding? becoz its very urgent for me and i continuous tried last one week but not success.
Ravi Der wrote:Thank you sir for this good suggestion. But at now i am in beginner level so that's why i do this silly mistake in coding.
If you are a novice to JSP, it is doubly important that you abandon trying to use Java code and scriptlets in JSPs and to learn, from the outset, the correct ways to do things. Why start off by learning bad habits and poor practices?
But now can you please give me solution of this coding?
Sorry, I cannot. You are using practices that have been discredited for over 10 years and I cannot in good conscience help you down the wrong path.
becoz its very urgent for me
First, the term 'urgent" is a bad one to use. It usually causes people to simply start to ignore you. Please read the link EaseUp for more information.
Secondly, please use real words when posting to the forums. Abbreviations such as "becoz" in place of "because" only serve to make your posts more difficult to read and less likely to generate useful responses. Please click this link ⇒ UseRealWords for more information.
I always recommend that novices to JSP read the following two articles:
I can see the intent here, and its not going to work.
What you have in your loop in effect is this:
The JSP compiler is complaining because it hits your closing custom tag before you've actually opened it.
It can't understand the fact that there would have been one opened on a previous iteration of your loop in scriptlet code.
There is no way around this apart from chosing a different approach with your code.
I would suggest:
- Write a bean which executes the query and saves the results into a bean/data structure
- start with a simple one level menu
- as Bear as said, don't mix scriptlet code and custom tags. its a recipe for disaster.
Trust God, but always tether your camel... to this tiny ad.