You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by madan chowdary <ma...@yahoo.com> on 2007/02/19 11:51:12 UTC
[ Tobago ] Invoke Servlet from jsp page
Hi All,
I have a situation that i need to invoke a servlet which is used to write a image to the page.
The image will be retrieved from the database as blob object and then converted to byte[].
now i need to display this image in my page.
This could probably done with help of a servlet.
i need to invoke a servlet with a URL which has an id appened to that URL.
The ordinary JSP code looks like this,
<IMG src="DownloadBinaryServlet?id=<%=groupBox.getImageId()%>
The servlet code is as such
OutputStream out = response.getOutputStream();
out.write( groupBox.getImageBytes() );
out.close();
But this piece of code does not work in Tobago pages, as <% %> scriplets are not allowed.
I need to frame the URL with value ID set to the parameter as above and invoke the servlet .
How can i achieve this task .. Any suggestions ?
Thnx in advance
Regards
Madan
__________________________________________________________
Yahoo! India Answers: Share what you know. Learn something new
http://in.answers.yahoo.com/
Re: [ Tobago ] Invoke Servlet from jsp page
Posted by David Delbecq <de...@oma.be>.
Sorry, bad cut and paste of your code, it should be, of course,
<h:graphicImage id="image"
alt="image"
url="/DownloadBinaryServlet?id=#{groupBox.imageId}">
</h:graphicImage>
En l'instant précis du 02/19/07 11:58, David Delbecq s'exprimait en ces
termes:
> EL expression should do the work:
>
> <h:graphicImage id="image"
> alt="image"
> url="/DownloadBinaryServlet?id=#{groupBox.getImageId()}">
> </h:graphicImage>
>
>
> En l'instant précis du 02/19/07 11:51, madan chowdary s'exprimait en ces
> termes:
>
>> Hi All,
>>
>> I have a situation that i need to invoke a servlet which is used to
>> write a image to the page.
>>
>> The image will be retrieved from the database as blob object and then
>> converted to byte[].
>>
>> now i need to display this image in my page.
>>
>> This could probably done with help of a servlet.
>>
>> i need to invoke a servlet with a URL which has an id appened to that URL.
>>
>> The ordinary JSP code looks like this,
>>
>> <IMG src="DownloadBinaryServlet?id=<%=groupBox.getImageId()%>
>>
>> The servlet code is as such
>>
>> OutputStream out = response.getOutputStream();
>> out.write( groupBox.getImageBytes() );
>> out.close();
>>
>> But this piece of code does not work in Tobago pages, as <% %>
>> scriplets are not allowed.
>>
>> I need to frame the URL with value ID set to the parameter as above
>> and invoke the servlet .
>>
>> How can i achieve this task .. Any suggestions ?
>>
>> Thnx in advance
>>
>> Regards
>> Madan
>>
>>
>>
>> ------------------------------------------------------------------------
>> Here’s a new way to find what you're looking for - Yahoo! Answers
>> <http://us.rd.yahoo.com/mail/in/yanswers/*http://in.answers.yahoo.com/>
>>
>
>
Re: [ Tobago ] Invoke Servlet from jsp page
Posted by David Delbecq <de...@oma.be>.
EL expression should do the work:
<h:graphicImage id="image"
alt="image"
url="/DownloadBinaryServlet?id=#{groupBox.getImageId()}">
</h:graphicImage>
En l'instant précis du 02/19/07 11:51, madan chowdary s'exprimait en ces
termes:
> Hi All,
>
> I have a situation that i need to invoke a servlet which is used to
> write a image to the page.
>
> The image will be retrieved from the database as blob object and then
> converted to byte[].
>
> now i need to display this image in my page.
>
> This could probably done with help of a servlet.
>
> i need to invoke a servlet with a URL which has an id appened to that URL.
>
> The ordinary JSP code looks like this,
>
> <IMG src="DownloadBinaryServlet?id=<%=groupBox.getImageId()%>
>
> The servlet code is as such
>
> OutputStream out = response.getOutputStream();
> out.write( groupBox.getImageBytes() );
> out.close();
>
> But this piece of code does not work in Tobago pages, as <% %>
> scriplets are not allowed.
>
> I need to frame the URL with value ID set to the parameter as above
> and invoke the servlet .
>
> How can i achieve this task .. Any suggestions ?
>
> Thnx in advance
>
> Regards
> Madan
>
>
>
> ------------------------------------------------------------------------
> Here’s a new way to find what you're looking for - Yahoo! Answers
> <http://us.rd.yahoo.com/mail/in/yanswers/*http://in.answers.yahoo.com/>