It's not a secret anymore!
The moose likes Servlets and the fly likes ReqDisptacher to forward/ include EXTERNAL content Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply 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: 71
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: 356
For forwording to another server page you can use,

sendRedirect method of HttpServletResponse


Thanks,
Shailesh
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 676


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: 71
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: 71
<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: 56192
    
  13

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


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Jeevan Sunkersett
Ranch Hand

Joined: Jul 03, 2007
Posts: 71
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: 676

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: 56192
    
  13

See the JSP FAQ for info on configuring the JSTL properly.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: ReqDisptacher to forward/ include EXTERNAL content
 
Similar Threads
Happy New Year! Welcome to our new forums!
IOStream
buffer size in page directive
Urgent -RequestDispatcher.include and forward
Read HTML/Source of external site page