You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by red phoenix <ro...@gmail.com> on 2007/07/11 09:49:14 UTC

how to include struts by using
I want to use <jsp:include to load my struts file,such as:
   <jsp:include   page="/a1.do"   />
  <jsp:include   page="/a2.do"   />


but when I run this jsp file,http://localhost:8080/a.jsp,it raise
error,it shows it can't find a1.do and a2.do,but when I write follows in IE,
http://localhost:8080/a1.do, it can show right result.

I am puzzled with it.I wan to know if I don't use <jsp:include page?

How to include struts in JSP?

Thanks!

Re: how to include struts by using Posted by cksachdev <ck...@gmail.com>.
Just remove "/" thats it.
e.g.
           <jsp:forward page="index.do"></jsp:forward>


--

red phoenix-2 wrote:
> 
> I want to use <jsp:include to load my struts file,such as:
>    <jsp:include   page="/a1.do"   />
>   <jsp:include   page="/a2.do"   />
> 
> 
> but when I run this jsp file,http://localhost:8080/a.jsp,it raise
> error,it shows it can't find a1.do and a2.do,but when I write follows in
> IE,
> http://localhost:8080/a1.do, it can show right result.
> 
> I am puzzled with it.I wan to know if I don't use <jsp:include page?
> 
> How to include struts in JSP?
> 
> Thanks!
> 
> 

-- 
View this message in context: http://www.nabble.com/how-to-include-struts-by-using-%3Cjsp%3Ainclude-page-tf4060403.html#a11556035
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: how to include struts by using Posted by red phoenix <ro...@gmail.com>.
I tried with <c:import>,it still raise a question,I use Tomcat6,my directory
is follows:
C:\tomcat\webapps\struts2-blank-2.0.8

when I use visit
http://localhost:8080/struts2-blank-2.0.8/a.jsp <http://lo>
it raise following error:
The requested resource (/struts2-blank-2.0.8/example/HelloWorld.action) is
not available

But when I use
http://localhost:8080/struts2-blank-2.0.8/example/HelloWorld.action, it can
runs well.

My a.jsp file is follows:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<html>
<c:import url="/example/HelloWorld.action"/>
</html>

If I use absolute path,it can runs well,like follows:
<c:import url="
http://localhost:8080/struts2-blank-2.0.8/example/HelloWorld.action"/>

I only want to use relative path,not absolute path,I don't know why raise
above error,and how to correct it ?

Thanks



On 7/12/07, Michael Jouravlev <jm...@gmail.com> wrote:
>
> On 7/11/07, red phoenix <ro...@gmail.com> wrote:
> > I want to use <jsp:include to load my struts file,such as:
> >    <jsp:include   page="/a1.do"   />
> >   <jsp:include   page="/a2.do"   />
> >
> >
> > but when I run this jsp file,http://localhost:8080/a.jsp,it raise
> > error,it shows it can't find a1.do and a2.do,but when I write follows in
> IE,
> > http://localhost:8080/a1.do, it can show right result.
> >
> > I am puzzled with it.I wan to know if I don't use <jsp:include page?
> >
> > How to include struts in JSP?
>
> I just checked with Tomcat 6 and it worked for me. Seems that your
> Struts app is a root app for your servlet container, I just checked
> it. Can't help you more, sorry.
>
> Important: after you sort out the pathing/context issue, replace
> <jsp:include> with <c:import>, otherwise you may have problems
> including Struts-generated content -- usually a JSP page -- into
> another JSP page.
>
> Michael.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: how to include struts by using Posted by Michael Jouravlev <jm...@gmail.com>.
On 7/11/07, red phoenix <ro...@gmail.com> wrote:
> I want to use <jsp:include to load my struts file,such as:
>    <jsp:include   page="/a1.do"   />
>   <jsp:include   page="/a2.do"   />
>
>
> but when I run this jsp file,http://localhost:8080/a.jsp,it raise
> error,it shows it can't find a1.do and a2.do,but when I write follows in IE,
> http://localhost:8080/a1.do, it can show right result.
>
> I am puzzled with it.I wan to know if I don't use <jsp:include page?
>
> How to include struts in JSP?

I just checked with Tomcat 6 and it worked for me. Seems that your
Struts app is a root app for your servlet container, I just checked
it. Can't help you more, sorry.

Important: after you sort out the pathing/context issue, replace
<jsp:include> with <c:import>, otherwise you may have problems
including Struts-generated content -- usually a JSP page -- into
another JSP page.

Michael.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org