You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by wilson wong <ws...@yahoo.com> on 2005/08/23 23:07:18 UTC

Problem in action forwarding

Greeting

   Setup Win 2K , Tomcat 5.0.28 with struts 1.2.7

   Problem: Every action  being "forward to" always
execute the webapps/mycontext/index.jsp prior to the
action being invoked



Web.xml

<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>


 index.jsp

%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld"
prefix="logic" %>
<%
  System.out.println("------ MAIN INDEX.JSP ----");  
%>
<logic:redirect action="/enter"/>
    

struts-config.xml

<action   path="/enter" scope="request"
type="org.storeorder.store.catalog.action.EnterAction"
  validate="false">
      <forward name="sucess"
path="/catalog/catalog.jsp"    />
    </action>
<action    path="/storeinfo"   
forward="/catalog/aboutus.jsp"/>


in catalog.jsp

tr> 
     <td colspan="3" bgcolor="#D0DCEE"> <ul>
    <li class="PurpleBulletLinks"><strong><a
href="<%=request.getContextPath()%>/storeinfo.do">About
Us
      </a> </strong></li>


when I click on the  "About Us" 

this is what happen .... From the server log


DEBUG 15:19:20 ModuleUtils - Get module name for path
/storeinfo.do
DEBUG 15:19:20 ModuleUtils - Module name found:
default
DEBUG 15:19:20 RequestProcessor - Processing a 'GET'
for path '/storeinfo'
DEBUG 15:19:20 RequestProcessor -  Delegating via
forward to '/catalog/aboutus.jsp'
------ MAIN INDEX.JSP ----
DEBUG 15:19:20 ModuleUtils - Get module name for path
/enter.do
DEBUG 15:19:20 ModuleUtils - Module name found:
default
DEBUG 15:19:20 RequestProcessor - Processing a 'GET'
for path '/enter'
DEBUG 15:19:20 RequestProcessor -  Looking for Action
instance for class org.sto
reorder.store.catalog.action.EnterAction
DEBUG 15:19:20 RequestProcessor -   Returning existing
Action instance
Inside Enter Action
DEBUG 15:19:20 EnterAction -  EnterAction  - Exit 0
DEBUG 15:19:20 RequestProcessor -
processForwardConfig(ForwardConfig[name=sucess
,path=/catalog/catalog.jsp,redirect=false,contextRelative=false,module=null])


It seems to me it went back and execute the index.jsp
again  before execute /catalog/aboutus.jsp 

It happens in all other action, it always executes the
index.jsp from the context path first why ?

Any Clue ?

Thanks in advance



		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

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


Re: A forward problem

Posted by Martin Gainty <mg...@hotmail.com>.
>From what I can see you your alias could be incorrect in httpd.conf
notice the Alias, Redirect, Directory and Location assignments in this 
example
http://syger.com/jsc/docs/reader/jsp/environ.htm

*or your actions in your webapp are not defined correctly* in 
struts-config.xml
take a look at
http://struts.apache.org/faqs/newbie.html
Martin
----- Original Message ----- 
From: <ch...@kattare.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Tuesday, August 23, 2005 5:54 PM
Subject: A forward problem


