• 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

Run time JSP mappings to Struts 2.0 Actions

 
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I have some kind of complex situation. I am working on a web site where people arranges events. There are a set of public pages which are specific to a particular event. The owner of that event can ask us to customize the jsp pages for them. So each event has its own set of jsp pages in the eventNamed folder. My application is struts 2.0 based. Normal way of this to achieve would be to add the new folder and jsps to the project and then make appropraite actions and action mappings in struts.xml. That way, its easy. But in that case we will have to restart our web server in order to reflect the new jsps and actions upon a new event creation. We do not want a restart of the server. So is there anyway that action class takes the jsps from appropriate eventNamed folder based on some input.
The web structure is like below.
Web Application.
First Event
intro.jsp

Second Event
intro.jsp

So if I calculate, that the event id FirstEvent, then the jsps should be from FirstEvent folder and vice versa.

Remember that event creation is not manual but it is automated through the application by copying all the jsps to the new Event named folder.

I hope I have explained it well.

Thanks in advance.
 
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I understand your problem correctly, you are using the same action class for all of your events, but you are returning a different result for each event and using the struts.xml file to control which directory's JSP the application uses to display the data. If this is correct, then you maybe be able to solve your problem by having a single result that your action class uses any time it completes successfully. This result will go to a JSP that has a jsp:include tag in it that gives control to the correct JSP. I've never put anything dynamic in the "page" attribute of a jsp:include, so I'm not exaclty sure what your options are. I doubt you can use s:property tag, EL might work, if all that fails, you could write a scriptlet (shame on me for saying that).

Alternatively, I you want to automatically update the struts.xml file, I think you can reload it with:

Dispatcher.getInstance().getConfigurationManager().getConfiguration().rebuildRuntimeConfiguration();

I've never done this, but if that works better for you, you might want to give it a try.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic