model-view-controller

Bad request 400 for HttpUtility.UrlEncoded URL segments

本小妞迷上赌 提交于 2019-12-24 02:34:07
问题 So, if there are url encoded segments in my apps MVC url, IIS throws a BAD REQUEST 400. e.g. http://u.lasoo.com.au/Offer/*9289--750W-Generic-ATX12V-Power-Supply-%252449dot99/6355 <--- the '*' and '%' are causing this error. Notice that http://u.lasoo.com.au/Offer/The-Giant-Good-As-Gone-7-Day-Sale/6354 works fine. What's the correct way to convert an arbitrary string into an accepted MVC URL segment? UPDATE: the URl segment should resemble the original string. Base64 encoding completely

portal:actionURL Spring MVC Portlet

你说的曾经没有我的故事 提交于 2019-12-24 02:33:37
问题 I am trying to create a actionUrl using the following code <portlet:actionURL var="actionUrl"><portlet:param name='action' value='viewModules' /></portlet:actionURL> and map that onto a spring controller However the controller does not respond as the generated url's ampersands are encoded e.g. <snip>&p_p_lifecycle=1&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=2</snip> If I unencode and paste into the browser this works I have added portlet.url.escape.xml=false to portal

Django separation of business logic and views logic

大憨熊 提交于 2019-12-24 02:18:53
问题 Could someone please explain what the following means: "Business logic belongs in the model, but view logic belongs in the view." What is the general distinction for each as well as a few examples. Thank you. 回答1: You could've just asked in the comments on the other question ;). Business logic is anything that's related to how a "thing" works or operates. Take for example the following: class Animal(Object): def speak(self, sound): print sound class Duck(Animal): has_feathers = True It would

Zend Framework Path Problems

微笑、不失礼 提交于 2019-12-24 02:16:58
问题 All, I am just trying to view any page at all besides the “Welcome to Zend Framework” screen. I have downloaded the project from this tutorial: http://framework.zend.com/docs/quickstart/create-a-form (Zend Framework Quickstart) As far as I can tell, the paths are coming up correctly. I read this post: http://www.johnmee.com/2008/11/zend-framework-quickstart-tutorial-deploy-to-a-subdirectory-instead-of-web-root/ I think it may be a bit dated, as the bootstrap code is not as he describes. Does

Symfony2 and MVC - Is extend controller a good practice?

杀马特。学长 韩版系。学妹 提交于 2019-12-24 02:09:27
问题 I have a simple and perhaps stupid question. Using Symfony2 PHP framework i often work extending controllers like below ( of course it depends from the kind of work ): class MainController extends Controller{ private $locale = array(); protected function Locale() { $em = $this->getDoctrine() ->getManager(); $this->locale = $em->getRepository('CommonLanguageBundle:Language') ->findBy( array('code' => $this->getRequest() ->getLocale() ) ); // \Doctrine\Common\Util\Debug::dump($this->locale);

Client side validation mvc dropdown

跟風遠走 提交于 2019-12-24 02:00:09
问题 @using (Html.BeginForm("ForatExcel", "ForatSummary", FormMethod.Post, new { enctype = "multipart/form-data" })) { @Html.DropDownList("ForatFrom", new SelectList(Model, "ID", "ID", new { onchange = "getAllData()" })) @Html.DropDownList("ForatTo", new SelectList(Model, "ID", "ID", new { onchange = "getAllData()" })) <br /> <input type="submit" id="btnForatVersion" value="Go"/> } I need to validate that the "ForatFrom" dropdown value is greater than that of the "ForatTo" value. I guess i can't

AttributeRouting does not work

烂漫一生 提交于 2019-12-24 01:59:35
问题 I put [AttributeRouting.Web.Mvc.Route("faq.html")] on my action Faq. However when I go to localhost/faq.html I get a 404 http not found error and I can't find my custom routes in localhost/routes.axd. How can i fix this ? thanks ! updated: here is my faq action [OutputCache(Duration = 120)] [AttributeRouting.Web.Mvc.Route("faq.html")] public virtual ActionResult FAQ(int id = 0){ //some code here } 回答1: Try code below: [OutputCache(Duration = 120)] [AttributeRouting.Web.Mvc.Route("faq.html/{id

MVC3 lock textbox based on a selection on a dropdown menu

笑着哭i 提交于 2019-12-24 01:55:09
问题 I am making a form using ASP MVC 3 and I am new not only to web development but to ASP.NET MVC as well. The user will have the chance to either Pick one of the given questions from a dropdown menu, or write their own. What I am trying to do, is to block the text field where the user will type a question in case the user previously selected any question from the dropdown menu. I can use either JavaScript or use MVC (I preferably would like to use MVC code, but JavaScript can work as well). <tr

MVC3 lock textbox based on a selection on a dropdown menu

只谈情不闲聊 提交于 2019-12-24 01:55:01
问题 I am making a form using ASP MVC 3 and I am new not only to web development but to ASP.NET MVC as well. The user will have the chance to either Pick one of the given questions from a dropdown menu, or write their own. What I am trying to do, is to block the text field where the user will type a question in case the user previously selected any question from the dropdown menu. I can use either JavaScript or use MVC (I preferably would like to use MVC code, but JavaScript can work as well). <tr

Display the PDF file stored on the webserver on Browser new window using Spring MVC

允我心安 提交于 2019-12-24 01:44:22
问题 I have a requirement to show PDF files in a browser. I use Spring MVC. Is there a way I can do this without using AbstractPdfView? I do not want to render the PDF at runtime. All the PDF files will be stored in my webserver. This is the code I am using. But this directly downloads the file instead of showing it up in a browser. @RequestMapping(value = "/download" , method = RequestMethod.GET) public void doDownload(HttpServletRequest request, HttpServletResponse response) throws IOException {