actionresult

No result defined for action <class> and result input

雨燕双飞 提交于 2021-01-28 01:39:02
问题 Here is my struts.xml <package name="ajax" extends="json-default" > <action name="loadcity" method="loadcity" class="roseindia.action.user.RegisterUser" > <result type="json" /> </action> </package> When I am calling loadcity.action I am getting following error No result defined for action roseindia.action.user.RegisterUser and result input Here is my action method: public String loadcity() { country=request.getParameter("country"); cityList= dao.loadcity(country); return ActionSupport

Struts2 jquery Plugin responds to ajax requests with HTML of the entire page

女生的网名这么多〃 提交于 2020-01-22 15:47:24
问题 I am trying to use the Struts2 jquery plugin for ajax requests on some of my forms, but I am having an issue with the response to the page. The struts action is validated and executed properly, but when jquery gets a response, it sets the response as the HTML of the entire page... It is putting the response in the correct place, but it is not responding with the right thing at all... Here is the jsp form: <%@ tag language="java" pageEncoding="UTF-8"%> <%@ taglib uri='http://java.sun.com/jsp

Struts 2 what to do when user inserts action which does not exist

ε祈祈猫儿з 提交于 2020-01-14 02:57:09
问题 In a Struts 2 application when user inserts an URL which is not related with any of your actions a java.lang.NullPointerException arises in these cases I want to display a nice screen so I have added in my struts.xml <global-exception-mappings> <exception-mapping exception="java.lang.NullPointerException" result="exception"/> </global-exception-mappings> <global-results> <result name="exception">/WEB-INF/jsp/exception.jsp</result> </global-results> but it doesn't work. I also have tried

ASP.NET MVC : capture result of download prompt

谁说胖子不能爱 提交于 2020-01-05 04:23:15
问题 I have a bit of code that makes a file available and prompts user to open/download/cancel . I would like to take an action if the file is opened or downloaded , but not if canceled . This is the download line, from the controller : return File(fileAsBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName); I guess my question is, how do I capture a return value from this action? Would I see the result in the controller or in the view that calls it? I'm a struggling newbie. Don't

JSON exception error while output using Struts 2

随声附和 提交于 2020-01-01 18:32:52
问题 I am getting the JSON Exception error when I am executing the result into the browser like the following: type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.ProductDetails.ISN, no session or

Returning Empty ActionResult

与世无争的帅哥 提交于 2019-12-30 16:18:07
问题 I may encounter situations, when I need to just return bad request result. For example, there is a call to MVC 3 site's controllers action, but the required parameter is missing in a request uri. What do I return in response. I know I can do this: Response.StatusCode = (int)HttpStatusCode.BadRequest; return Content(string.Empty); Is this the correct way for the above described situation? 回答1: Your solution will work OK, but more clear way will be using HttpStatusCodeResult class, like this:

mvc4 How to extract value from a tolist query in controller

大城市里の小女人 提交于 2019-12-25 16:03:28
问题 Ok so this is the basic setup; A user logins I get the unique ID of that user myid , I then try to get a list of that logged in user friends by going into the friends table which is shown in the variable myfriends notice that I have only selected the friendID column which represents the uniqueID of a friend. I then compare the myid to the profileID which should match if they're friends. The problem is that I am using a . tolist() on the myfriends variable and I can't seem to extract the

mvc4 How to extract value from a tolist query in controller

泄露秘密 提交于 2019-12-25 16:03:05
问题 Ok so this is the basic setup; A user logins I get the unique ID of that user myid , I then try to get a list of that logged in user friends by going into the friends table which is shown in the variable myfriends notice that I have only selected the friendID column which represents the uniqueID of a friend. I then compare the myid to the profileID which should match if they're friends. The problem is that I am using a . tolist() on the myfriends variable and I can't seem to extract the

Struts 2 action not working if the action name=“apply”

一世执手 提交于 2019-12-25 07:51:38
问题 Problem so simple, if the action name is "apply" this action doesn't work at all, and it gave the HTTP Status 404 - No result defined for action com.control.actions.ClassName and result success example of the struts.xml : <action name="apply" method="display" class="com.control.actions.ClassName"> <result name="none">/page.jsp</result> </action> but it works if the action name is anything else like: <action name="applying" method="display" class="com.control.actions.ClassName"> <result name=

How to apply a global dynamic result path prefix in Struts 2 so can reskin JSPs?

狂风中的少年 提交于 2019-12-25 04:15:41
问题 I have a website using Struts2 as the MVC framework. I need to re-skin the JSPs. I need to have the old JSPs accessible alongside the new JSPs. So I have added a root folder of /newdesign/ and copied all of the existing JSP folders into it. So if I login with the name/value pair ?newdesign=true (for example) I'm the initial request then I can: store this in the user's session and then dynamically add /newdesign/ as a global prefix to the tag in struts.xml that determines if the new or old JSP