MGreenfield
MGreenfield

Reputation: 365

Use JSP with Tomcat without connected Servlet

I have some Tomcat server using struts to associate servlets and JSP pages. I would like to incorporate a stand-alone for miscellaneous purposes (e.g. redirecting, calculations, etc.).

The operations done in this JSP wouldn't require a servlet, so I would like to avoid associating one with it for simplicity.

I put the .JSP in a jsp folder in the webapp and tried to hit it, and I got a 404 redirect.

I assume I'd have to put some entry into web.xml or the struts config XML in order for Tomcat to know where to look, but must I associate the JSP with a servlet?

Thanks for your time.

Upvotes: 0

Views: 414

Answers (1)

Elliott Frisch
Elliott Frisch

Reputation: 201497

There is no such thing as a JSP that doesn't require a servlet. Every JSP is compiled into a Servlet.

It is not a flat requirement to put a Controller Servlet in front of a JSP, and that seems to be what you're really asking. You may put your JSP files in the root of the WAR (anywhere except under WEB-INF, if your JSP files are stored under WEB-INF then you must use a servlet controller) and then you can access them from

/myapp/index.jsp

Assuming myapp is your context and index.jsp is in the top-level of the WAR file.

Upvotes: 1

Related Questions