aspose file tools*
The moose likes JSP and the fly likes Standards for splitting up JSP pages. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Standards for splitting up JSP pages." Watch "Standards for splitting up JSP pages." New topic
Author

Standards for splitting up JSP pages.

Jack Numen
Ranch Hand

Joined: Nov 09, 2011
Posts: 32

I have a requirement of splitting up a JSP page into two or more of each less than 65KB size.

I am using jsp:include
I have declared Class varibles in <%! %> thinking of using the same in the split pages instead of redeclaration.As expected it threw

undefined variables in the splitted pages.

Now i redeclared the variables in all the splitted up pages.
In the jsp:param tag i am passing the variables and fetching the same values in the split up pages using

reuest.getParameter().

Ex:
Main.jsp




partOne.jsp


Is this the right way to do it..Or is there any other wway to escape this redeclaration in the partOne.jsp(split up page).
jatan bhavsar
Ranch Hand

Joined: Jul 23, 2008
Posts: 296

hi Jack,

declaring variable global with ! mark will not work in what you are trying to achieve.When you use jsp:include it generates the separate servlets for included jsp.so the way you are passing the parameters is correct.Global declaration will not be useful.

And have you tried to compile seprate jsp and put it into the weblogic server.also it will be useful here if you add the reference of previous discussion in struts forum.


Regards
jatan
Jack Numen
Ranch Hand

Joined: Nov 09, 2011
Posts: 32

Thanks Bhavsar.

Here is the link to the previous discussion of splitting up of JSPs

http://www.coderanch.com/t/592092/Struts/Splitting-up-JSP-containing-logic

Regarding JSP compilation i am sure it will work as the maximum size allowed is 65KB.
Spltting up is cumbersome as it will have maintenance overhead.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

If you want to know what's "standard" and accepted best practice then you should remove all Java code and scriptlets from the JSPs. They've been discredited and obsolete for over 10 years.

As of JSP2 introduced in 2002, you should use the JSTL and EL.

See this JspFaq entry.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Standards for splitting up JSP pages.
 
Similar Threads
Parameters and JSP includes
please solve this EL
evaluate dynamic expression language
Whats wrong with this code?
Unable to pass parameters to included url