You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Leonard Wolters <l....@chello.nl> on 2002/08/28 14:56:26 UTC

Composite jsp files

Is it possible to concatenate jsp files to one ?

The problem i have now is that tomcat / catalina
is complaining when I write multiple times to
the outputstream. A nice: java.lang.IllegalStateException: 
getOutputStream() has already been called for this response
is shown to me.


My question is if anyone know how to concat jsp files,
or to dymanically create jsp.


The problem is as follows: I have a certain jsp file which
may / may not show an image. Based on a particular
(custom made) tag an image should be shown or not. 
In both cases, the rest of the page should remain the
same.

Does anyone has tips / suggestions how to do this ????

T.i.a.

Leonard

Re: Composite jsp files

Posted by Cliff Rowley <cl...@onsea.net>.
I did? :)

On Wed, 2002-08-28 at 16:44, Leonard Wolters wrote:
> Thanks John &  Cliff (prior answer).
> 
> But john, unfortunately I can't use the img
> src tag since the images are directly retrieved
> from a database. It doesn't make sense to
> first (temporarily) store the images and then
> use the img source tag. Instead, I directly
> print the images by using the
> response.getOutputStream (or something similar)
> and setting the contentType + writing the bytes.
> 
> Cliff helped me out by showing me the <include>
> tags, which i think can be very usefull.
> 
> If this does not work, you will hear me scream ;)
> 
> Regards,
> 
> Leonard
> 
> ----- Original Message -----
> From: "John Raley" <jb...@mindspring.com>
> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> Sent: Wednesday, August 28, 2002 4:23 PM
> Subject: Re: Composite jsp files
> 
> 
> > With Struts logic:equal tag:
> >
> > <logic:equal ...><img src="..."></logic:equal>
> >
> > Check the doc for the various logic:equal options.
> >
> > Leonard Wolters wrote:
> >
> > >Is it possible to concatenate jsp files to one ?
> > >
> > >The problem i have now is that tomcat / catalina
> > >is complaining when I write multiple times to
> > >the outputstream. A nice: java.lang.IllegalStateException:
> > >getOutputStream() has already been called for this response
> > >is shown to me.
> > >
> > >
> > >My question is if anyone know how to concat jsp files,
> > >or to dymanically create jsp.
> > >
> > >
> > >The problem is as follows: I have a certain jsp file which
> > >may / may not show an image. Based on a particular
> > >(custom made) tag an image should be shown or not.
> > >In both cases, the rest of the page should remain the
> > >same.
> > >
> > >Does anyone has tips / suggestions how to do this ????
> > >
> > >T.i.a.
> > >
> > >Leonard
> > >
> > >
> >
> >
> > --
> > Check it out: Map -> JavaBean
> > http://dynclass.sourceforge.net/
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 
-- 

Regards

-------------------------------------------
 Cliff Rowley        |     cliff@onsea.net
 Software Engineer   |   www.doctype.co.uk
 +44 (0) 1206 514263 | www.cliffrowley.com
-------------------------------------------


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Re[2]: Composite jsp files

Posted by Leonard Wolters <l....@chello.nl>.
Thanks man,

this was exactly the info i needed.
Going to check it right away...

As you probably could guessed,
struts is still a little bit new to me !

Anyway, thanks man

Cheers,

Leonard
----- Original Message -----
From: "Dariusz Wojtas" <dw...@myrealbox.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Wednesday, August 28, 2002 6:20 PM
Subject: Re[2]: Composite jsp files


