Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is there a way to "Include" an action result or Servlet result in a base JSP page?

 
Nagesh Rachakonda
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a base JSP in which I need to include the content from the result of an action/servlet...

How I can accomplish this?

This is similar to the portal home (like my yahoo home page) where different gadgets sit in one home page... (is our goal)....

Thanks in advance for your help.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64692
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure. The include action (not directive) can reference any active resource in your web app.

But.... that's not a great way to do things in a JSP. A custom action (tag) would be much better suited.

What I do in cases like these is to factor out the common processing into a separat class that can be used either from a servlet or from a custom tag in a JSP without having to repeat any code.
[ September 29, 2006: Message edited by: Bear Bibeault ]
 
Nagesh Rachakonda
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are right!

Using JSTL's custom tags, we can achive this!

In the JSP place:

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

<c:import url="Action_NAME" context="WEB_CONTEXT"/>

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic