- This topic has 2 replies, 2 voices, and was last updated 19 years, 10 months ago by kitm.
-
AuthorPosts
-
imm102Memberhi,
Im trying to complete my first useful jsp (i had previously only done the hello world example) and i am getting quite a few errors which are confusing me. The code is below
<%@ page language="java" import="java.util.*, javax.naming.*, info.amadeusserver.interfaces.*, info.amadeusserver.ejb.*" %> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; InitialContext ic = null; ic = new InitialContext(); DevicesHome home = (DevicesHome)ic.lookup("java:comp/env/Test"); Devices devs = home.create(); %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>The UDK Main Page 'devices.jsp' starting page</title> <meta http-equiv="description" content="UDK Server Main Page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> <H1><%= devs.getServerName() %></H1> <br> <H2><%= devs.getHomeAddress() %></H2> <br><br> <TABLE BORDER=1 BORDERCOLOR =SILVER BGCOLOR=IVORY CELLPADDING=5> <% List devtable = devs.getAllDevices(); %> <%! String[] headerRow = (String[])devtable(0); %> <% for (int i = 0; i<headerRow.length; i++) { %> <TR><TH ALIGN=LEFT> <%= headerRow[i] %> </TH></TR> <% } %> <% for (int i = 1; i<devtable.size(); i++) { %> <% String[] row = (String[])devtable.get(i); %> <% for (int r = 0; r<row.length; r++) { %> <TR><TD> <%= row[r] %> </TD></TR> <% } %> <% } %> </body> </html>
All the method calls and the first occurance of the devs variable get underlined in red despite being correct. Ive imported all the relavent classes at the start. I also get an error at the
<%! String[] headerRow = (String[])devtable(0); %>
which says
cannot resolve symbol: symbol :method devtable(int)
Does anyone have any idea why? im stumped been puzzling over it all day. Its probs somethings obvious that im not spotting.
Cheers
Ian
imm102MemberSorry i forgot to mention my system stats
Windows XP
Eclipse 3.0.1
MyEclipse 3.8.3 fresh install
No more plugins
kitmMemberIan,
Not sure about the method call and devs underlines, but I believe your code:
<%! String[] headerRow = (String[])devtable(0); %>
needs to be:
<%! String[] headerRow = (String[])devtable.get(0); %>
HTH,
-Kit -
AuthorPosts