An error occurred at line: 21 in the jsp file: /Test.jsp UserNameCheck cannot be resolved
Above is the error I receive. The .jsp file I am using is:
<%@page import="webtest.*"%>
<%@page import="java.sql.*" %>
<%@page import="java.io.*" %>
<%@page import="java.util.*"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
String username = request.getParameter("username");
String password = request.getParameter("password");%>
<h1>Hey <%=UserNameCheck.CheckLogin(username,password)%></h1>
</body>
</html>
and the Class code is
package webtest;
public class UserNameCheck{
public static String CheckLogin(String X,String Y){
return X;
}
}
I am pretty sure I am overlooking something incredibly stupid right now.
Or the approach I am taking is not possible.
I have crash coursed in java for my company over the past 3 or 4 weeks. My learning has been incredibly unstructured, so don't assume anything.
What I know. The username and password variables give accurate results. If I changed the code to
<h1> hey <%=username%></h1>
I receive what I want.
` and make sure there is no other code that can throw any exception in your JSP page. A good advice: don't use scriptlets, its a bad way to program in JSP, read [How to avoid Java Code in JSP-Files?](http://stackoverflow.com/a/3180202/1065197) to have a better idea to solve these problems.
– Luiggi Mendoza Jul 06 '12 at 15:14