• 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
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

context and action classes

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
Can anyone please reply to a small problem that i've got.
How can i reference a JSP in B.war from a my struts application A.war?
Is it possible to do it either through forward tag in struts-config.xml or in the action class where we use requestDispatcher().
If we're going to use requestDispatch(), how can i get the "servlet context" of the B.war.
please help.
venkat
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://jakarta.apache.org/struts/userGuide/configuration.html
To quote,


There are two basic methods to switching from one module to another. You can either use a forward (global or local) and specify the contextRelative attribute with a value of true, or you can use the built-in org.apache.struts.actions.SwitchAction.
Here's an example of a global forward:

...
<struts-config>
...
<global-forwards>
<forward name="toModuleB"
contextRelative="true"
path="/moduleB/index.do"
redirect="true"/>
...
</global-forwards>
...
</struts-config>

 
venkata kadiyala
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Marc for your suggestion. I looked into the document and made the appropriate changes but to my misery it still didnt work.
Let me explain to you through an example so that you can provide me with some suggestion of what I'm doing wrong here.
I've this "testweb" and "changepass" modules in my WSAD. Both are different web-apps but run on the same server WAS5.0
Now in the "testweb" module when the forward is "success", it has to get redirected to "changepass.do" but thats not happening. The browser is returning me with an error
"Invalid path"
My struts config file for "testweb" module is as shown below:
<forward name="success"
contextRelative="true"
path="/ChangePasswordWeb/changepass.do"
redirect="true"/>
Can you provide me with any suggestions??
Thanks for your help
venkat
 
venkata kadiyala
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry to trouble you guys I think I solved that.
But theres one tiny problem
I want to send the request object of "testweb" to the "changepass" web module.
But the problem is i'm getting the value of this as null.
Is there are specific way pass the request object from one web-app to another web-app?
venkat
 
Marc Peabody
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I replied to this yesterday but I do not see my post here now.
Try putting your object(s) in session. The redirect should only cause you to lose request because the redirect is making two requests and the first request does not pass anything to the second.
I do not believe you should lose session.
You can remove your object(s) from session when they are no longer needed.
 
venkata kadiyala
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply Marc,
But the problem if i use session to pass around values is that
The other application (B.war) is expecting data to retrieved from a request object and NOT a session object. I cant change the code in that application so somehow I should only pass the request object to that app.
B.war is expecting request.getAttribute(...) and NOT
session.getAttribute(...)
Hope I explained my problem clearly,
Thanks,
venkat
 
Marc Peabody
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can't modify the other app? Grrr.
That puts a damper on things. I'll keep it in mind today. Hopefully something will work.
 
venkata kadiyala
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Marc,
Did u come up with any solution to my problem?
venkat
 
Marc Peabody
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry. I could not think of anything.
I am surprised that no one else has posted to this thread.
reply
    Bookmark Topic Watch Topic
  • New Topic