Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

tags:panel not working in a particular situation

 
adeeb alexander
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
I am trying to use the panel tag. The code below works fine, there is no problem.



When i am trying to use the same tags, when populating the table from the given data using with iterator as shown below



when i try to run the above I am getting this errror

/DataPage.jsp (line: 20, column: 84) Scripting elements ( <%!, <jsp:declaration, <%=, <jsp:expression, <%, <jsp:scriptlet ) are disallowed here.


how to overcome that..
Please someone help me out.

Thanks and Regards.
Adeeb
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The use of scriptlets has been discredited for over 10 years now with the introduction of JSP 2 in 2002. They should not be used in any modern JSP pages.

Moreover, tags created with the JSP 2 mechanisms cannot be used in conjunction with outdated scriptlets. That may be what you are encountering.

 
adeeb alexander
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply Bear.


So is there any other way to iterate other than using jsp scrplets?? can i get and example.




Thanks
 
adeeb alexander
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a List containing the database table data with three columns and unknown number of rows, so wright now i was using scriplets to display it..
The other way i tried with tag is like this

<c:forEach var="ulist" items="${data}">
${ulist[0]}
${ulist[1]}
${ulist[2]}
</c:forEach>


is that correct??? i am getting error "Syntax error, insert "Finally" to complete TryStatement"
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That syntax error seems unrelated to your JSTL. May we see the entire JSP file with proper indentation and code tags?
 
adeeb alexander
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Finally I got it till here.



1. I can view only one row, means its not itterating.
2. When i try to use var i.e like $(ulist), i get null values. Then what for i have to take a variable when i am able to access the list directly with "data".

I think i am doing some silly mistake, its better to post the total code.



 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you really not indent your code?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic