You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Naveen Gaurav <ga...@rediffmail.com> on 2002/10/02 10:18:56 UTC

How to map the jsp files in different folder with the ActionServlet!!


On Wed, 02 Oct 2002 Naveen  Gaurav wrote :
>
>Hi everyone,
>
>When i am putting my .jsp file in the root directory and setting 
>the struts-config.xml file for the same... everything seems to be 
>fine..(the root directory is as 
>C:\jakarta-tomcat-3.2.3\webapps\struts) and the server.xml shows 
>the entry as
>
>       <Context path="/struts"
>                  docBase="webapps/struts"
>                  crossContext="false"
>                  debug="0"
>                  reloadable="true" >
>         </Context>
>
>So far so good.
>
>But this is not the way i will manage my files.. so i created 
>another folder in the root directory (JSP) as 
>C:\jakarta-tomcat-3.2.3\webapps\struts\JSP and placed all my jsp 
>files there.
>
>The first page is being shown perfectly but the forward is not 
>working.. actually it is not able to find the .do mapping..
>Error message is The page cannot be displayed. " 
>http://localhost:8080/struts/JSP/searchContacts.do "
>
>The various settings are as under.
>The server.xml is as above.
>The struts-config.xml is as under....
>
> 	<action    path="/searchContacts"
>                
>type="org.apache.struts.webapp.example.SearchContactsAction"
>                name="SearchContactsForm"
>                scope="request"
>                validate="false"
> 	   input="/searchContacts.jsp">
>               <forward name="List"              
>path="/ListContacts.jsp"/>
>            </action
>
> 	<form-bean      name="SearchContactsForm"
>                     
>type="org.apache.struts.webapp.example.SearchContactsForm"/>
>
>And in the First Jsp from where i am calling another jsp this is 
>the desc.
>
> 	<form name = "foMessagePage" action="searchContacts.do" 
>focus="companyName" METHOD="post">
>
>Please help me.
>
>Thanks in advance.
>
>regards,
>Naveen
>
>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to map the jsp files in different folder with the ActionServlet!!

Posted by Ashish Kulkarni <ku...@yahoo.com>.
Hi,
I have a same question , regarding relative path of
action mapping,
say i have a jsp called signout.jsp, which has a
submit button, the jsp is in folder pages, so my
action mapping will be like below
<action path="/pages/signout"
type="com.myapp.action.SignoutAction" scope="request">
<forward name="success" path="/pages/signout.jsp"
redirect="false" />
</action>
 and my signout.jsp will have a form defined like
below
<html:form action="signout.do" >

the problem i am having is, if i include this
signout.jsp in all the jsp's in folder pages, it works
fine, but if i include it in jsp's which are in folder
mypages , which is a subfolder of pages, it does not
work,
so how do i work around it
Ashish


--- "C. Struts" <st...@cmbsystems.com> wrote:
> I can't see as far back as the begining of this
> thread but just in case...
> 
> Make sure your web.xml contains the following:
> 
> ---------------- begin ------------------------
> <?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE
> web-app  PUBLIC "-//Sun
> Microsystems, Inc.//DTD Web Application 2.2//EN"
>
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd"><web-app>
> 
>   <!-- Standard Action Servlet Configuration (with
> debugging) -->
>   <servlet>
>     <servlet-name>action</servlet-name>
>    
>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
>     <init-param>
>       <param-name>config</param-name>
>      
>
<param-value>/WEB-INF/struts-config.xml</param-value>
>     </init-param>
>     <init-param>
>       <param-name>debug</param-name>
>       <param-value>0</param-value>
>     </init-param>
>     <init-param>
>       <param-name>detail</param-name>
>       <param-value>0</param-value>
>     </init-param>
>     <init-param>
>       <param-name>validate</param-name>
>       <param-value>true</param-value>
>     </init-param>
>     <init-param>
>       <param-name>application</param-name>
>      
> <param-value>ApplicationResources</param-value>
>     </init-param>
>       <load-on-startup>2</load-on-startup>
>   </servlet>
> 
>   <!-- Standard Action Servlet Mapping -->
>   <servlet-mapping>
>     <servlet-name>action</servlet-name>
>     <url-pattern>/do/*</url-pattern><!-- here is
> where you map your
> action -->
>   </servlet-mapping>
> 
>   <!-- Welcome File List -->
>   <welcome-file-list>
>     <welcome-file>/jsp/index.jsp</welcome-file>
>   </welcome-file-list>
> 
>   <!-- Struts Tag Library Descriptors -->
>   <!-- your tag libs here -->
> ----------------- end -------------------------
> 
> 
> 
> 10 lines from the bottom is where I map my actions
> as /do/something, so my
> url looks like
> http://localhost:8080/appName/do/someAction -- you
> can alter
> it to work for you.
> 
> Also, when you link (as in "a href") to an action,
> do not use the /do,
> instead just point to "someAction" -- i.e. <a
> href="makePayment">Click here
> to pay by credit card</a>
> 
> 
> 
> 
> ----- Original Message -----
> From: "Naveen Gaurav" <ng...@cisco.com>
> To: "'Struts Users Mailing List'"
> <st...@jakarta.apache.org>
> Sent: Wednesday, October 02, 2002 4:46 AM
> Subject: RE: How to map the jsp files in different
> folder with the
> ActionServlet!!
> 
> 
> > i even tried doing like that but its not coming!!!
> >
> > Regards,
> > naveen
> >
> > -----Original Message-----
> > From: Miguel Angel Mulero Martinez
> > [mailto:miguel-angel.mulero@mad.tecsidel.es]
> > Sent: Wednesday, October 02, 2002 1:52 PM
> > To: Struts Users Mailing List; Naveen Gaurav
> > Subject: RE: How to map the jsp files in different
> folder with the
> > ActionServlet!!
> >
> >
> > The action is allway mapped to /XXXXXXX.do, so you
> must call it like this,
> > not like /JSP/XXXXXXXX.do.
> >
> > If you want the second way, you can do:
> >
> >       <action    path="/JSP/searchContacts"
> >
> >
>
type="org.apache.struts.webapp.example.SearchContactsAction"
> >                 name="SearchContactsForm"
> >                 scope="request"
> >                 validate="false"
> >           input="/searchContacts.jsp">
> >                <forward name="List"
> > path="/ListContacts.jsp"/>
> >             </action>
> >
> > Regards,
> > Miguel
> >
> > -----Mensaje original-----
> > De: Naveen Gaurav
> [mailto:gauravnaveen@rediffmail.com]
> > Enviado el: mi�rcoles, 02 de octubre de 2002 10:19
> > Para: struts-user@jakarta.apache.org
> > Asunto: How to map the jsp files in different
> folder with the
> > ActionServlet!!
> >
> >
> > On Wed, 02 Oct 2002 Naveen  Gaurav wrote :
> > >
> > >Hi everyone,
> > >
> > >When i am putting my .jsp file in the root
> directory and setting
> > >the struts-config.xml file for the same...
> everything seems to be
> > >fine..(the root directory is as
> > >C:\jakarta-tomcat-3.2.3\webapps\struts) and the
> server.xml shows
> > >the entry as
> > >
> > >       <Context path="/struts"
> > >                  docBase="webapps/struts"
> > >                  crossContext="false"
> > >                  debug="0"
> > >                  reloadable="true" >
> > >         </Context>
> > >
> > >So far so good.
> > >
> > >But this is not the way i will manage my files..
> so i created
> > >another folder in the root directory (JSP) as
> > >C:\jakarta-tomcat-3.2.3\webapps\struts\JSP and
> placed all my jsp
> > >files there.
> > >
> > >The first page is being shown perfectly but the
> forward is not
> > >working.. actually it is not able to find the .do
> mapping..
> > >Error message is The page cannot be displayed. "
> >
> >http://localhost:8080/struts/JSP/searchContacts.do
> "
> > >
> > >The various settings are as under.
> > >The server.xml is as above.
> > >The struts-config.xml is as under....
> > >
> > >       <action    path="/searchContacts"
> > >
> >
>
>type="org.apache.struts.webapp.example.SearchContactsAction"
> > >                name="SearchContactsForm"
> > >                scope="request"
> > >                validate="false"
> > >          input="/searchContacts.jsp">
> > >               <forward name="List"
> > >path="/ListContacts.jsp"/>
> > >            </action
> > >
> > >       <form-bean      name="SearchContactsForm"
> > >
> >
>
>type="org.apache.struts.webapp.example.SearchContactsForm"/>
> > >
> > >And in the First Jsp from where i am calling
> another jsp this is
> > >the desc.
> > >
> > >       <form name = "foMessagePage"
> action="searchContacts.do"
> > >focus="companyName" METHOD="post">
> > >
> > >Please help me.
> > >
> > >Thanks in advance.
> > >
> > >regards,
> > >Naveen
> > >
> > >
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> >
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> >
> > --
> > To unsubscribe, e-mail:
> >
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
> >
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


=====
A$HI$H

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to map the jsp files in different folder with the ActionServlet!!

Posted by "C. Struts" <st...@cmbsystems.com>.
I can't see as far back as the begining of this thread but just in case...

Make sure your web.xml contains the following:

---------------- begin ------------------------
<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE web-app  PUBLIC "-//Sun
Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd"><web-app>

  <!-- Standard Action Servlet Configuration (with debugging) -->
  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>0</param-value>
    </init-param>
    <init-param>
      <param-name>detail</param-name>
      <param-value>0</param-value>
    </init-param>
    <init-param>
      <param-name>validate</param-name>
      <param-value>true</param-value>
    </init-param>
    <init-param>
      <param-name>application</param-name>
      <param-value>ApplicationResources</param-value>
    </init-param>
      <load-on-startup>2</load-on-startup>
  </servlet>

  <!-- Standard Action Servlet Mapping -->
  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>/do/*</url-pattern><!-- here is where you map your
action -->
  </servlet-mapping>

  <!-- Welcome File List -->
  <welcome-file-list>
    <welcome-file>/jsp/index.jsp</welcome-file>
  </welcome-file-list>

  <!-- Struts Tag Library Descriptors -->
  <!-- your tag libs here -->
----------------- end -------------------------



10 lines from the bottom is where I map my actions as /do/something, so my
url looks like http://localhost:8080/appName/do/someAction -- you can alter
it to work for you.

Also, when you link (as in "a href") to an action, do not use the /do,
instead just point to "someAction" -- i.e. <a href="makePayment">Click here
to pay by credit card</a>




----- Original Message -----
From: "Naveen Gaurav" <ng...@cisco.com>
To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
Sent: Wednesday, October 02, 2002 4:46 AM
Subject: RE: How to map the jsp files in different folder with the
ActionServlet!!


> i even tried doing like that but its not coming!!!
>
> Regards,
> naveen
>
> -----Original Message-----
> From: Miguel Angel Mulero Martinez
> [mailto:miguel-angel.mulero@mad.tecsidel.es]
> Sent: Wednesday, October 02, 2002 1:52 PM
> To: Struts Users Mailing List; Naveen Gaurav
> Subject: RE: How to map the jsp files in different folder with the
> ActionServlet!!
>
>
> The action is allway mapped to /XXXXXXX.do, so you must call it like this,
> not like /JSP/XXXXXXXX.do.
>
> If you want the second way, you can do:
>
>       <action    path="/JSP/searchContacts"
>
> type="org.apache.struts.webapp.example.SearchContactsAction"
>                 name="SearchContactsForm"
>                 scope="request"
>                 validate="false"
>           input="/searchContacts.jsp">
>                <forward name="List"
> path="/ListContacts.jsp"/>
>             </action>
>
> Regards,
> Miguel
>
> -----Mensaje original-----
> De: Naveen Gaurav [mailto:gauravnaveen@rediffmail.com]
> Enviado el: miércoles, 02 de octubre de 2002 10:19
> Para: struts-user@jakarta.apache.org
> Asunto: How to map the jsp files in different folder with the
> ActionServlet!!
>
>
> On Wed, 02 Oct 2002 Naveen  Gaurav wrote :
> >
> >Hi everyone,
> >
> >When i am putting my .jsp file in the root directory and setting
> >the struts-config.xml file for the same... everything seems to be
> >fine..(the root directory is as
> >C:\jakarta-tomcat-3.2.3\webapps\struts) and the server.xml shows
> >the entry as
> >
> >       <Context path="/struts"
> >                  docBase="webapps/struts"
> >                  crossContext="false"
> >                  debug="0"
> >                  reloadable="true" >
> >         </Context>
> >
> >So far so good.
> >
> >But this is not the way i will manage my files.. so i created
> >another folder in the root directory (JSP) as
> >C:\jakarta-tomcat-3.2.3\webapps\struts\JSP and placed all my jsp
> >files there.
> >
> >The first page is being shown perfectly but the forward is not
> >working.. actually it is not able to find the .do mapping..
> >Error message is The page cannot be displayed. "
> >http://localhost:8080/struts/JSP/searchContacts.do "
> >
> >The various settings are as under.
> >The server.xml is as above.
> >The struts-config.xml is as under....
> >
> >       <action    path="/searchContacts"
> >
> >type="org.apache.struts.webapp.example.SearchContactsAction"
> >                name="SearchContactsForm"
> >                scope="request"
> >                validate="false"
> >          input="/searchContacts.jsp">
> >               <forward name="List"
> >path="/ListContacts.jsp"/>
> >            </action
> >
> >       <form-bean      name="SearchContactsForm"
> >
> >type="org.apache.struts.webapp.example.SearchContactsForm"/>
> >
> >And in the First Jsp from where i am calling another jsp this is
> >the desc.
> >
> >       <form name = "foMessagePage" action="searchContacts.do"
> >focus="companyName" METHOD="post">
> >
> >Please help me.
> >
> >Thanks in advance.
> >
> >regards,
> >Naveen
> >
> >
>
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: How to map the jsp files in different folder with the ActionServlet!!

Posted by Naveen Gaurav <ng...@cisco.com>.
i even tried doing like that but its not coming!!!

Regards,
naveen

-----Original Message-----
From: Miguel Angel Mulero Martinez
[mailto:miguel-angel.mulero@mad.tecsidel.es]
Sent: Wednesday, October 02, 2002 1:52 PM
To: Struts Users Mailing List; Naveen Gaurav
Subject: RE: How to map the jsp files in different folder with the
ActionServlet!!


The action is allway mapped to /XXXXXXX.do, so you must call it like this,
not like /JSP/XXXXXXXX.do.

If you want the second way, you can do:

      <action    path="/JSP/searchContacts"

type="org.apache.struts.webapp.example.SearchContactsAction"
                name="SearchContactsForm"
                scope="request"
                validate="false"
          input="/searchContacts.jsp">
               <forward name="List"
path="/ListContacts.jsp"/>
            </action>

Regards,
Miguel

-----Mensaje original-----
De: Naveen Gaurav [mailto:gauravnaveen@rediffmail.com]
Enviado el: miércoles, 02 de octubre de 2002 10:19
Para: struts-user@jakarta.apache.org
Asunto: How to map the jsp files in different folder with the
ActionServlet!!


On Wed, 02 Oct 2002 Naveen  Gaurav wrote :
>
>Hi everyone,
>
>When i am putting my .jsp file in the root directory and setting
>the struts-config.xml file for the same... everything seems to be
>fine..(the root directory is as
>C:\jakarta-tomcat-3.2.3\webapps\struts) and the server.xml shows
>the entry as
>
>       <Context path="/struts"
>                  docBase="webapps/struts"
>                  crossContext="false"
>                  debug="0"
>                  reloadable="true" >
>         </Context>
>
>So far so good.
>
>But this is not the way i will manage my files.. so i created
>another folder in the root directory (JSP) as
>C:\jakarta-tomcat-3.2.3\webapps\struts\JSP and placed all my jsp
>files there.
>
>The first page is being shown perfectly but the forward is not
>working.. actually it is not able to find the .do mapping..
>Error message is The page cannot be displayed. "
>http://localhost:8080/struts/JSP/searchContacts.do "
>
>The various settings are as under.
>The server.xml is as above.
>The struts-config.xml is as under....
>
>       <action    path="/searchContacts"
>
>type="org.apache.struts.webapp.example.SearchContactsAction"
>                name="SearchContactsForm"
>                scope="request"
>                validate="false"
>          input="/searchContacts.jsp">
>               <forward name="List"
>path="/ListContacts.jsp"/>
>            </action
>
>       <form-bean      name="SearchContactsForm"
>
>type="org.apache.struts.webapp.example.SearchContactsForm"/>
>
>And in the First Jsp from where i am calling another jsp this is
>the desc.
>
>       <form name = "foMessagePage" action="searchContacts.do"
>focus="companyName" METHOD="post">
>
>Please help me.
>
>Thanks in advance.
>
>regards,
>Naveen
>
>




--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: How to map the jsp files in different folder with the ActionServlet!!

Posted by Miguel Angel Mulero Martinez <mi...@mad.tecsidel.es>.
The action is allway mapped to /XXXXXXX.do, so you must call it like this,
not like /JSP/XXXXXXXX.do.

If you want the second way, you can do:

      <action    path="/JSP/searchContacts"

type="org.apache.struts.webapp.example.SearchContactsAction"
                name="SearchContactsForm"
                scope="request"
                validate="false"
          input="/searchContacts.jsp">
               <forward name="List"
path="/ListContacts.jsp"/>
            </action>

Regards,
Miguel

-----Mensaje original-----
De: Naveen Gaurav [mailto:gauravnaveen@rediffmail.com]
Enviado el: miércoles, 02 de octubre de 2002 10:19
Para: struts-user@jakarta.apache.org
Asunto: How to map the jsp files in different folder with the
ActionServlet!!


On Wed, 02 Oct 2002 Naveen  Gaurav wrote :
>
>Hi everyone,
>
>When i am putting my .jsp file in the root directory and setting
>the struts-config.xml file for the same... everything seems to be
>fine..(the root directory is as
>C:\jakarta-tomcat-3.2.3\webapps\struts) and the server.xml shows
>the entry as
>
>       <Context path="/struts"
>                  docBase="webapps/struts"
>                  crossContext="false"
>                  debug="0"
>                  reloadable="true" >
>         </Context>
>
>So far so good.
>
>But this is not the way i will manage my files.. so i created
>another folder in the root directory (JSP) as
>C:\jakarta-tomcat-3.2.3\webapps\struts\JSP and placed all my jsp
>files there.
>
>The first page is being shown perfectly but the forward is not
>working.. actually it is not able to find the .do mapping..
>Error message is The page cannot be displayed. "
>http://localhost:8080/struts/JSP/searchContacts.do "
>
>The various settings are as under.
>The server.xml is as above.
>The struts-config.xml is as under....
>
>       <action    path="/searchContacts"
>
>type="org.apache.struts.webapp.example.SearchContactsAction"
>                name="SearchContactsForm"
>                scope="request"
>                validate="false"
>          input="/searchContacts.jsp">
>               <forward name="List"
>path="/ListContacts.jsp"/>
>            </action
>
>       <form-bean      name="SearchContactsForm"
>
>type="org.apache.struts.webapp.example.SearchContactsForm"/>
>
>And in the First Jsp from where i am calling another jsp this is
>the desc.
>
>       <form name = "foMessagePage" action="searchContacts.do"
>focus="companyName" METHOD="post">
>
>Please help me.
>
>Thanks in advance.
>
>regards,
>Naveen
>
>




--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>