Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3597270
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:05:47+00:00 2026-05-18T20:05:47+00:00

Here’s my situation : in the webapp, I use an interceptor to set the

  • 0

Here’s my situation : in the webapp, I use an interceptor to set the language(Locale).
If a user is logged, I used the language property of this user.
Else if a cookie is set, I use the value of this cookie.
Else, I use the setting of the browser.

It works well when I navigate into the app and when I am logged.

The problem is at the welcome page, since it calls mydomain.com/index.jsp, it don’t go through the interceptors so the language isn’t set(it’s always using the browser setting).

Is there a way to go through the interceptors on the index page or to set the Locale value in the index.jsp page ?

Thank you!

The solution :

I removed the .jsp from the index.jsp in the web.xml file :

<welcome-file-list>
  <welcome-file>index</welcome-file>
</welcome-file-list>

I added the index action to my struts.xml file :

<default-action-ref name="index" />

<action name="index">
  <interceptor-ref name="appStack" />
  <result name="success">index.jsp</result>
</action>

The language interceptor is part of the appStack.

Thank you guys for your helps!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T20:05:48+00:00Added an answer on May 18, 2026 at 8:05 pm

    I would just add the conventions plugin (struts2-conventions-plugin-x.x.x.jar) where x.x.x is the version you are using.

    Then I would move all the public jsp’s under /WEB-INF/content and be done.

    In your web.xml I don’t mention any welcome files… but if you would like to be explicit:

    <welcome-file-list>
        <welcome-file>index</welcome-file>
    </welcome-file-list>
    

    If using Struts 2.2.1 your web.xml should minimally look like…

    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <filter>
        <filter-name>action</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>action</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    

    If you want to do it the struts.xml way then just move the index.jsp under /WEB-INF and create an action mapping for it… something like:

        <action name="index">
            <result>/WEB-INF/index.jsp</result>
        </action>
    

    which would be in a package with namespace “/” or “”.

    On the other hand I haven’t looked at the Local stuff in a while but are you sure you’re not reinventing the wheel… the i18n interceptor is already in the default stack.

    Look into it’s use. Long story short there are language property files defined for each language. If Struts2 has determined such properties are in use then then the struts tags will search the value in its name attribute for a matching string in the property file and return the value of that map entry.

    It all works pretty slick. Sorry if this is what you are already doing but on the chance you didn’t know it should save you a lot of time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the situation, I am attempting to fire a set of Gallio tests
Here is a simplification of my database: Table: Property Fields: ID, Address Table: Quote
Here's a coding problem for those that like this kind of thing. Let's see
Here is an example. foreach (var doc in documents) { var processor = this.factory.Create();
Here's what I'm trying to accomplish with this program: a recursive method that checks
Here is the css: #content ul { font-size: 12px; } I am trying this:
Here's my situation. I have a DotNetNuke application. I want to link to an
Here is the situation. I am making changes to an application but I do
Here is a scenario: User installs .NET application that you have made. After some
Here is what is supposed to happen: The moment the user chooses an option

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.