Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: import java in jsp

  1. #1
    Join Date
    Mar 2013
    Thanked 0 Times in 0 Posts

    Default import java in jsp

    i have a jsp file below. in tere i want to create java methods to test if its number or not etcc... so my plan is to make a java class and put all my methods in there. i need some help importing the java file in jsp.

    i am getting error on line:
    <%@ page import = "JavaFunctions" %>

    <%@ page import = "JavaFunctions" %>
         <form method="post" action="index.jsp">
    		what's your name?<br/>
    		<input type="text" name="usernameField"/><br/>
    		what's your aga?<br/>
    		<input type="text" name="ageField" /><br/>
    		<input type="submit" name="submit" />
    		if (request.getParameter("submit") != null) {
    			String username = request.getParameter("usernameField");
    			String number1 = request.getParameter("ageField");
    			//check errors
    				out.print("Error enter name");
    			else if(number1.equals(""))
    				out.print("Error enter age");
    				int number1I = Integer.parseInt(request.getParameter("ageField"));
    				out.print("answer" + number1I);

    public class JavaFunctions {
    	public JavaFunctions() {
    		// TODO Auto-generated constructor stub
    	public static boolean isNumber(String str)
    			int num = Integer.parseInt(str);
    		catch(NumberFormatException e)
    			return false;
    		return true;

  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Washington, DC
    My Mood
    Thanked 636 Times in 540 Posts

    Default Re: import java in jsp

    This is the first result for googling "jsp import java": java - How do you import classes in JSP? - Stack Overflow
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. import, .java files, and jsoup-1.6.1
    By dalydir in forum Java Theory & Questions
    Replies: 2
    Last Post: January 20th, 2012, 07:49 PM
  2. how to compile java and import it as package
    By clementnas in forum What's Wrong With My Code?
    Replies: 2
    Last Post: July 19th, 2011, 05:53 AM
  3. how to import my own class in my .java file
    By amr in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 17th, 2010, 09:31 PM
  4. Pb import Eclipse Java Yaps Petstore
    By azerty@123450 in forum Java IDEs
    Replies: 1
    Last Post: May 4th, 2010, 09:16 PM
  5. How to import an .tiff image in JSP?
    By jazz2k8 in forum JavaServer Pages: JSP & JSTL
    Replies: 4
    Last Post: May 12th, 2008, 05:55 AM