• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

By passing forward in action tag.

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I had declared 2 forwards in the same name. 1 in <action> tag and other in <global-forwards>. But at a certain context can I skip the forward in the <action> tag so that it forwards the page defined in <global-forwards>
Is there any way for that?


<global-forwards>
<forward name="searching" path="searching_common.jsp"/>
</global-forwards>


<action path="/myURL" scope="session" type="myAction">
<forward name="searching" path="/searching.jsp"/>
</action>
 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
When you have the forwards first struts will search in the <action> and if it doesnt find it there then it will look for global forwards.
In case you want to have the global forward, then you have to change the name of the forward path in your action, or omit it altogether.
<global-forwards>
<forward name="searching" path="searching_common.jsp"/>
</global-forwards>
<action path="/myURL" scope="session" type="myAction">
<forward name="searching_new" path="/searching.jsp"/>
</action>[/
 
Jose Mon
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is Ok, I know.
But I want to know is there any way to skip the forward in <action>
 
RoshaniG Gopal
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its simple. Dont use the forward in the action. It will pick from the global-forwards.
<global-forwards>
<forward name="searching" path="searching_common.jsp"/>
</global-forwards>

<action path="/myURL" scope="session" type="myAction">
</action>
 
Jose Mon
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That I know.
I asked that if the same forward is defined in <action> and <global-forward> and is there any way to by pass the forward in <action>

For an interview, the interviewer asked this. For that only I asked this.
 
Jose Mon
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible?
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, it's not possible. If you define forwards of the same name at both action level and global level, the one at the global level is inaccessible, since Struts will always pick the one at the action level.
 
Catch Ernie! Catch the egg! And catch this tiny ad too:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic