struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fred Bloggs <>
Subject 2 problems with <bean:include> and <bean:write> whilst including results of action in page and behind firewall with NAT.
Date Mon, 03 Nov 2003 13:34:50 GMT
Dear All,

I'm relatively new to Struts and have come across two
problems that have completely confused me.

I am using Struts 1.1, Tomcat 4.1.27. 

Problem 1:

I have an action that produces the most recent “news”
and displays it on separate page.  However I want to
include those news as well on some of my other pages. 
I use the template tags to get and put the various
pages together (I haven't tried Tiles yet, I want to
keep it simple).

So my topical.jsp contains a table with the following

                <bean:include id="GetMostRecentNews"
                <bean:write name="GetMostRecentNews"

All my pages use the UTF-8  charset thus I use the
following at the start of every jsp page:

<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld"
... plus other taglib definitions.

When I invoke the / directly using
a browser, everything is diasplayed correctly.  The
correct charset is used.

Now when I do the <bean:include and <bean:write (as
shown above), the page is included in the main page,
but the charset is incorrect and thus some characters
are incorrectly displayed.

I do not use the locale setting since the content and
thus charset is locale independent.

I use templates to do my header, footer, sidebar etc. 
The above table is in the main “content” of my

I tried changing my template to have another “news”
section and did a put (with a matching get) as

<template:put name='news'
content='/' />

I get a “javax.servlet.ServletException: Cannot
forward after response has been committed”.

I also tried using <jsp:include as suggested on “The
Struts User Guide”,
but I just get an exception
“javax.servlet.ServletException: Cannot forward after
response has been committed”.

I have not yet ported my application to Tiles so I
don't know if using Tiles instead of Templates will
solve my problem.

I would be grateful for any pointers.

Problem 2:

My site is behind a firewall that does NAT.  The site
works, except for the jsp pages where I do:

                <bean:include id="GetMostRecentNews"
                <bean:write name="GetMostRecentNews"

It appears that the <bean:include changes the 
/ to an absolute URL.  However,
since I am behind a NAT firewall (doing port
forwarding) I get an exception saying that “Exception
opening resource” since the absolute URL contains the
external IP and not the NATed IP address of the tomcat

I tried <html:base/> in all the jsp pages, but that
does not seem to help.

Is there anyway to tell the <bean:include not to use
an absolute address but a relative address to the
application or context?

I would be grateful for any help or pointers.

Thank you in advance.

Do you Yahoo!?
Exclusive Video Premiere - Britney Spears

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message