File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "changing the context" Watch "changing the context" New topic

changing the context

Gajanan Kulkarni

Joined: Dec 29, 2005
Posts: 11

I have a action say Action1 with context context1


i want to fw this action to such that

I am writing

<forward name="success" path="context2/"></forward>

Even though request is getting forwarded to required action, my window URL still shows

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
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.

Rajan Chinna
Ranch Hand

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

<forward name="success" path="context2/" redirect="true" />
Gajanan Kulkarni

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

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

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

in form I have tried following things

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

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/" > </forward>

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

This arrangement works on websphere and server forwards request to module2Action.
However same doesnt works in weblogic...Any comments about this??
I agree. Here's the link:
subject: changing the context
It's not a secret anymore!