views:

44

answers:

2

in eclipse IDE how can i access a java class from .jsp exactly like accessing a servlet from a jsp file ? in other word, what should i replace with question marks "????????"

<form name="myForm" action="???????????????" method="post">
</form>

when i run engine.java file from "mypackage" package tomcat application servers shows this address in the address bar.

http://localhost:8080/rouyesh/servlet/mypackage.engine

anybody can help please?

+2  A: 

You'll need to use whatever the path relative to your current URL is, or the absolute path, just as you would with files. It might be prudent at this point to investigate a web framework, however, before you destroy your product with insanity :P.

Stefan Kendall
+1 for *destroy your product with insanity* and of course for suggesting a web framework.
seanizer
A: 

If you just need to call the class from your JSP page, then just do it.

If you need to expose your class through an URL, the standard way to do so, is to enter through a servlet (exposed in the usual way) and call the class inside the servlet.

Your particular framework may provide such functionality out of the box. Read the documentation carefully.

Thorbjørn Ravn Andersen