In jsp: String cannot be resolved to a type

sky picture sky · Nov 11, 2014 · Viewed 14.2k times · Source
<%
String bn=request.getParameter("branch");
if(bn.equals("MK")){
%>

I am getting error in myeclipse that

String cannot be resolved to a type

The method getParameter(String) from the type ServletRequest refers to the missing type String

Multiple annotations found at this line: - String cannot be resolved to a type - The method getParameter(String) from the type ServletRequest refers to the missing type String

this is Java code/bean class where i am getting same error for "String" the code is here

public class Customer {//for Customer i am getting this error- Implicit super constructor Object() is undefined for default constructor. Must define an explicit constructor
private int cid; // No error here

private String cname; //error here- String cannot be resolved to a type
private String email; //error here- String cannot be resolved to a type

private long phone;// No error here

// when i gives no arg constructor it gives this error
// Implicit super constructor Object() is undefined. Must explicitly invoke another constructor

//public Customer(){    }


}
...
...

} }

before it was working and i was in eclipse, now it is in Myeclipse and getting error. please tell, how i can solve it. thank you all

One more problem is- In myeclipse when i press Ctrl+space(not working), its not showing any option.

Answer

时伟建 picture 时伟建 · Oct 13, 2019

Maybe a JRE system library unbound error. Please right click your project choose "Properties->Java Build Path->Libraries" , click JRE system library->edit->workspace default JRE. It will be OK