aspose file tools
The moose likes JSP and the fly likes Is there a way to Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Is there a way to "Include" an action result or Servlet result in a base JSP page?" Watch "Is there a way to "Include" an action result or Servlet result in a base JSP page?" New topic
Author

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

Nagesh Rachakonda
Ranch Hand

Joined: Dec 04, 2003
Posts: 34
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

Joined: Jan 10, 2002
Posts: 56224
    
  13

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 ]

[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Nagesh Rachakonda
Ranch Hand

Joined: Dec 04, 2003
Posts: 34
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
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Is there a way to "Include" an action result or Servlet result in a base JSP page?
 
Similar Threads
constant content in jsp
include - directive and action
how to invoke
Call a struts action from JSP page
include action tag in JSP