473,387 Members | 1,463 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Problem With Servlet

24
I getting error msg that line six is not supported by -source 1.4, try -source 1.5 to enable annotations. I am new to servlet and I need help asap
thanks in advance
Expand|Select|Wrap|Line Numbers
  1. import java.io.*;
  2. import javax.servlet.*;
  3. import javax.servlet.http.*;
  4. import java.util.*;
  5.  
  6. @SuppressWarnings("unchecked")
  7.  
  8. public class ShowItems extends HttpServlet {
  9.   public void doGet(HttpServletRequest request,
  10.                     HttpServletResponse response)
  11.       throws ServletException, IOException {
  12.     HttpSession session = request.getSession();
  13.     ArrayList<String> previousItems =
  14.       (ArrayList<String>)session.getAttribute("previousItems");
  15.     if (previousItems == null) {
  16.       previousItems = new ArrayList<String>();
  17.       session.setAttribute("previousItems", previousItems);
  18.     }
  19.     String newItem = request.getParameter("newItem");
  20.     if ((newItem != null) &&
  21.         (!newItem.trim().equals(""))) {
  22.       previousItems.add(newItem);
  23.     }
  24.     response.setContentType("text/html");
  25.     PrintWriter out = response.getWriter();
  26.     String title = "Items Purchased";
  27.     String docType =
  28.       "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
  29.       "Transitional//EN\">\n";
  30.     out.println(docType +
  31.                 "<HTML>\n" +
  32.                 "<HEAD><TITLE>" + title + "</TITLE></HEAD>\n" +
  33.                 "<BODY BGCOLOR=\"#FDF5E6\">\n" +
  34.                 "<H1>" + title + "</H1>");
  35.     if (previousItems.size() == 0) {
  36.       out.println("<I>No items</I>");
  37.     } else {
  38.       out.println("<UL>");
  39.       for(String item: previousItems) {
  40.         out.println("  <LI>" + item);
  41.       }
  42.       out.println("</UL>");
  43.     }
  44.     out.println("</BODY></HTML>");
  45.   }
  46. }
Oct 12 '07 #1
3 1207
judge82
24
can i get any help here please!
Oct 12 '07 #2
Laharl
849 Expert 512MB
I believe that's telling you to use the -source 1.5 tag when compiling via command line. If you're not using a command line compiler, update your IDE...
Oct 13 '07 #3
JosAH
11,448 Expert 8TB
I getting error msg that line six is not supported by -source 1.4, try -source 1.5 to enable annotations. I am new to servlet and I need help asap
thanks in advance
Expand|Select|Wrap|Line Numbers
  1. import java.io.*;
  2. import javax.servlet.*;
  3. import javax.servlet.http.*;
  4. import java.util.*;
  5.  
  6. @SuppressWarnings("unchecked")
  7.  
Why did you type in that line anyway if you don't know what it means? It's an
'annotation' which, in this case is just a compiler directive telling the compiler
that it shouldn't whine about unchecked, non type safe method invocations.

Annotations didn't exist in Java 1.4 yet, you need Java 1.5 or later. That's what
the error diagnostic is trying to tell you.

kind regards,

Jos
Oct 13 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: jajoo | last post by:
Hi, I have a problem with using *.jar files with Tomcat 5.0.16. I place the jar in the lib directory of the application but server throws Exception. java.lang.NoClassDefFoundError:...
10
by: sssk28 | last post by:
i have installed fedora core 6 and i am getting following error: type Exception report message description The server encountered an internal error () that prevented it from fulfilling this...
3
by: mayur1 | last post by:
Hello everybody, I am trying to connect to DB2 V 8.1 on Red Hat Linux V5 from WebSphere Application Server V6 on Windows Server 2003. The problem that i am facing is that its not able to opent...
5
by: srinivasareddynr | last post by:
Hi, I am trying to parse an xml using xpath. I dont have any problem when i try it as a standalone java application, but when I try the same code with in a servlet I am getting the below error. Can...
10
by: swethak | last post by:
Hi, i am first installing the tomcat 5.5 in my hosting server system and created the one folder(like test) in webapps and place all the jsp files.And also created the another folder(like test2)...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.