> Hi,
>
>
> Frantically trying to get a client demo working for the morning and I
> feel like I ought to be able to work this out but I just can't.
>
> I've got a demo system (not) running on a URL on tomcat 5.5/Java 1.5
> with a file structure like
> myserver/mydomain_com/mydomain.com/ so until I get the domain stuff
> sorted out I can access via a url like
> http://www.myhost.com/mydomain.com/mydomain_com/login.do
>
> My login page works much like the struts mailreader application - I have
> an action path to <action path="/SubmitLogon" and the html form action
> is <html:form action="SubmitLogon>
>
> The browser gets sent this with an action path to
> /mydomain_com/SubmitLogon.do i.e. back up one directory on the file
> structure.    So what happens when the submit event fires is that it goes 
> to
> http://www.myhost.com/smydomain.com/SubmitLogon.do
> Thus giving me a 404 error.
>
> Is there anything quick and easy that can be done here to prevent this.
> I thought I could maybe set the <action path="/SubmitLogon" without the
> / (<action path="SubmitLogon" > but this errors with an "action path
> missing /" error message.
>
> Thanks in advance,
>
> Chum
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
> 

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


RE: A forward problem

Posted by "David G. Friedman" <hu...@ix.netcom.com>.
Chum,

Have you moved your webapp to the webapps/ROOT tomcat folder?
Also, do you have Tomcat directly on port 80 or are you using
Apache or a connector (mod_jk or mod_jk2) to send port 80 to 
your Tomcat instance?

Regards,
David


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


A forward problem

Posted by ch...@kattare.com.
Hi,


Frantically trying to get a client demo working for the morning and I
feel like I ought to be able to work this out but I just can't.

I've got a demo system (not) running on a URL on tomcat 5.5/Java 1.5
with a file structure like
myserver/mydomain_com/mydomain.com/ so until I get the domain stuff
sorted out I can access via a url like 
http://www.myhost.com/mydomain.com/mydomain_com/login.do

My login page works much like the struts mailreader application – I have
an action path to <action path="/SubmitLogon" and the html form action
is <html:form action="SubmitLogon>

The browser gets sent this with an action path to
/mydomain_com/SubmitLogon.do i.e. back up one directory on the file
structure.    So what happens when the submit event fires is that it goes to
http://www.myhost.com/smydomain.com/SubmitLogon.do
Thus giving me a 404 error.

Is there anything quick and easy that can be done here to prevent this.
 I thought I could maybe set the <action path="/SubmitLogon" without the
/ (<action path="SubmitLogon" > but this errors with an "action path
missing /" error message. 

Thanks in advance,

Chum


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


Re: Problem in action forwarding

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
On the surface at least, that seems to be how I would expect it to work...

I would think the tag renders as:

<img src="/" width="1" height="6">

...you might also see the context before that slash, I'm not sure... Since
you have defined a welcome page, and since this request would map to it,
it makes sense that the JSP would execute and you'd see the message in the
console as you do.  Being in an <img> tag too it makes sense that you
wouldn't have seen anything on the page to clue you in, except a broken
image icon, which is just subtle enough to easily miss :)

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Wed, August 24, 2005 3:19 pm, wilson wong said:
> Found my own problem
>
> In one of my include JSP
>   I have this html tag defined
> <html:img page="" width="1" height="6"/>
>
> This will trigger the Struts frmawork to execute
> contextpath/index.jsp if you have this
> <html:img page="" /> in your JSP page
> Wonder if this the way how struts work or this is a
> bug.
>
> --- wilson wong <ws...@yahoo.com> wrote:
>
>> Greeting
>>
>>    Setup Win 2K , Tomcat 5.0.28 with struts 1.2.7
>>
>>    Problem: Every action  being "forward to" always
>> execute the webapps/mycontext/index.jsp prior to the
>> action being invoked
>>
>>
>>
>> Web.xml
>>
>> <welcome-file-list>
>>     <welcome-file>index.jsp</welcome-file>
>>   </welcome-file-list>
>>
>>
>>  index.jsp
>>
>> %@ page language="java" %>
>> <%@ taglib uri="/WEB-INF/struts-logic.tld"
>> prefix="logic" %>
>> <%
>>   System.out.println("------ MAIN INDEX.JSP ----");
>>
>> %>
>> <logic:redirect action="/enter"/>
>>
>>
>> struts-config.xml
>>
>> <action   path="/enter" scope="request"
>>
> type="org.storeorder.store.catalog.action.EnterAction"
>>   validate="false">
>>       <forward name="sucess"
>> path="/catalog/catalog.jsp"    />
>>     </action>
>> <action    path="/storeinfo"
>> forward="/catalog/aboutus.jsp"/>
>>
>>
>> in catalog.jsp
>>
>> tr>
>>      <td colspan="3" bgcolor="#D0DCEE"> <ul>
>>     <li class="PurpleBulletLinks"><strong><a
>>
> href="<%=request.getContextPath()%>/storeinfo.do">About
>> Us
>>       </a> </strong></li>
>>
>>
>> when I click on the  "About Us"
>>
>> this is what happen .... From the server log
>>
>>
>> DEBUG 15:19:20 ModuleUtils - Get module name for
>> path
>> /storeinfo.do
>> DEBUG 15:19:20 ModuleUtils - Module name found:
>> default
>> DEBUG 15:19:20 RequestProcessor - Processing a 'GET'
>> for path '/storeinfo'
>> DEBUG 15:19:20 RequestProcessor -  Delegating via
>> forward to '/catalog/aboutus.jsp'
>> ------ MAIN INDEX.JSP ----
>> DEBUG 15:19:20 ModuleUtils - Get module name for
>> path
>> /enter.do
>> DEBUG 15:19:20 ModuleUtils - Module name found:
>> default
>> DEBUG 15:19:20 RequestProcessor - Processing a 'GET'
>> for path '/enter'
>> DEBUG 15:19:20 RequestProcessor -  Looking for
>> Action
>> instance for class org.sto
>> reorder.store.catalog.action.EnterAction
>> DEBUG 15:19:20 RequestProcessor -   Returning
>> existing
>> Action instance
>> Inside Enter Action
>> DEBUG 15:19:20 EnterAction -  EnterAction  - Exit 0
>> DEBUG 15:19:20 RequestProcessor -
>> processForwardConfig(ForwardConfig[name=sucess
>>
> ,path=/catalog/catalog.jsp,redirect=false,contextRelative=false,module=null])
>>
>>
>> It seems to me it went back and execute the
>> index.jsp
>> again  before execute /catalog/aboutus.jsp
>>
>> It happens in all other action, it always executes
>> the
>> index.jsp from the context path first why ?
>>
>> Any Clue ?
>>
>> Thanks in advance
>>
>>
>>
>>
>> ____________________________________________________
>> Start your day with Yahoo! - make it your home page
>> http://www.yahoo.com/r/hs
>>
>>
>>
> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> user-unsubscribe@struts.apache.org
>> For additional commands, e-mail:
>> user-help@struts.apache.org
>>
>>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


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


Re: Problem in action forwarding

Posted by wilson wong <ws...@yahoo.com>.
Found my own problem

In one of my include JSP 
  I have this html tag defined 
<html:img page="" width="1" height="6"/>

This will trigger the Struts frmawork to execute
contextpath/index.jsp if you have this 
<html:img page="" /> in your JSP page
Wonder if this the way how struts work or this is a
bug.

--- wilson wong <ws...@yahoo.com> wrote:

> Greeting
> 
>    Setup Win 2K , Tomcat 5.0.28 with struts 1.2.7
> 
>    Problem: Every action  being "forward to" always
> execute the webapps/mycontext/index.jsp prior to the
> action being invoked
> 
> 
> 
> Web.xml
> 
> <welcome-file-list>
>     <welcome-file>index.jsp</welcome-file>
>   </welcome-file-list>
> 
> 
>  index.jsp
> 
> %@ page language="java" %>
> <%@ taglib uri="/WEB-INF/struts-logic.tld"
> prefix="logic" %>
> <%
>   System.out.println("------ MAIN INDEX.JSP ----"); 
> 
> %>
> <logic:redirect action="/enter"/>
>     
> 
> struts-config.xml
> 
> <action   path="/enter" scope="request"
>
type="org.storeorder.store.catalog.action.EnterAction"
>   validate="false">
>       <forward name="sucess"
> path="/catalog/catalog.jsp"    />
>     </action>
> <action    path="/storeinfo"   
> forward="/catalog/aboutus.jsp"/>
> 
> 
> in catalog.jsp
> 
> tr> 
>      <td colspan="3" bgcolor="#D0DCEE"> <ul>
>     <li class="PurpleBulletLinks"><strong><a
>
href="<%=request.getContextPath()%>/storeinfo.do">About
> Us
>       </a> </strong></li>
> 
> 
> when I click on the  "About Us" 
> 
> this is what happen .... From the server log
> 
> 
> DEBUG 15:19:20 ModuleUtils - Get module name for
> path
> /storeinfo.do
> DEBUG 15:19:20 ModuleUtils - Module name found:
> default
> DEBUG 15:19:20 RequestProcessor - Processing a 'GET'
> for path '/storeinfo'
> DEBUG 15:19:20 RequestProcessor -  Delegating via
> forward to '/catalog/aboutus.jsp'
> ------ MAIN INDEX.JSP ----
> DEBUG 15:19:20 ModuleUtils - Get module name for
> path
> /enter.do
> DEBUG 15:19:20 ModuleUtils - Module name found:
> default
> DEBUG 15:19:20 RequestProcessor - Processing a 'GET'
> for path '/enter'
> DEBUG 15:19:20 RequestProcessor -  Looking for
> Action
> instance for class org.sto
> reorder.store.catalog.action.EnterAction
> DEBUG 15:19:20 RequestProcessor -   Returning
> existing
> Action instance
> Inside Enter Action
> DEBUG 15:19:20 EnterAction -  EnterAction  - Exit 0
> DEBUG 15:19:20 RequestProcessor -
> processForwardConfig(ForwardConfig[name=sucess
>
,path=/catalog/catalog.jsp,redirect=false,contextRelative=false,module=null])
> 
> 
> It seems to me it went back and execute the
> index.jsp
> again  before execute /catalog/aboutus.jsp 
> 
> It happens in all other action, it always executes
> the
> index.jsp from the context path first why ?
> 
> Any Clue ?
> 
> Thanks in advance
> 
> 
> 
> 		
> ____________________________________________________
> Start your day with Yahoo! - make it your home page 
> http://www.yahoo.com/r/hs 
>  
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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