> Maybe I misunderstood you, but ...
> Why can't you use the <img> tag?
> Image file isnot send in the same response that the jsp/html
> file is sent. Browser makes another call for the image
> after parsing the html code.
>
> Why don't you just print:
>     <img src='/myImgServlet?imgId=<%= imgId %>'>
> ?
> And it works perfectly with the <logic> tags mentioned below.
> There is also no need to change the response type in the middle of
> writing to your output stream, because it is completely different call.
> You just set it once.
> And it will be served by separate servlet (here '/myImgServlet').
>
> Dariusz Wojtas
>
> Wednesday, August 28, 2002, 5:44:40 PM, you wrote:
> LW> Thanks John &  Cliff (prior answer).
>
> LW> But john, unfortunately I can't use the img
> LW> src tag since the images are directly retrieved
> LW> from a database. It doesn't make sense to
> LW> first (temporarily) store the images and then
> LW> use the img source tag. Instead, I directly
> LW> print the images by using the
> LW> response.getOutputStream (or something similar)
> LW> and setting the contentType + writing the bytes.
>
> LW> Cliff helped me out by showing me the <include>
> LW> tags, which i think can be very usefull.
>
> LW> If this does not work, you will hear me scream ;)
>
> LW> Regards,
>
> LW> Leonard
>
> LW> ----- Original Message -----
> LW> From: "John Raley" <jb...@mindspring.com>
> LW> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> LW> Sent: Wednesday, August 28, 2002 4:23 PM
> LW> Subject: Re: Composite jsp files
>
>
> >> With Struts logic:equal tag:
> >>
> >> <logic:equal ...><img src="..."></logic:equal>
> >>
> >> Check the doc for the various logic:equal options.
> >>
> >> Leonard Wolters wrote:
> >>
> >> >Is it possible to concatenate jsp files to one ?
> >> >
> >> >The problem i have now is that tomcat / catalina
> >> >is complaining when I write multiple times to
> >> >the outputstream. A nice: java.lang.IllegalStateException:
> >> >getOutputStream() has already been called for this response
> >> >is shown to me.
> >> >
> >> >
> >> >My question is if anyone know how to concat jsp files,
> >> >or to dymanically create jsp.
> >> >
> >> >
> >> >The problem is as follows: I have a certain jsp file which
> >> >may / may not show an image. Based on a particular
> >> >(custom made) tag an image should be shown or not.
> >> >In both cases, the rest of the page should remain the
> >> >same.
> >> >
> >> >Does anyone has tips / suggestions how to do this ????
> >> >
> >> >T.i.a.
> >> >
> >> >Leonard
> >> >
> >> >
> >>
> >>
> >> --
> >> Check it out: Map -> JavaBean
> >> http://dynclass.sourceforge.net/
> >>
> >>
> >>
> >>
> >> --
> >> To unsubscribe, e-mail:
> LW> <ma...@jakarta.apache.org>
> >> For additional commands, e-mail:
> LW> <ma...@jakarta.apache.org>
> >>
>
>
>
>
> LW> --
> LW> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> LW> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
>
>
> --
> Best regards,
>  Dariusz Wojtas         mailto:dwojtas@myrealbox.com
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Re[2]: Composite jsp files

Posted by Leonard Wolters <l....@chello.nl>.
Dariusz,

Someway, somehow, I get an error message
from struts or tomcat saying:
MAPPING configuration error for request URI

In my jsp i have:

<img src='/myImgServlet?imgId=<%= imgId %>'>

And my web.xml has the following mappings /
declarations:

<!-- Display Photo Servlet -->
 <servlet>
  <servlet-name>myImgServlet</servlet-name>
  <servlet-class>com.foobar.MyImgServlet</servlet-class>
 </servlet>

<!-- Display Photo Servlet Mapping -->
 <servlet-mapping>
      <servlet-name>myImgServlet</servlet-name>
      <url-pattern>/myImgServlet</url-pattern>
 </servlet-mapping>



Can someone help me out ?


----- Original Message -----
From: "Dariusz Wojtas" <dw...@myrealbox.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Wednesday, August 28, 2002 6:20 PM
Subject: Re[2]: Composite jsp files


