I've read the entire thread, and I'm still a bit confused.  Are you just
trying to copy 'barbados' (or whatever is in the path) from the URL into a
session variable?

That sounds pretty easy to do.  I would probably use a Filter, but there
would really only be one extra step if you do it in an interceptor.

//Inside the class body
public static final String ISLAND_NAME_KEY = "island_name_key";



//Inside the filter or interceptor method:

HttpServletRequest request = ServletActionContext.getRequest();  //Not
needed if you do this in a filter

HttpSession session = request.getSession();
String islandName = (String) session.getAttribute(ISLAND_NAME_KEY);

if (islandName == null) {
    String servletPath = request.getServletPath();
    //Find 'barbados', 'antigua', etc. in the servletPath using a string
tokenizer, regex, etc.
    islandName = findIslandName(servletPath);  //getting the island name
from the servlet path is left as an exercise for the reader
    session.setAttribute(ISLAND_NAME_KEY, islandName);
}


Hope this helps,

-Brian







On Wed, Jan 20, 2010 at 1:40 AM, emil thushanga <thusha...@gmail.com> wrote:

> Hi
>
> Thanks for the solutions. i prefer to do it in interceptors way. if
> any resources available for me to grab the thing please let me know. any
> way thanks a lot.
>
> Emil
>
> On Wed, Jan 20, 2010 at 1:25 PM, Dale Newfield <d...@newfield.org> wrote:
>
> > emil thushanga wrote:
> >
> >> if namespace is 'Barbados'
> >>      session ='Barbados'
> >>
> >> if namespace is 'Antigua'
> >>      session ='Antigua'
> >>
> >
> > One simple way to do this would be to write an interceptor that takes the
> > namespace from the action mapping and sets the appropriate value in
> session
> > scope.
> >
> > -Dale
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> > For additional commands, e-mail: user-h...@struts.apache.org
> >
> >
>
>
> --
> Emil Thushanga
>

Reply via email to