score:0
this answer to this question has nothing to do with my setup or import statements. the correct answer is that eclipse doesn't make it clear what code it "sees" (or that its compiling) when it runs the project. on my jsp page, it showed it as recognizing the call to my java code. however, when i ran the page, it was still compiling the older version of my java code, that didn't have my latest changes. i've found the best way to guarantee that the newest version of my referenced java code is compiled when i run my .jsp program (that calls the java) is to go to "project->build all" then go to "servers", right click "publish". if publish isnt an option, and it thinks its already synchronized, then you may have to change the .jsp page, save it, then "publish" will become active again.
score:1
you need to have the java ee version of eclipse installed, and create a java web application, which will allow you to set up a web.xml.
eclipse jee which i have installed to set up web projects is: http://eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/keplerr
your web.xml will definte your web servlets, which can be jsp's or java classes that extend a servlet implementation.
this has less to do with your ide (eclipse) than it does with java web applications.
you should read this documentation for starters from oracle about web apps, and go from there on setting up an ide:
http://docs.oracle.com/javaee/1.4/tutorial/doc/webapp.html
edit based on user feedback
import should be to class level:
<%@ page import="fully.qualified.someclass" %>
then from your jsp code:
<%
someclass someclass = new someclass();
someclass.helloworld();
%>
edit 2 based on feedback
try this link to do using page include: http://www.coderanch.com/t/286168/jsp/java/calling-java-classes-jsp-page
alternative approach
add a new class to your web.xml, where you want to send your request/form data to. so your jsp would be 1 servlet, your other java class would be your other servlet.
on your jsp, create a form that has an action of your new "testprogram" servlet
Source: stackoverflow.com
Related Query
- How to correctly call my Java code from a JSP project in Eclipse
- Can we call another project java class from our project in eclipse
- How to Create Flowchart from java source code in Eclipse
- How to deploy Java web application project from Eclipse to live Tomcat server?
- How to recover Java file from Eclipse Project that damaged by getting power off?
- How can I prevent Eclipse from stepping into Java library code
- How Exclude some files from Eclipse Java EE Web Application project Deployment Assembly
- How to correctly add a Java Maven project dependency to a Grails Maven project in eclipse
- How to get the current project path from eclipse using java
- How to create a jar file from an eclipse java project that uses *.jar files added in "Classpath"
- How to publish JSP code changes, from Eclipse to Tomcat
- How to export java project from eclipse into a jar file with images
- How to read a property file of a project from another java project in eclipse
- How to port an Eclipse Java project to another PC and compile it from Shell?
- How to use java project in eclipse from clojure project
- How to work on my java eclipse project from two PCs?
- How to enable an eclipse MenuItem from Java Code if it is being disabled from Plugin.xml
- How to call Unity C# method from Android java project by UnitySendMessage method?
- How to find unused Java classes and JSP files from a project
- How to import and call a library project from an Eclipse ADT application project?
- How to stop Eclipse from inserting blank line between import groups in Java code
- Java code for Importing git project from local in Eclipse
- How to extract specific statements from java eclipse project using rascal
- How to remove java project from eclipse without affecting clearcase repository
- How to access a text file from a java EXPORTED project eclipse
- How do you include files from a scala project in eclipse in a java project in netbeans
- How to get project infos from Eclipse "Open Call Hierarchy"?
- How to run java eclipse project from command line?
- How to exclude referenced libraries from being exported when you export jar in VS Code for Java project (no build tool)
- How to delete java project from eclipse without affecting subversion?
More Query from same tag
- Remove one line of code from all activitys/Classes
- How to increase speed of emulator?
- OpenCV with Android 4.0 and NDK r8d not working
- What does "Run as Java Application" do in Maven projects
- how to find which project is running in Eclipse programatically
- Eclipse Neon (Java EE IDE) Javascript Editor Broken
- Eclipse gradle refresh from cmd
- The apk file and dex file is not getting generated by eclipse
- exception NumberFormatException ListView OnItemClickListener
- Can't find org.json.JSONObject
- SyntaxError: Non-UTF-8 code starting with '\x82'
- How to add date to edittext on android in eclipse
- c++ files to include for boost : asio
- Android Development in Eclipse Unrechable Code Intent
- eclipse workspaces sync settings - what to sync?
- Refreshing Snapshot Dependencies in Eclipse with Gradle
- Eclipse neon Neon.3 Release (4.6.3) error message
- How to render graphical to JPG from Eclipse Zest
- Eclipse with Glassfish 4 DEBUG source lookup not working
- eclipse not recognising jtwitter
- Able to select both radio buttons in same group
- "open call hierarchy" in eclipse not working
- why the method onStart() have a strike symbol in android on eclipse
- Eclipse CVS setup problem - Error validating location
- why i am getting javax.ws.rs.WebApplicationException
- setting -source to 1.5, it is set to 1.3 apparently
- Can you invoke nonstatic method within a static method?
- Importing code style formatting settings into eclipse from intellij-idea
- ActionBarSherlock library not recognizing
- Randomize tictactoe