Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Generated servlet error: [javac] Compiling 1 source file

  Asked By: Jayden    Date: Jun 23    Category: Java    Views: 2494
  

I am defining the following variable in a JSP program.
<%@ page import="java.lang.*" %>
<%@ page import="java.lang.Float.*" %>
<%
Float v_float = (float) 0;
.
.
.
.
.
%>

But I am getting the following Tomcat error.
Generated servlet error:
[javac] Compiling 1 source file

C:\Tomcat\jakarta-tomcat-4.1.18\work\Standalone\localhost\ch01
\wireless\addtocart_jsp.java:316: incompatible types
found : double
required: java.lang.Double
Double v_double = 0.0;
^
1 error

Can anyone please explain me what am I doing wrong?

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Luisa Fischer     Answered On: Jun 23

Try This

<%@ page import="java.lang.*" %>
<%
float v_float = (float) 0;


This works

 
Answer #2    Answered By: Eshe Chalthoum     Answered On: Jun 23

you can use the Hashtable class

this is a simple code:

import java.util.Hashtable ;
public class HashtableDemo{
public static void main(String[] args){
//This example creates a hashtable of numbers. It uses the names of the
numbers as keys:
Hashtable numbers = new Hashtable();
//public Object put(Object key,Object value);
numbers.put("one", new Integer(1));
numbers.put("two", new Integer(2));
numbers.put("three", new Integer(3));
//To retrieve a number, use the following code:
//public Object get(Object key);
Integer n = (Integer)numbers.get("two"); // (Integer) is casting
(ta7wil)
if (n != null) { //(n != null) : pour tester que cette valeur n'est pas
"null";
System.out.println("two = " + n);
}
}
}

 
Didn't find what you were looking for? Find more on Generated servlet error: [javac] Compiling 1 source file Or get search suggestion and latest updates.




Tagged: