Win a copy of Practical SVG this week in the HTML/CSS/JavaScript 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
Posts: 65545
110
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
 
Bring me the box labeled "thinking cap" ... and then read this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!