Instantiate an external Java directory class in JSP

Asked

Viewed 336 times

1

I created my app Java with Eclipse in the directory Meus Documentos/workspace/TesteJAVA/

Now I want to call a class with JSP, want to know how to configure to grab the application from this directory or should I keep the application and classes in the folder Tomcat ?.

I’m using Apache Tomcat 8 and the page is in C:Aplicativos/Apache/Tomcat8/webapps/TesteJSP/

  • 1

    Well, just for the level of clarification, what the reason of this class is not inserted in the project that contains the page?

  • @Weslley Tavares I’ve never made it work before, there’s a JSP file in the Tomcat folder that works with java code, this is my HTML page, I must include this file in the project by Eclipse ?

  • I see no problem in this inclusion.

  • @Weslley Tavares Ok, I try to include JSP file, but Eclipse automatically closes, I will reinstall the modules and try again.

  • What eclipse perspective are you using?

  • @Weslley Tavares Latest version of Eclipse Mars + Jboss Tools, but was giving error when installing, the afternoon I will try again.

  • So, as for perspective, you’re in java ee?

  • @Weslley Tavares Yes

  • I have no computer to try to simulate your case...

  • @Weslley Tavares But that’s right, isn’t it? Java EE + Jbos to allow creating Dynamic Web Projects..., if this is what I’m going to try to solve, the real issue is that I didn’t care that I should include JSP in the project, as simple, but as I’m getting started...

Show 5 more comments

2 answers

2


You have two options:

  1. Create a web project in Eclipse and let it assemble the package for you.
  2. You need to copy the files .class inside the directory WEB-INF/classes in your project. Example (put inside):

    C:/Applications/Apache/Tomcat8/webapps/Testejsp/WEB-INF/classes

Remember that upper and lower case characters make a difference.

1

Now yes, everything is working.

First installed in Eclipse the software

  • Eclipse Java EE Developer Tools
  • Eclipse Java Web Developer Tools
  • Eclipse Web Developer Tools
  • Eclipse XML Editors and Tools

As described in the answer with more votes from this question: http://stackoverflow.com/questions/5531402/newbie-in-eclipse-i-dont-have-dynamic-web-project-i-am-under-linux-ubuntu

Second, I created the file JSP in the project, as described by @Leonardocosta and @Weslleytavares, however it presented an error, solved with the answer of the following question:

/questions/94987/como-resolver-o-erro-the-superclass-javax-servlet-http-httpservlet-was-not-f

Thanks for the help.

  • Thank you for giving your answer, help to new people who have the same doubt :-)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.