In jsp: String cannot be resolved to a type

17.4k views Asked by At
<%
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.

4

There are 4 answers

0
Tony Weddle On

Try switching to a fresh workspace and importing your project and see if the problem persists. If so, I suggest re-installing MyEclipse because it looks like the java validation is screwed up somehow. Alternatively, maybe starting MyEclipse with the -clean option might help (add "-clean" at the top of the myeclipse.ini file). Remove the option if that fixes it, as it slows down the launch.

Failing all that, more details would be needed so I'd suggest raising it on the myeclipse forums.

0
时伟建 On

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

0
LachoTomov On

I was able to fix this by clicking the right button on the jsp and choosing "Validate".

1
user1324418 On

Make sure the Java Compiler level is the same as in the pom.xml under the configuration tag. For example, if your Java Compiler is 1.7, then the source and target in the configuration tag should be 1.7. After making your changes, right click on project-->Maven-->Update project.

<configuration>
       <source>1.7</source>
       <target>1.7</target>
</configuration>