This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes changing the context Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "changing the context" Watch "changing the context" New topic
Author

changing the context

Gajanan Kulkarni
Greenhorn

Joined: Dec 29, 2005
Posts: 11
Hi

I have a action say Action1 with context context1

http://localhost:9080/ApplicationContext/context1/Action1.do

i want to fw this action to Action2.do such that
http://localhost:9080/ApplicationContext/context2/Action2.do

I am writing

<forward name="success" path="context2/Action2.do"></forward>

Even though request is getting forwarded to required action, my window URL still shows
http://localhost:9080/ApplicationContext/context1/Action1.do

1. Hence when I see new page and I try to submit other actions from that page they are still considered as inside context1

can anybody elabodate on context chaging
Ravi Seshu
Ranch Hand

Joined: Mar 19, 2005
Posts: 38
Hi,
According to Action forward, what ever be the context it forwards to corresponding url / uri. so better check with code itself or use forwardaction just for this for forwrding to context2.

-eswar
Rajan Chinna
Ranch Hand

Joined: Jul 01, 2004
Posts: 320
can u try this

<forward name="success" path="context2/Action2.do" redirect="true" />
Gajanan Kulkarni
Greenhorn

Joined: Dec 29, 2005
Posts: 11
Thanks..But my problem is not fully solved.

From Action1 when I am forwarding to action2 , redirect=true doesnt work.
in action2 , while forwarding it to Action2.Jsp when I say redirect= true
my Browser URL changes to
http://localhost:9080/ApplicationContext/Context2/Action2.jsp


However while jsp rendering , it gives error because in JSP I have written it like
<html:form action="action2.do" >

It shows error saying Cannot retrieve mapping for action /Cannot retrieve mapping for action/action2

in form I have tried following things
action="action2.do"
action="context2/action2.do"
action="/action2.do"
action="../context2/action2.do"

none of them works

in my web.xml for context1 & 2 I am referring same struts-config-<moodulename>.xml

Any comments?

Txs in advance
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
Try action="context2/action2" or action="/context2/action2"

- Brent
Gajanan Kulkarni
Greenhorn

Joined: Dec 29, 2005
Posts: 11
in my web.xml
for config/module1 , i have struts-module1.xml
for config/module2 , i have struts-module2.xml

in one of the action associated with module1 I want to fw request to another action in module2

<forward name="riskAssessment" path="module2/module2Action.do" > </forward>

inside struts-module2.xml
I have action tag for module2Action

Q:
This arrangement works on websphere and server forwards request to module2Action.
However same doesnt works in weblogic...Any comments about this??
 
 
subject: changing the context
 
Similar Threads
Form beans values transferred to another form bean
Struts - Forwarding to another Servlet
How to forward to Action class
simple applet difficulties
Trouble with Struts