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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:15:32+00:00 2026-06-12T13:15:32+00:00

Right now based on the site name in the URL parameter, we decide the

  • 0

Right now based on the site name in the URL parameter, we decide the appropriate actions to take(method calls etc) in the Java (Standard Jsp/Servlet web applications). For example, the request would be something like www.oursite.com?site=Ohio
Wondering what would be the alternative of doing this without having to provide URL parameter.

  • 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-12T13:15:33+00:00Added an answer on June 12, 2026 at 1:15 pm

    Why not just code it into the path?

    http://www.oursite.com/Ohio

    If you’re just using straight servlet api, you can just do something of this nature:

    String path = request.getPathInfo();
    String site = path.split("/")[0];
    

    That being said, most web frameworks have some support for helping with this.
    For example, in spring mvc:

    @RequestMapping(value="/{site}/blah/blah", method=RequestMethod.GET)
    public ModelAndView blahBlah(HttpServletRequest req,
                                 HttpServletResponse resp,
                                 @PathVariable("site") String site) {
       // do stuff here
    }
    

    Of course you could do this at the controller level too if all your methods need that sort of mapping:

    @Controller
    @RequestMapping(value="/{site}")
    public class MyController {
      @RequestMapping(value="/blah/blah", method=RequestMethod.GET)
      public ModelAndView blahBlah(HttpServletRequest req,
                                 HttpServletResponse resp,
                                 @PathVariable("site") String site) {
         // do stuff here
      }
    }
    

    I believe this is cleaner than a query param, though it still shows up in your URL. There’s other, more complex methods like using apache’s reverse proxying and virtual host capabilities to switch based on site names. You could do something at login, and store the site in session. It all depends on your requirements.

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

Sidebar

Related Questions

We are building a web based solution right now and it is almost ready
I have a problem here. Right now I'm doing my Web Based Application, my
Right now, I've just some code which fetches the picture from the URL directly.
Right now, the label for my Activity has the name of the current Activity.
Right now, my site is served by a single server, but I anticipate the
I have to post to a URL using PHP. right now it works but
I've a site, we are using ASP.NET 4.0, and right now our products content
I'm right now setting up a web application based on ASP.NET MVC 3 Razor.
I have a Rails-based site with a basic two-column layout. On the right is
is having different site.master files common practices for theming. right now i have my

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.