Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7896031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:47:20+00:00 2026-06-03T07:47:20+00:00

I have been reading BalusC’s guide on how to use a seperate Servlet to

  • 0

I have been reading BalusC’s guide on how to use a seperate Servlet to attach a byte[] representation of an Image to an HttpServlet response via a BufferedOutputStream, and appreciate that this is neccessary because an HTML Img tag refers to a URL / cannot accept a stream of bytes.

http://balusc.blogspot.co.uk/2007/04/imageservlet.html

The problem I am having with adapting BalusC’s example is that I use Spring and Spring Data JPA behind JSF, so my ImageDAO is actually a Spring Data JPA Repository that is behind a different Servlet (the JSF Servlet).

Is there any way that I can get a handle to the ImageRepository which is curated by my Spring container behind the JSF Servlet?

I anticipate that this is a common stumbling block for those using IoC for their applications and resorting to writing a seperate Servlet to appease the needs of the HTML Img tag. Writing a seperate Servlet and trying to get a handle to another feels like an appeasment of design / a dirty hack!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:47:21+00:00Added an answer on June 3, 2026 at 7:47 am

    The two magic lines appear to be:

    WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
        yourRepository = (YourRepository) context.getBean("yourRepository");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been reading up on this, and it seems that if you use
I have been reading that Apple recommends to use block-based animations instead of CATransaction
I have been reading Beginners guide for oracle DB. The definition for precision and
Have been reading about async and tasks and been attempting to convert the CopyFileEx
i have been reading this interesting article which is increasing my every growing confusion
I have been reading up on multiple PHP frameworks, especially the Zend Framework but
I have been reading the docs and playing with different EventQuery parameters for days
I have been reading over some code lately and came across some lines such
I have been reading through this wonderful website regarding the recommended Python IDEs and
I have been reading about collision detection in games on stackoverflow and other sites.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.