> Maybe I misunderstood you, but ...
> Why can't you use the <img> tag?
> Image file isnot send in the same response that the jsp/html
> file is sent. Browser makes another call for the image
> after parsing the html code.
>
> Why don't you just print:
>     <img src='/myImgServlet?imgId=<%= imgId %>'>
> ?
> And it works perfectly with the <logic> tags mentioned below.
> There is also no need to change the response type in the middle of
> writing to your output stream, because it is completely different call.
> You just set it once.
> And it will be served by separate servlet (here '/myImgServlet').
>
> Dariusz Wojtas
>
> Wednesday, August 28, 2002, 5:44:40 PM, you wrote:
> LW> Thanks John &  Cliff (prior answer).
>
> LW> But john, unfortunately I can't use the img
> LW> src tag since the images are directly retrieved
> LW> from a database. It doesn't make sense to
> LW> first (temporarily) store the images and then
> LW> use the img source tag. Instead, I directly
> LW> print the images by using the
> LW> response.getOutputStream (or something similar)
> LW> and setting the contentType + writing the bytes.
>
> LW> Cliff helped me out by showing me the <include>
> LW> tags, which i think can be very usefull.
>
> LW> If this does not work, you will hear me scream ;)
>
> LW> Regards,
>
> LW> Leonard
>
> LW> ----- Original Message -----
> LW> From: "John Raley" <jb...@mindspring.com>
> LW> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> LW> Sent: Wednesday, August 28, 2002 4:23 PM
> LW> Subject: Re: Composite jsp files
>
>
> >> With Struts logic:equal tag:
> >>
> >> <logic:equal ...><img src="..."></logic:equal>
> >>
> >> Check the doc for the various logic:equal options.
> >>
> >> Leonard Wolters wrote:
> >>
> >> >Is it possible to concatenate jsp files to one ?
> >> >
> >> >The problem i have now is that tomcat / catalina
> >> >is complaining when I write multiple times to
> >> >the outputstream. A nice: java.lang.IllegalStateException:
> >> >getOutputStream() has already been called for this response
> >> >is shown to me.
> >> >
> >> >
> >> >My question is if anyone know how to concat jsp files,
> >> >or to dymanically create jsp.
> >> >
> >> >
> >> >The problem is as follows: I have a certain jsp file which
> >> >may / may not show an image. Based on a particular
> >> >(custom made) tag an image should be shown or not.
> >> >In both cases, the rest of the page should remain the
> >> >same.
> >> >
> >> >Does anyone has tips / suggestions how to do this ????
> >> >
> >> >T.i.a.
> >> >
> >> >Leonard
> >> >
> >> >
> >>
> >>
> >> --
> >> Check it out: Map -> JavaBean
> >> http://dynclass.sourceforge.net/
> >>
> >>
> >>
> >>
> >> --
> >> To unsubscribe, e-mail:
> LW> <ma...@jakarta.apache.org>
> >> For additional commands, e-mail:
> LW> <ma...@jakarta.apache.org>
> >>
>
>
>
>
> LW> --
> LW> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> LW> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
>
>
> --
> Best regards,
>  Dariusz Wojtas         mailto:dwojtas@myrealbox.com
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re[2]: Composite jsp files

Posted by Dariusz Wojtas <dw...@myrealbox.com>.
Maybe I misunderstood you, but ...
Why can't you use the <img> tag?
Image file isnot send in the same response that the jsp/html
file is sent. Browser makes another call for the image
after parsing the html code.

Why don't you just print:
    <img src='/myImgServlet?imgId=<%= imgId %>'>
?
And it works perfectly with the <logic> tags mentioned below.
There is also no need to change the response type in the middle of
writing to your output stream, because it is completely different call.
You just set it once.
And it will be served by separate servlet (here '/myImgServlet').

Dariusz Wojtas

Wednesday, August 28, 2002, 5:44:40 PM, you wrote:
LW> Thanks John &  Cliff (prior answer).

LW> But john, unfortunately I can't use the img
LW> src tag since the images are directly retrieved
LW> from a database. It doesn't make sense to
LW> first (temporarily) store the images and then
LW> use the img source tag. Instead, I directly
LW> print the images by using the
LW> response.getOutputStream (or something similar)
LW> and setting the contentType + writing the bytes.

LW> Cliff helped me out by showing me the <include>
LW> tags, which i think can be very usefull.

LW> If this does not work, you will hear me scream ;)

LW> Regards,

LW> Leonard

LW> ----- Original Message -----
LW> From: "John Raley" <jb...@mindspring.com>
LW> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
LW> Sent: Wednesday, August 28, 2002 4:23 PM
LW> Subject: Re: Composite jsp files


>> With Struts logic:equal tag:
>>
>> <logic:equal ...><img src="..."></logic:equal>
>>
>> Check the doc for the various logic:equal options.
>>
>> Leonard Wolters wrote:
>>
>> >Is it possible to concatenate jsp files to one ?
>> >
>> >The problem i have now is that tomcat / catalina
>> >is complaining when I write multiple times to
>> >the outputstream. A nice: java.lang.IllegalStateException:
>> >getOutputStream() has already been called for this response
>> >is shown to me.
>> >
>> >
>> >My question is if anyone know how to concat jsp files,
>> >or to dymanically create jsp.
>> >
>> >
>> >The problem is as follows: I have a certain jsp file which
>> >may / may not show an image. Based on a particular
>> >(custom made) tag an image should be shown or not.
>> >In both cases, the rest of the page should remain the
>> >same.
>> >
>> >Does anyone has tips / suggestions how to do this ????
>> >
>> >T.i.a.
>> >
>> >Leonard
>> >
>> >
>>
>>
>> --
>> Check it out: Map -> JavaBean
>> http://dynclass.sourceforge.net/
>>
>>
>>
>>
>> --
>> To unsubscribe, e-mail:
LW> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
LW> <ma...@jakarta.apache.org>
>>




