actionresult

Struts2 URL unreachable

点点圈 提交于 2019-12-01 07:51:41
问题 I'm really racking my head here with Struts2 - I'm able to access the JSP pages by omitting part of the path. Note the path suppose to include pages/welcome_user.jsp . The key is to look at the word pages in the path. here's the struts.xml file: <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <package name="default" namespace="/User" extends="struts

No result defined for action and result

眉间皱痕 提交于 2019-12-01 07:39:26
问题 Default result is not rendering using result for my package alone. Flow goes to my n0result method then It throws Exception . Please correct my wrong configuration. Output : Hello How are you noresult() method got called..... Dec 26, 2013 12:48:04 PM org.apache.struts2.dispatcher.Dispatcher serviceAction SEVERE: Could not find action or result No result defined for action leo.struts.HelloWorldAction and result noresult - action - file:/D:/workspace/.metadata/.plugins/org.eclipse.wst.server

Struts 2.3 - redirect vs redirectAction

喜欢而已 提交于 2019-12-01 07:21:45
What is the main difference between redirect and redirectAction in Struts2.3 context. I have seen below URLs for redirect and redirectAction . I am clear about below points: redirect is like sendRedirect() method. New request is created which clear the previous value stack and action (action instance, action errors, field errors, etc) no longer available. In redirectAction , control jumps to the different action(in same or other package) redirectAction is recommended over redirect. But when I implemented both above mentioned examples, I only had to change my struts.xml . In both, action is no

Should I make my ASP.NET MVC controller actions virtual?

江枫思渺然 提交于 2019-12-01 04:06:10
File -> New Project for ASP.NET MVC projects used to generate controllers with virtual actions. I'm not sure if that stopped with MVC 2 or MVC 3, but is this no longer a best practice? archil T4MVC Does make action methods virtual. If you are using it, it should make action methods virtual, no other way it can work The current documentation for ASP.NET MVC 3 does not show virtual methods. I'm not really sure what making them virtual would gain you, as I've never subclassed controllers to override actions. If you make them virtual then it will make the controllers easier to mock if you are

Should I make my ASP.NET MVC controller actions virtual?

主宰稳场 提交于 2019-12-01 01:44:36
问题 File -> New Project for ASP.NET MVC projects used to generate controllers with virtual actions. I'm not sure if that stopped with MVC 2 or MVC 3, but is this no longer a best practice? 回答1: T4MVC Does make action methods virtual. If you are using it, it should make action methods virtual, no other way it can work 回答2: The current documentation for ASP.NET MVC 3 does not show virtual methods. I'm not really sure what making them virtual would gain you, as I've never subclassed controllers to

Struts2 redirect from login interceptor

纵然是瞬间 提交于 2019-11-30 14:26:15
问题 Our application requires users to be logged in to view any content. Access to all pages is intercepted by LoginInterceptor which brings up the login form if there's no valid session for the user. I'd like the interceptor to remember the original request URI before displaying the login form and redirect to it if the login form validation is successful. I tried to follow Struts 2 Redirect to correct action after authentication interceptor. @Service @Results({ @Result(name = "redirect", type =

return new RedirectResult() vs return Redirect()

∥☆過路亽.° 提交于 2019-11-30 08:13:12
What is the difference between the following two controller ActionResult return statements: return new RedirectResult("http://www.google.com", false); and return Redirect("http://www.google.com"); straight from the source // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. using System.Diagnostics.CodeAnalysis; using System.Web.Mvc.Properties; namespace System.Web.Mvc { // represents a result that performs a redirection given some URI public class RedirectResult : ActionResult { [SuppressMessage("Microsoft.Design"

How to pass XML as POST to an ActionResult in ASP MVC .NET

纵饮孤独 提交于 2019-11-30 07:03:22
I am trying to provide a simple RESTful API to my ASP MVC project. I will not have control of the clients of this API, they will be passing an XML via a POST method that will contain the information needed to perform some actions on the server side and provide back an XML with the result of the action. I don't have problems sending back XMLs, the problem is receiving XML via a POST. I have seen some JSON examples, but since I will not control my clients (it could be even a telnet from my point of view) I don't think JSON will work. Am I correct? I have seen examples where clients simply

How do I perform a secondary action (i.e. calculate fields) in ASP.NET MVC?

爷,独闯天下 提交于 2019-11-29 12:03:24
I need to do some calculations on an ASP.NET MVC View, an action different than the form submission. I've tried various methods of passing the current Model on to a new controller action via an ActionLink, but the model doesn't appear to be passed. public ActionResult Calculate(MuralProject proj) { ProjectFormRepository db = new ProjectFormRepository(); List<Constant> constants = db.GetConstantsByFormType(FormTypeEnum.Murals); proj.Materials = new MuralMaterials(); proj.Materials.Volunteers = this.GetVolunteerCount(constants, proj); this.InitializeView(); return View("View", proj); } What

How to pass XML as POST to an ActionResult in ASP MVC .NET

☆樱花仙子☆ 提交于 2019-11-29 08:41:21
问题 I am trying to provide a simple RESTful API to my ASP MVC project. I will not have control of the clients of this API, they will be passing an XML via a POST method that will contain the information needed to perform some actions on the server side and provide back an XML with the result of the action. I don't have problems sending back XMLs, the problem is receiving XML via a POST. I have seen some JSON examples, but since I will not control my clients (it could be even a telnet from my