• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts: includeactive in jsp

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am encountering "CODE TOO LARGE" problem when my jsp is compiled. From suggestions, i tried splitting the jsp and do an include. Something like:
<%@ include file="/jsp/page_II.jsp"%>

But it was of no use. Later, i am trying to do an includeactive. that is dynamic including instead of static.
<jsp:include page="="/jsp/page_II.jsp" />

But, now my question is what should I have in page_II.jsp. I will make it in such a way that it runs on it own. Like I will include all taglibs,etc as i did in parent jsp(Page.jsp)
How is it compiled as a different servlet? Is that o.k, if i just have that include statement. Or do I need to specify this in struts-config(deployment descriptor).

These suggestions.. I got from: http://faq.javaranch.com/view?IncludesActionDirective

Regards
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The way you're doing it should work. There is no need to declare the second JSP to Struts in any way.

The way it works is this: The two JSP files are compiled into two different classes. Let's call them JSP1_java and JSP2_java. The job of these servlet classes is to return an HTML text stream to the browser. When JSP1_java is called, it starts building this text stream and then calls JSP2_java to add to the text stream. Control is returned to JSP1_java and it sends the final text stream to the browser.
 
navi kumar
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Merrill, thanks for the reply.

This is the actual error I was getting:

".war/filename.java:8929: code too large for try statement
} catch (Throwable __ee) {
^
and
code too large
public void _jspService(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
As i said,
I tried doing include:file ....static include which pastes the content of jsp2 into jsp1 and then compiles to generate a single servlet.

Could you please elaborate on using includeactive. I mean to ask how to write the jsp2?. A small example would be of great help(if only you have time) else just some explanation will do.

Thanks again.

Regards
 
navi kumar
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Merrill,

I have tried using includeactive..butUnfortunately, I can't use that as the JSP is almost entirely one <html:form>.
Many of the <html:*> tags won't work if they are on a separate page from the <html:form> tag.

Please Help by letting me know, how to do the <jsp:include>

Regards
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmmm.... that is a problem. If you have a large portion of the page that is output only, you might put that part in a second JSP.

If not, you might try putting an <html:form> tag in the second JSP with the same action that you have in the first JSP. It's possible that since HTML does not allow <form> tags to be nested, the browser may simply ignore the second nested <form> tag that is rendered by Struts.

Give that a try and let me know if it works.
 
navi kumar
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
merrill,

I have a <%@ include file="/jsp/includes/fppm_leftnav.jsp"%> which includes left navigation bar on my jsp screen.

Do I need to have this on jsp2 too. I am confused, if I am supposed to have this or not??
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's important to understand that using the <%@ include %> does nothing to reduce the size of your JSP compilation unit. This brings in the text from your navigation bar file before compiling it. I'd suggest making this a <jsp:include>. By doing so, you make the code in the navigation bar part of its own class file and not part of the main JSP class file which is too large.
[ August 25, 2006: Message edited by: Merrill Higginson ]
 
navi kumar
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes Merrill. Actually I changed that <jsp:include>.

Sorry for wrong post.

My question was, Do I need to have this <jsp:include page =leftnav.jsp/> which correspond to left navigation bar on the UI screen on JSP2?

WE have that included dynamically in JSP1.

Regards
 
navi kumar
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Merrill,

I tried that.

Yet getting an error. Actually, I have this in my JSP.
<%Wjscreen_JSPUtils.generateHeader(out, "FPPM", "FORMBEAN"); %>

<% Wjscreen_JSPUtils.generateFooter(out); %>

The error says cannot resolve these symbols when I had <jsp:include>.

Help!!!

Regards
 
navi kumar
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
those two correspond to Header and Footer of every screen in the application. It is mandate to have them on the screen
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JSP2 should be a JSP fragment. So that means it should have no header, no footer, and no navigation bar. It should be a portion of the main page. That portion will be added to the main JSP at the point where you put the <jsp:include> tag.
 
navi kumar
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Merrill,

It is fine now. I can see the headers and footers as they are included in jsp now.

The problem now is:

I have an update button on my screen, which when clicked should update the table with changed values and further display the same screen with the updated values. But , it is giving an error( Error in the sense, it is not displaying anything on the Console)
Just saying...THERE IS PROBLEM WITH YOUR REQUEST> PLEASE TRY AGAIN....this is general jsp message we get in your application when the action does not return anything... i guess the same is happening here. ...Dont Understand why? Any help??? please
 
navi kumar
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
actually the UPDATE action is part of jsp2
 
navi kumar
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Merrill,

ths second JSP2 is being added to the JSP. But, when i want to submit the form, that is click the existing "update" button present in the second jsp2. It performs no action. and displays nothing on console.
I tried specifying the mapping of this second jsp2 in struts.configfile. When I do so and click update button, the action should update the values in table and show the entire jsp with updated values.

But, it shows only second jsp.

Please help
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd suggest you change your strategy and keep the update button in JSP1. Don't register JSP2 with struts.
 
navi kumar
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your replies Merrill. I got it working now
 
reply
    Bookmark Topic Watch Topic
  • New Topic