3099

Same url for all pages

Question:

I'm working on a proyect in JSP, but i want to show in the navigator bar the same url for all the pages in my proyect.

I know how to do it with iframes and frameset, but I'm looking for a way to do it with javascript/ajax.

Can someone help with this?

Thanks

Answer1:

Single page web apps where all page changes are done via AJAX are certainly possible, and are actually gaining popularity with frameworks like <a href="http://backbonejs.org/" rel="nofollow">Backbone.js</a>. The exact implementation is going to vary wildly based on the nature of your project, so there isn't really much to say without more specific information.

As the simplest example I can think of, you could just have a link on your page run the following javascript (with jQuery) to completely reload the body of the page:

$("body").load("/path/to/new/body.htm");

Answer2:

You can load a page that will update the HTML DOM using Ajax.

The main page: foo.com/bar

<div id='ajax_container'> </div>

Then in you JS, for specific user action (click in a menu...):

$(function(){ $('#baz').click(function(){ $.ajax({ url: "foo.com/bazzz", cache: false }).done(function(html) { $("#ajax_container").append(html); }); }); });

<a href="http://api.jquery.com/jQuery.ajax/" rel="nofollow">http://api.jquery.com/jQuery.ajax/</a>

Answer3:

You can use the switch condition in the same servlet .

Recommend

  • Matrix Traversal by expanding outwards from a point?
  • Get 50 random rows from Sphinx query
  • How to show related subdocument properties in Meteor
  • What means “document popularity” in Solr
  • Unable to load module entry point in GWT/GXT Project
  • How do I draw a rectangle from one render target onto another without losing data?
  • A Grid of Clones
  • backbone.js router doesn't work on IE6
  • Updating a LayoutView's Model
  • How can I output data with special characters visible?
  • set ruby hash element value by array of keys
  • Hide UIView starting from Bottom on Scroll
  • Getting rollback in creating shortcuts on installation of node js in windows 7
  • Property '$' of object # is not a function at _.extend._ensureElement
  • LDA: Why sampling for inference of a new document?
  • Swift gives “self used before all stored procedures are initialized” error when building child nodes
  • Objective C - Create a framework for my iphone apps?
  • Android application not restoring state when installed from .apk, works fine from eclipse
  • CS1703: In Xamarin.Droid, should I use the .Net Standard windowsruntime.dll located in Mono.Framewor
  • Python cosine function precision [duplicate]
  • HttpClient: disabling chunked encoding
  • abstracting over a collection
  • Does Apple allow the usage of sysctl.h within iOS applications?
  • Can't remove headers after they are sent
  • Trying to get the char code of ENTER key
  • During installation of Django, why do I keep getting ImportError: No module named django?
  • C++ pointer value changes with static_cast
  • WPF ICommand CanExecute(): RaiseCanExecuteChanged() or automatic handling via DispatchTimer?
  • Webgrid not refreshing after delete MVC
  • Use of this Javascript
  • Jquery UI tool tip close icon
  • C++ Partial template specialization - design simplification
  • req.body is undefined - nodejs
  • Modifying destination and filename of gulp-svg-sprite
  • Importing jscolor library in angular 2
  • How to get next/previous record number?
  • jqPlot EnhancedLegendRenderer plugin does not toggle series for Pie charts
  • Traverse Array and Display in markup
  • Python: how to group similar lists together in a list of lists?
  • Qt: Run a script BEFORE make