0

i want to use JavaFunctions.java into login.jsp file. my plan is to store all my java functions in one file and i can use them later. ex check for string or number etc functions...

first my folder tree.

webside_01
    >.settings
    >build
    >src
         >newServlet
              JavaFunctions.java
              website_01_Servlet.java
    >WebContent
        >META-INF
        >WEB-INF
        index.jsp
        login.jsp

JavaFunctions.java

public class JavaFunctions {
    /*** test to see if its a number ***/
    public static boolean isNumber(String str){
        try{
            int num = Integer.parseInt(str);
        }
        catch(NumberFormatException e){
            return false;
        }
        return true;
    }/*** End of isnumber Method***/
}

Know in this login.jsp file i want to use 'isNumber()' method. but iam getting error on:
<%@ include file="JavaFunctions.java" %>

login.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
 <%@ include file="JavaFunctions.java" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head></head>
<body>

    .....
</body>
....
2
Contributors
1
Reply
14
Views
4 Years
Discussion Span
Last Post by stultuske
0

not .. learn how to use servlets, and write your code as such that your jsp files communicate with those servlets.
I can recommend the "Head First Servlets & Jsp - 2nd edition"

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.