get

Correct use of C# properties

余生长醉 提交于 2019-11-29 03:43:47
private List<Date> _dates; public List<Date> Dates { get { return _dates; } set { _dates = value; } } OR public List<Date> Dates { get; set; } I have always used the former, is that incorrect or bad practice? It never occurred to me that I could just use the second option. I do like having my encapsulated variables to begin with an underscore so I can distinguish them from method parameters. And I've just always done it that way. Is it possible that using the first option would result in an extra List<Date> object being instantiated and then the whole of _dates being replaced with value , or

POST method getting converted to GET in IE-9

北城余情 提交于 2019-11-29 03:42:37
I have this line of code in my JSP. (I'm using struts 1.3) <html:form action="screening/mine.do" method="post"> . . . </html:form> When the action corresponding to mine.do is invoked (using struts-config.xml), the page is getting submitted as GET instead of POST. All the request parameters including the required ones are getting lost due to this. This issue occcurs only in IE-9. The response remains as POST when I use other versions of IE or any other browsers. How do I make the response to remain as POST in IE-9 ? EDIT : I observed one more issue in this. Whenever the page is rendered in a

jquery ajax get example

断了今生、忘了曾经 提交于 2019-11-29 03:41:40
At the moment I'm using the post method like this $.ajax({ type: "POST", url: "Servicename.asmx/DoSomeCalculation", data: "{param1ID:"+ param1Val+"}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { UseReturnedData(msg.d); }, error: function(err) { alert(err.toString()); if (err.status == 200) { ParseResult(err); } else { alert('Error:' + err.responseText + ' Status: ' + err.status); } } }); Am I correct in believing that if I use a GET request instead of POST the behavior will change to being a synchronous request i.e. the execution will wait until

iOS Can't perform HTTP GET request -Error Domain=NSURLErrorDomain Code=-1012

一个人想着一个人 提交于 2019-11-29 03:26:10
I am trying to perform a HTTP Get request, but I keep on getting Error Domain=NSURLErrorDomain Code=-1012 error. MY code is : @try { NSString *url = [[NSString alloc] initWithFormat:@"%@%@", @"http://api.mintchat.com/agent/chats/", agentSecret]; NSLog(@"******Agents Active List URL Str - %@", url); NSURL *nsUrl = [NSURL URLWithString:url]; NSLog(@"******Agents Active List URL - %@", nsUrl); // Make the request, returning a JSON response, just as a plain old string. //NSData *jsonDataString = [[NSString stringWithContentsOfURL:[NSURL URLWithString:url] encoding:NSUTF8StringEncoding error: nil]

remove GET parameter in URL after processing is finished(not using POST), PHP

こ雲淡風輕ζ 提交于 2019-11-29 03:12:47
I have url like this http://localhost/join/prog/ex.php When i use GET method the url address like this http://localhost/join/prog/ex.php?name=MEMORY+2+GB&price=20&quantity=2&code=1&search=add My question is : so, I still use the GET method but I want to after processing in GET method is finished, I want to the url back(remove parameter) into http://localhost/join/prog/ex.php , as previously (not using POST method). How can i do it? Put this in your HTML file (HTML5). <script> if(typeof window.history.pushState == 'function') { window.history.pushState({}, "Hide", "http://localhost/join/prog/ex

What happens when submit button is clicked

廉价感情. 提交于 2019-11-29 03:08:11
What happens when submit button is clicked? Let I've a form which located on an http://example.com/ URL with the two input elements like this: <form method="get"> <input type="text" id="field1" name="namefield1"/> <input type="text" id="field2" name="namefield2"/> <input type="submit" value="submit"/> </form> What actually get request will be sent to an http -server in my specific case? The form will be submitted to the server and the browser will redirect away to the current address of the browser and append as query string parameters the values of the input fields. In terms of the HTTP

How can I remove empty fields from my form in the querystring?

落花浮王杯 提交于 2019-11-29 03:01:58
I have a simple form with four inputs. When I submit my form, I want to use the GET http method. For the example : aaa : foo bbb : ____ ccc : bar ddd : ____ I want to have this query string : /?aaa=foo&ccc=bar The problem is I have this query string : /?aaa=foo&bbb=&ccc=bar&ddd= How can I remove empty fields from my form in the query string ? Thanks. You could use jQuery's submit function to validate/alter your form: <form method="get" id="form1"> <input type="text" name="aaa" id="aaa" /> <input type="text" name="bbb" id="bbb" /> <input type="submit" value="Go" /> </form> <script type="text

Can sendRedirect() act as a post method instead of get? - jsp/servlets

為{幸葍}努か 提交于 2019-11-29 02:30:27
问题 I have a simple form which accepts a username and a password. I have to use sendRedirect() method for the page to redirect to one page if log in is valid and to another if not. I need to use sendRedirect() and not forward() since the other pages are located in another server. I noticed that when using response.sendRedirect(response.encodeRedirectURL("FileName.jsp?paramName=" +value)); the sendRedirect() is using the GET method since name=value are being shown in the URL. This is not desirable

Remove parameters within nginx rewrite

北城余情 提交于 2019-11-29 01:17:11
I'm rewriting URLs in nginx after a relaunch. In the old site I had query parameters in the URL to filter stuff e.g. http://www.example.com/mypage.php?type=4 The new page doesn't have these kind of parameters. I want to remove them and rewrite the URLs to the main page, so that I get: http://www.example.com/mypage/ My rewrite rule in nginx is: location ^~ /mypage.php { rewrite ^/mypage.php$ http://www.example.com/mypage permanent; } But with this rule the parameter is still appended. I thought the $ would stop nginx from processing further values... any ideas? All other questions deal with how

Rails: Plus sign in GET-Request replaced by space

一笑奈何 提交于 2019-11-29 01:17:06
In Rails 3 (Ruby 1.9.2) I send an request Started GET "/controller/action?path=/41_+" But the parameter list looks like this: {"path"=>"/41_ ", "controller"=>"controller", "action"=>"action"} Whats going wrong here? The - , * or . sign works fine, its just the + which will be replaced by a space. That's normal URL encoding, the plus sign is a shorthand for a space : Within the query string, the plus sign is reserved as shorthand notation for a space. Therefore, real plus signs must be encoded. This method was used to make query URIs easier to pass in systems which did not allow spaces. And