The moose likes JSP and the fly likes tags:panel not working in a particular situation Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "tags:panel not working in a particular situation" Watch "tags:panel not working in a particular situation" New topic
Author

tags:panel not working in a particular situation

adeeb alexander
Ranch Hand

Joined: May 29, 2008
Posts: 255
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 opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50691

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.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
adeeb alexander
Ranch Hand

Joined: May 29, 2008
Posts: 255
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

Joined: May 29, 2008
Posts: 255
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 opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50691

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

Joined: May 29, 2008
Posts: 255
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 opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50691

Do you really not indent your code?
 
 
subject: tags:panel not working in a particular situation
 
Threads others viewed
JSP not picking up getAttribute from Servlet
weird functioning of servlet
Transfer the variable value from one jsp page to other
Please solve the problem.
problem calling servlet to build a list of data from a database and display a jsp page
developer file tools