• 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

Displaying servlet content in a jsp including images

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I have developed a servlet and it shows some reports (including images). Now I need to display the content of this servlet in a jsp and I am using <jsp:include page="/MyServlet"></jsp:include> to do so. I can see the full report if I run my servlet directly but when I run jsp, the images are missing. Please some one help me out in resolving this. Thanks in advance.

Regards,
Avinash V
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
why cant you move all display content to jsp rather than <jsp:include page="/MyServlet">? server is a controller, should not contain display/business logic in it directly.

and how you embedded images? show us the tag.
 
Sheriff
Posts: 67748
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The most likely cause of "broken" images is being sloppy with the URLs. See the JspFaq for information on properly addressing resources using server-relative URLs that begin weigh the context path.

And yes -- including servlet output in a JSP is a less-than-stellar practice.
 
Avinash venna
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually I am connecting to a remote server and getting a java melody report and writing it to a servlet. Now, I need to display this report on a liferay portlet where I can display it in a jsp. So I am including the servlet in portlet's view.jsp
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic