wood burning stoves 2.0*
The moose likes Servlets and the fly likes ReqDisptacher to forward/ include EXTERNAL content Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "ReqDisptacher to forward/ include EXTERNAL content" Watch "ReqDisptacher to forward/ include EXTERNAL content" New topic
Author

ReqDisptacher to forward/ include EXTERNAL content

Jeevan Sunkersett
Ranch Hand

Joined: Jul 03, 2007
Posts: 77
Hi,

With the RequestDispatcher Interface using the method;

forward(ServletRequest request, ServletResponse response) and/ or include()

one can Forwards/ Include another resource on the same server.

How to include/ forward EXTERNAL content?

I mean on, say, http://alpha-beta.com/index.jsp in want content from http://ww.microsoft.com/somePage.jsp


~g1
Shailesh Narkhede
Ranch Hand

Joined: Jul 10, 2008
Posts: 368
For forwording to another server page you can use,

sendRedirect method of HttpServletResponse


Thanks,
Shailesh
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 684


Hi,

If you want to forward request to another application then I think you have to use JSTL <c:import ... />



Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
Jeevan Sunkersett
Ranch Hand

Joined: Jul 03, 2007
Posts: 77
Thank you Nishan,

Yes I think I need to use <c:import

Found an example http://www.roseindia.net/jsp/simple-jsp-example/JSTLImportDate.shtml

~g1
Jeevan Sunkersett
Ranch Hand

Joined: Jul 03, 2007
Posts: 77
<c:import, I think it works but not sure ..... I think I am missing some jar files? can anobody help?

org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:50)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:114)
org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:316)
org.apache.jasper.compiler.TagLibraryInfoImpl.><init>(TagLibraryInfoImpl.java:147)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:423)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:492)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1552)
org.apache.jasper.compiler.Parser.parse(Parser.java:126)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:155)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:688)

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

Where did you place the JSTL jar file? Which version are you trying to use, and what container are you using?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jeevan Sunkersett
Ranch Hand

Joined: Jul 03, 2007
Posts: 77
Hi Bear Bibeault,

Mine is just a standard HelloWorld servlet application running inside Geronimo.
I just have a redirect.jsp which uses <c:import inside the \WebContent folder (along side index.jsp)

I do not know which JSTL jar to include ... can you tell me please?

~g1>
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 684

Hi,

Check your build path and check weather your JSTL core lid available or not... And if you are using J2EE 1.5 version then it is already present at your build path. But If version lower than 1.5 you have to add jar your lib folder and configure to build path...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

See the JSP FAQ for info on configuring the JSTL properly.
 
Don't get me started about those stupid light bulbs.
 
subject: ReqDisptacher to forward/ include EXTERNAL content