Re: a testcase writen by watij base on java can not be used in JSP
davy wrote:
when i run a jsp web after starting tomcat, where the code is
<% gdpTest n2 = new gdpTest();
n2.testGunDP();
%>
where gdpTest is one class extends testCase in Junit,
and i have imported the class gdpTest in JSP web, when i open the jsp
web, the information in the web is
HTTP Status 500 -
You do not provide a simple, self-contained compilable (correct) example,
SSCCE, so it is not really possible for us to speak to your difficulty with
any assurance.
For example, you say you import the "gdpTest" class but do not show the import
statement(s). If they were flawed, you'd have trouble but we couldn't see it.
Another thing not shown is the code for the constructor - perhaps there is no
default constructor, or there is some other mistake that makes the "new" not
compile. Or perhaps there isn't.
Also, this has no bearing on your difficulty perhaps, but class names by
convention (only) should start with upper-case letters. Check out the Sun
coding conventions.
Have you examined the generated .java for the JSP? Is it what you expect
around the point of your scriptlet?
This is part of why Marty Hall and many other pundits strongly recommend not
to use scriptlet in JSPs. Stick with tag libraries, like the JSTL and JSF,
and push the logic out of the JSP. Java classes are easier to debug, and the
JSP is easier to maintain when it it narrowly focused on view concerns.
--
Lew