ben fran

Greenhorn
+ Follow
since Nov 01, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
4
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by ben fran

you know?
I will look into JSTL/EL and configuring some sort of a MVC architecture IF THIS PROJECT NEEDS IT, and get back )

thanks :)
You have been very helpful

but, MS word is useful
11 years ago
JSP
One really basic question(little distractive)

Is there a decent article/tutorial/(NOT 100 PAGES LONG) book chapter

for getting
*A simple JSP form
*A JDBC using bean
to work together on apache tomcat 7?



Will that be lesser pain than to make JSP access classes?

I am more concerned with the HOW part, because, IMO , this is the problem even now.

thanks,
11 years ago
JSP
No no, the code was actually writen (THIS CODE :)) in vi editor.
But, when I was preparing the post for coderanch, I put stuff in MS word.

Cleaned it up. Now I understand that you meant the web.xml by the term deployment decriptor

New web.xml
11 years ago
JSP
Looking at the deployment descriptor, I assume that the leading "o" characters are an artifact of posting? : they are lists from MS Word

Why do you have a servlet declaration for the JSP? Not needed. so just a web.xml will do with no elements? that was one thing I suspected may cause my issue. But it appears it wasnt.


And superfluous things tend to have a way of sticking their legs out and tripping you when you least expect it. I'd clean that up before progressing.
agree, let me clean web.xml and try to run it.
UPDATE: same error
11 years ago
JSP
Hi Bear Bibeault,

Let me give the full structure

TOMCAT/webapps/hello is my root directory for the sample web app (let us call is BASE)
there is

BASE/hello.jsp (so my URL is server:8080/hello/hello.jsp)
BASE/WEB-INF/web.xml
BASE/WEB-INF/classes/HelloWorld/HelloWorld.class
BASE/META-INF/MANIFEST.MF (empty file)




My broad objective is to run a JSP form which refers to some data access classes, which in turn refer to a jdbc driver jar.
Before getting my hands on them , I just want to make sure I can run a JSP on TOMCAT which refers to an external class.
That is why I am trying this.

thanks,
11 years ago
JSP
Hi Bear Bibeault,

I appreciate your reply. I have seen while looking at some java issues, this forum is very helpful.


The java class is designed or rather written in this way:
*Package: HelloWorld(I see what you meant about naming)
*ClassName: HelloWorld(what else?)
*Class Location: TOMCAT/webapps/hello/WEB-INF/classes/HelloWorld/HelloWorld.class

So it appears to be in the correct location. Unless I am wrong in assuming WEB-INF/classes/(PACKAGE)/(CLASS) is the location where the TOMCAT servlet engine looks for classes which are imported by the JSP page.
Thats one reason I said it might be a config error, but I really dont know what is there to configure here?

I have to use JSP, for not this project :), but the reason why I am trying to get this working :)

Thanks for the links. That will help.
11 years ago
JSP
Hi,

I am a newbie to Java technologies, and so my question might sound very simple. I searched a little and got some tips to solve my problem in some forums, but they didn’t work. So I am seeking coderanch people help.
Please have a look at it, and see if I am missing any obvious steps(I don’t think I am, but the task is so basic I have my doubts).

Objective:
o To run a JSP page which calls a java class, both residing on tomcat server
o Then proceed to run a JSP page which calls a java class, which in turn calls a jdbc driver class, residing on tomcat server

Environment
o Server environment:Linux
o Server:Tomcat7.0..27
o IDE: none


JSP (all it does is display a string)
o

JSP location
o TOMCAT/webapps/hello/hello.jsp

Java class(all it does is return a string)
o

Java class location: TOMCAT/webapps/hello/WEB-INF/classes/HelloWorld/HelloWorld.class
ava class compile action: javac -classpath TOMCAT/lib/servlet-api.jar:. -d /home/user/ HelloWorld.java

WEB.XML
o


Actions:
o Copy java class to directory
o Clean TOMCAT/work directory
o Shutdown TOMCAT
o Startup TOMCAT
o Open server:8080/hello/hello.jsp


Issue:
• HTTP Status 500
• org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 14 in the generated java file The import HelloWorld cannot be resolved An error occurred at line: 8 in the jsp file: /hello.jsp HelloWorld cannot be resolved 5: </HEAD> 6: <BODY> 7: <H1>Hello World</H1> 8: String is : <%= HelloWorld.HelloWorld.display() %> 9: </BODY> 10: </HTML> Stacktrace: org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102)



There is no syntax error in calling PackageName.ClassName.StringReturningMethod() in JSP
The class is in package folder.

What is causing it?

Thanks,


I hope I didn’t give too much useless details. :)
But, I may have put something wrong in config as well. So better to put all the details iMO.





11 years ago
JSP