jquery - redirect to another page using a href and spring mvc -
i want change page when click on item in bootstrap navbar.
i'm trying this.
<li><a href="javascript:" name="mainpage"><span class="glyphicon glyphicon-home"></span> main</a>
and onclick
method a
is.
$("ul > li > a").click(function() { $.post("redirect.html", { page : this.name } ); });
and spring controller is
@requestmapping("/redirect.html") public string redirect(@requestparam map<string, string> allrequestparams, model model) { logger.debug("attempt redirect"); string next_page = allrequestparams.get("page"); logger.debug("parameter page: " + next_page); return "redirect: events"; }
in debug window shows enters method redirect
properly. page doesn't change.
what's problem?
the whole navbar looks this
<div id="navbaritems" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="javascript:" name="mainpage"><span class="glyphicon glyphicon-home"></span> main</a> <li><a href="javascript:" name="events"><span class="glyphicon glyphicon-time"></span> events</a></li> <li><a href="#"><span class="glyphicon glyphicon-user"></span>users</a></li> </ul> </div>
Comments
Post a Comment