Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #35317 > unrolled thread
| Started by | parmenides <xparmenides@yahoo.com> |
|---|---|
| First post | 2016-08-14 14:29 +0800 |
| Last post | 2016-08-14 12:50 -0700 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.java.programmer
Syntax error on token "taskTEList", VariableDeclaratorId expected after this token parmenides <xparmenides@yahoo.com> - 2016-08-14 14:29 +0800
Re: Syntax error on token "taskTEList", VariableDeclaratorId expected after this token Lew <lewbloch@gmail.com> - 2016-08-14 12:50 -0700
| From | parmenides <xparmenides@yahoo.com> |
|---|---|
| Date | 2016-08-14 14:29 +0800 |
| Subject | Syntax error on token "taskTEList", VariableDeclaratorId expected after this token |
| Message-ID | <nop34r$1f19$1@gioia.aioe.org> |
Hi,
In a JSP page, the following code:
<%
...
ArrayList<TaskTableEntry> taskTEList;
@SuppressWarnings("unchecked")
taskTEList = (ArrayList<TaskTableEntry>)session.getAttribute("taskTEList");
...
%>
will result in compilling error:
Syntax error on token "taskTEList", VariableDeclaratorId expected after
this token
But, by modifing the code as:
<%
...
@SuppressWarnings("unchecked")
ArrayList<TaskTableEntry> taskTEList =
(ArrayList<TaskTableEntry>)session.getAttribute("taskTEList");
...
%>
there is no the above error message at all. Why?
[toc] | [next] | [standalone]
| From | Lew <lewbloch@gmail.com> |
|---|---|
| Date | 2016-08-14 12:50 -0700 |
| Message-ID | <e8a2d0eb-fa7e-4b69-aeb8-dc915632ee97@googlegroups.com> |
| In reply to | #35317 |
parmenides wrote:
> Hi,
>
> In a JSP page, the following code:
>
> <%
> ...
> ArrayList<TaskTableEntry> taskTEList;
> @SuppressWarnings("unchecked")
> taskTEList = (ArrayList<TaskTableEntry>)session.getAttribute("taskTEList");
> ...
> %>
>
> will result in compilling error:
>
> Syntax error on token "taskTEList", VariableDeclaratorId expected after
> this token
The annotation is in an illegal place. You cannot annotate a statement, only a declaration.
>
> But, by modifing the code as:
>
> <%
> ...
> @SuppressWarnings("unchecked")
> ArrayList<TaskTableEntry> taskTEList =
> (ArrayList<TaskTableEntry>)session.getAttribute("taskTEList");
> ...
> %>
>
> there is no the above error message at all. Why?
Because here you annotate the declaration.
--
Lew
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web