0

I am trying to organize my code into many small JSP files. I then create a main JSP that imports many smaller jsp's. Many times the smaller JSP's will depend on a resource in the main page eg. the user. When I run this code on the local development server it runs fine because pages are created on the fly. When I try to deploy it tells me that it can't find the dependency, because it's not created in this file its in the main jsp. How do I tell a JSP that a variable is created outside of a file. I am using @ include and not jsp:include.

Lumpy
  • 3,632
  • 4
  • 34
  • 58

1 Answers1

1

Port all those scriptlets to fullworthy Java classes which are invoked by a servlet. Then you can easily organize the code by a clean class and method hierarchy the usual Java way.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Isn't that kind of moving in the wrong direction? Isn't the point of jsp to move away from servelets and allow for more MVC based code. – Lumpy Jan 10 '11 at 16:39
  • JSP is supposed to be the *view* of MVC. Servlet is supposed to be the *controller* of MVC. Javabean classes are supposed to be the *model* of MVC. Mingling M and C in a V doesn't make it MVC. See also my answers [here](http://stackoverflow.com/questions/3177733/how-to-avoid-java-code-in-jsp-files) and [here](http://stackoverflow.com/questions/3541077/design-patterns-web-based-applications/). – BalusC Jan 10 '11 at 16:43