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 8988957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:08:08+00:00 2026-06-15T22:08:08+00:00

I have a basic question in struts why do we need to have <global-forwards>

  • 0

I have a basic question in struts why do we need to have <global-forwards>and <global-exceptions> in struts-config.xml. If we can achieve the same things with <action-mappings> itself.

  • 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-06-15T22:08:09+00:00Added an answer on June 15, 2026 at 10:08 pm

    <global-forwards>

    Consider you are validating the username password for different urls like

    • update.do
    • insert.do
    • delete.do

    If it is a valid user, you need to proceed the necessary action. If not, you need to forward to the login page. Without a global forward, you must add a login form mapping form to every action:

    <action-mappings>        
       <action path="/insert" type="controller.Insert">
          <forward name="success"  path="/insert.jsp"/>
          <forward name="failure"  path="/login.jsp"/>
       </action>     
    
       <action path="/update" type="controller.Update">
          <forward name="success"  path="/update.jsp"/>
          <forward name="failure"  path="/login.jsp"/>
        </action>
    
        <action path="/delete" type="controller.Delete">
           <forward name="success"  path="/delete.jsp"/>
           <forward name="failure"  path="/login.jsp"/>
        </action>        
    </action-mappings>
    

    Instead of repeating the <forward name="failure" path="/login.jsp"/> you can declare this in <global-forwards> like below

     <global-forwards>
       <forward name="failure"  path="/login.jsp"/>
    </global-forwards>
    

    Now you can remove the <forward name="failure" path="/login.jsp"/> in the action mappings.


    <global-exceptions>

    When you receive java.Io exception, instead of handling manually for each you can declare globally as below.

    <global-exceptions>
       <exception type="java.io.IOException" path="/pages/error.jsp"/>
    </global-exceptions>
    

    I hope this clarifies your problem.

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

Sidebar

Related Questions

I have one basic question,I am declaring xmlfile as global in xml function,can I
I have a basic question, in the Django template language how can you tell
I have really basic question. How can I get form id by input element
I have a basic question related to storage domain. Can any one answer what
I have a basic question that I can't seem to resolve using Google (Or
I have a basic question that I can not understand yet from ruby. If
I have a basic question. I am loading an XML file using the URLLoader
I have just started Rails and have a basic question. I need to add
I just have a basic question with xml. I want to know whether it
I have a basic question about the form action. Consider the below code here,

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.