File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Displaying servlet content in a jsp including images

 
Avinash venna
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic