So I'm trying to enter the fun world of JSP's and so I bought murach's Servelets and JSP 2nd edition, installed NetBeans and Tomcat, configured them, and was trying to run a simple application named TestApp. I created the project in NetBeans, and ran it, and it runs great it says "Hello World" and everything. The next step was to add a new JSP, and here's where I am having a problem. When I add a new JSP called "test.jsp" in the WEB-INF folder, and use the Run File command, I get an error at the first line of code
Exception in thread "main" java.lang.NoSuchMethodError: javax.servlet.ServletContext.getJspConfigDescriptor()Ljavax/servlet/descriptor/JspConfigDescriptor;
I have triple and quadruple checked and I am absolutely sure I am doing everything the book said to do to the letter. The same error seems to happen if I click on or change anything. It creates the project fine, and if I don't do anything whatsoever to it it will run. But if I do anything like change the html in the index.jsp or add a jsp I get this error. Of course I am a complete beginner so I have no idea what is going on, but can anybody help? It is exercise 3.1 in the book and it seems like it should be super simple.
Don't try to put your JSP within WEB-INF, because no direct no request can be made to anything inside WEB-INF. Instead move your JSP directly into the Web Pages folder as shown in the Projects Window in Netbeans.
Joined: Jul 29, 2011
Ok, I have them in the web pages folder, but everytime I try to do something, it doesn't run. For example: I can create a new project, and everytime I create a new project there is a page called index.jsp that basically outputs "Hello World!" to the browser. If I don't do anything to it, it runs fine. But if I do anything whatsoever, even if I change the exclamation mark to a question mark so it says "Hello World?" for example, it won't build or run. Even if I change it back to an exclimation mark, so it's exactly the way it was before, it won't run. The file is exactly the same. What can possibly be going on here?
Joined: Jul 29, 2011
Ah found the problem. The book I had recomended that I add some jar files to the java/lib/ext directory, but it turns out these files were breaking everything somehow. Well the book is like 3 years old or so, so I guess the software has changed since then.
subject: Simple question from Beginner on Using NetBeans