url-routing

How to have URLs without a suffix (e.g .action) in Struts 2?

末鹿安然 提交于 2019-12-05 02:39:15
问题 Here's the thing, I need to not only serve java, but also some javascript files, with my .war. So e,g. if someone goes to the URL: example.com/js/foo.jar Then I need that to be properly served as a javascript file. At the same time, if someone goes to: example.com/bar I need that to be served by Struts2 as a possible controller. The methods I've found online of removing the suffix from the url, would cause both URls to be served by struts 2 (and hence give an error for the first foo.js file

AngularJS / Ionic routing using $stateProvider - controller is not reloading the second time a state is called

纵饮孤独 提交于 2019-12-05 00:46:06
问题 Original Question I'm developing a mobile app using the Ionic Framework and AngularJS and I am having issues with controllers not reloading once they have been initialised. One of the state transitions (from 'app.postbox-details' to 'app.audit-questions' ) should pass a parameter to the 'app.audit-questions' controller but this controller does not update itself with the new parameter because it isn't reloading. Code Example app.js file - config angular.module('sf-maintenance', ['ionic',

Routes with trailing slashes in Pyramid

拥有回忆 提交于 2019-12-04 22:24:39
问题 Let's say I have a route '/foo/bar/baz'. I would also like to have another view corresponding to '/foo' or '/foo/'. But I don't want to systematically append trailing slashes for other routes, only for /foo and a few others (/buz but not /biz) From what I saw I cannot simply define two routes with the same route_name. I currently do this: config.add_route('foo', '/foo') config.add_route('foo_slash', '/foo/') config.add_view(lambda _,__: HTTPFound('/foo'), route_name='foo_slash') Is there

RedirectToAction() with tab-id

本小妞迷上赌 提交于 2019-12-04 21:24:15
问题 I have a web application in ASP.NET MVC and in there i have a jqueryUI tab with forms in. And when i submit i want to return to the open tab. With me RedirectToAction() i create the url www.foo.com/CV/edit/9 But i want to be able to generate www.foo.com/CV/edit/9#tab-2 I tried with RedirectToAction("edit/"+id+"#tab-2"), but that generates: www.foo.com/CV/edit/9%23tab-2 any1 knows the answer? 回答1: Create the URL, then append #tab-2 to it. Return a RedirectResult to redirect to the created URL:

Can't get javascriptRoutes to work with Play Framework 2

北战南征 提交于 2019-12-04 20:23:05
I'm trying to use javascriptRoutes in Play 2 (Scala) and I am getting an error (see below). Here is what I did: Add javascriptRoutes method to Application controller def javascriptRoutes = Action { implicit request => import routes.javascript._ Ok(Routes.javascriptRouter("jsRoutes")(Orders.searchProducts)) .as("text/javascript") } Add route to routes file GET /assets/javascripts/routes controllers.Application.javascriptRoutes Add <script> import to main.scala.html <head> ... <script type="text/javascript" src="@routes.Application.javascriptRoutes"></script> ... </head> With these changes in

Passing multiple optional parameter/value pairs with user defined pair order

人盡茶涼 提交于 2019-12-04 19:59:41
Say user is going to search on 4 or 5 fields, ok? eg. he might want to search by firstname, email, mobile or even page number I want that codeigniter's url be like this: site.com/Controller/Method/variable1/value1/variable2/value2/variable3/value3 or site.com/Controller/Method/variable2/value2/variable3/value3/variable1/value1 (that they should have the same result) or in this format site.com/Controller/Method/variable2/value2/variable4/value4 some examples to clarify my question: site.com/user/search/firstname/John/mobile/123/page/2 or: site.com/user/search/lastname/Smith/email/gmail.com In

Zend Framework Routing: .html extension

可紊 提交于 2019-12-04 19:13:48
问题 I know I've seen this done before but I can't find the information anywhere. I need to be able to route with .html extensions in the Zend Framework. I.E. /controller/action.html should route to the appropriate controller / action. We have an idea to throw away the .html extension with our .htaccess file but I think changing the route config would be the better solution. Any advice is welcome. 回答1: A quick search on google yielded the following tutorials: Extending Zend Framework Route and

How does Angular and Express routing work together in a mean.js app?

◇◆丶佛笑我妖孽 提交于 2019-12-04 18:53:09
问题 I'm struggling about Angular and Express Routing (by the way, i'm somehow new to Express), i've been handling routes with Angular — with ui-router — but now that i'm starting to build a MEAN.js Application i notice that i can handle server-side routing and client-side routing... and that's what makes me get confused, here are some of my questions: How are they different? If i switch to Express routing will i still have a SPA? Can i use both at same time? How? Is it good practice? Does it has

mvc.net routing: routevalues in maproutes

冷暖自知 提交于 2019-12-04 18:51:38
I need urls like /controller/verb/noun/id and my action methods would be verb+noun. For example I want /home/edit/team/3 to hit the action method public ActionResult editteam(int id){} I have following route in my global.asax file. routes.MapRoute( "test", "{controller}.mvc/{verb}/{noun}/{id}", new { docid = "", action = "{verb}"+"{noun}", id = "" } ); URLs correctly match the route but I don't know where should I construct the action parameter that is name of action method being called. Try: public class VerbNounRouteHandler : IRouteHandler { public IHttpHandler GetHttpHandler(RequestContext

React-Router v4 rendering wrong component but matching correctly

别等时光非礼了梦想. 提交于 2019-12-04 17:39:01
I've got a sidebar with two buttons, 'test' and 'about'. Test (rocket icon) is rendered at '/test', and About (home icon) is rendered at '/'. They're both located at the root of the app and are nested within a component. When I start at '/' and click the Link to="/test" it always loads the 'About' component, and when I check the props for the componentDidMount of 'About', the match object contains match data for "/test". Only when I refresh does it render the proper component, 'Test', again. Any idea why this is happening? AppRoutes.js: export class AppRoutes extends React.Component { render()