• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Global forwards in Struts modules

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

I'm tring to learn about modular struts apps but I'm having trouble with a global forward to my home page (index.jsp).

I have a global struts-config.xml with: as a global forward and as an action mapping in the same struts-config.xml.

When I place a in the jsp's in the modules the jsp will not run with an "Cannot retrieve ActionForward named home" error.

Is this because index.jsp isn't in a module? If so how can I overcome this?

Thanks,
Matt
 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Struts custom tags will look for a ModuleConfig object that is placed in request scope. This object relates to a struts config file. If a URL refers to a module, the request will contain a ModuleConfig object for that module, regardless of where your JSP page is located. Thus, the html:link tag that uses the ModuleConfig object may be looking in the wrong Struts config file for your action mapping.
 
Matt Phipps
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK,

So should I add the action forward to each modules struts-config.xml? If so then how do I get around the relative path URL? Will the module assume the path is relative to the itself even though my index.jsp is in a folder one layer up? Is it just "../index.jsp"?

Also, how would you link from one module to another? Would you enter the module name in the url or again would this be seen as a path relative to the current module?

Thanks,
Matt
 
Anthony Watson
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I prefer to use JSTL tags in favor of Struts custom tags where there is an overlap in functionality. Struts 1.24 has added a 'module' attribute to some of its custom tags, but I'm not sure what version you are trying to use. My advice is to start working with JSTL. Here's an example of rendering an image in the public module using JSTL:
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic