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

  • Home
  • SEARCH
  • 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 9267999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:41:44+00:00 2026-06-18T14:41:44+00:00

I am writing a web app with a java servlet back end and I

  • 0

I am writing a web app with a java servlet back end and I am checking out angular for the front end. Since the address to a specific resource within a servlet depends on what servlet context it is placed in, I am wondering if it is possible to change the base url for all angular functions.

Example:
If I create a link in my webapp <a href='/newaccount'>Create new account</a> and I configure the route provider accordingly $routeProvider.when('/newaccount', ... I want this to work no matter what servlet context my servlet is placed in. So if I place my servlet in a context called “mycontext” the actual url to the resource will be [hostname]/mycontext/newaccount.

Can I somehow setup angular and pass in the context name so that it is prepended to all locations and configured routes? This way the servlet could be placed in different contexts and still work.

  • 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-18T14:41:45+00:00Added an answer on June 18, 2026 at 2:41 pm

    Actually there are two routing – one on backend and one on frontend. Aren’t you missing them?

    When you’re configuring $routeProvider in AngularJS, you’re configuring client-side routing, so urls would be kind of [hostname]/anypath/yourpage/#/newaccount (if you’re using HashBang mode, that is default in AngularJS).

    But of course you can change base. Plunker, for example use this way:

    <script>
          document.write('<base href="' + document.location + '" />');
    </script>
    

    More information, including HTML5 and HashBang mode you can find here: https://docs.angularjs.org/guide/$location (there is also note about <base> and Html link rewriting)

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

Sidebar

Related Questions

i am writing a web proxy in java on google App engine.I figured out
Background: I have a Flex web app that communicates with a Java back-end via
We're writing a web app that relies on Javascript/jQuery. It involves users filling out
I am currently writing a Java EE web-app using JSP's and I have a
I'm writing a backend for a mobile web-app based in Java and I was
I am writing a web application using java on the Google app engine. Everything
I'm writing a Java web app in my free time to learn more about
I am writing Web app in java using Spring Web MVC framework. Somehow validation
I am writing a web app in java. In my html file I have
I am in the process of writing a Java web app and am having

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.