LW> --
LW> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
LW> For additional commands, e-mail: <ma...@jakarta.apache.org>




-- 
Best regards,
 Dariusz Wojtas         mailto:dwojtas@myrealbox.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Composite jsp files

Posted by Leonard Wolters <l....@chello.nl>.
Thanks John &  Cliff (prior answer).

But john, unfortunately I can't use the img
src tag since the images are directly retrieved
from a database. It doesn't make sense to
first (temporarily) store the images and then
use the img source tag. Instead, I directly
print the images by using the
response.getOutputStream (or something similar)
and setting the contentType + writing the bytes.

Cliff helped me out by showing me the <include>
tags, which i think can be very usefull.

If this does not work, you will hear me scream ;)

Regards,

Leonard

----- Original Message -----
From: "John Raley" <jb...@mindspring.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Wednesday, August 28, 2002 4:23 PM
Subject: Re: Composite jsp files


> With Struts logic:equal tag:
>
> <logic:equal ...><img src="..."></logic:equal>
>
> Check the doc for the various logic:equal options.
>
> Leonard Wolters wrote:
>
> >Is it possible to concatenate jsp files to one ?
> >
> >The problem i have now is that tomcat / catalina
> >is complaining when I write multiple times to
> >the outputstream. A nice: java.lang.IllegalStateException:
> >getOutputStream() has already been called for this response
> >is shown to me.
> >
> >
> >My question is if anyone know how to concat jsp files,
> >or to dymanically create jsp.
> >
> >
> >The problem is as follows: I have a certain jsp file which
> >may / may not show an image. Based on a particular
> >(custom made) tag an image should be shown or not.
> >In both cases, the rest of the page should remain the
> >same.
> >
> >Does anyone has tips / suggestions how to do this ????
> >
> >T.i.a.
> >
> >Leonard
> >
> >
>
>
> --
> Check it out: Map -> JavaBean
> http://dynclass.sourceforge.net/
>
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Composite jsp files

Posted by John Raley <jb...@mindspring.com>.
With Struts logic:equal tag:

<logic:equal ...><img src="..."></logic:equal>

Check the doc for the various logic:equal options.

Leonard Wolters wrote:

>Is it possible to concatenate jsp files to one ?
>
>The problem i have now is that tomcat / catalina
>is complaining when I write multiple times to
>the outputstream. A nice: java.lang.IllegalStateException: 
>getOutputStream() has already been called for this response
>is shown to me.
>
>
>My question is if anyone know how to concat jsp files,
>or to dymanically create jsp.
>
>
>The problem is as follows: I have a certain jsp file which
>may / may not show an image. Based on a particular
>(custom made) tag an image should be shown or not. 
>In both cases, the rest of the page should remain the
>same.
>
>Does anyone has tips / suggestions how to do this ????
>
>T.i.a.
>
>Leonard
>  
>


-- 
Check it out: Map -> JavaBean
http://dynclass.sourceforge.net/




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Composite jsp files

Posted by Cliff Rowley <cl...@onsea.net>.
This was answered for someone else just today - check out the archives
for the responses.

On Wed, 2002-08-28 at 13:56, Leonard Wolters wrote:
> Is it possible to concatenate jsp files to one ?
> 
> The problem i have now is that tomcat / catalina
> is complaining when I write multiple times to
> the outputstream. A nice: java.lang.IllegalStateException: 
> getOutputStream() has already been called for this response
> is shown to me.
> 
> 
> My question is if anyone know how to concat jsp files,
> or to dymanically create jsp.
> 
> 
> The problem is as follows: I have a certain jsp file which
> may / may not show an image. Based on a particular
> (custom made) tag an image should be shown or not. 
> In both cases, the rest of the page should remain the
> same.
> 
> Does anyone has tips / suggestions how to do this ????
> 
> T.i.a.
> 
> Leonard
-- 

Regards

-------------------------------------------
 Cliff Rowley        |     cliff@onsea.net
 Software Engineer   |   www.doctype.co.uk
 +44 (0) 1206 514263 | www.cliffrowley.com
-------------------------------------------


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>