In computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. http://en.wikipedia.org/wiki/Functional_programming Can anyone explain me what is state and mutable data? Can anyone give me examples in …
Tag: javascript
How to match any combination of letters using regex?
How can I match letters a,b,c once in any combination and varying length like this: The expression should match these cases: but should not match these ones: Answer Use regex pattern You can use this pattern with any set and size, just replace [abc] with desired set… Example: (above output is from myreg…
How to click an element in Selenium WebDriver using JavaScript?
I have the following HTML: My following code for clicking “Google Search” button is working well using Java in WebDriver. I want to use JavaScript with WebDriver to click the button. How can I do it? Answer Executing a click via JavaScript has some behaviors of which you should be aware. If for ex…
Java applets – is it a wrong choice today?
I have some non-trivial computational code that need to be applied on data already downloaded into the browser DOM and captured from user interactions. I do not wish to expose this code. I am wondering if: Write a webservice and communicate with the browser over websocket or HTTP. The trade-off is speed of in…
HTTP Status 405 – Request method ‘POST’ not supported (Spring MVC)
Im getting this error: HTTP Status 405 – Request method ‘POST’ not supported What I am trying to do is make a form with a drop down box that get populated based on the other value selected in another drop down box. For example when I select a name in the customerName box the onChange functio…
How can I call servlet from jsp without using form
This could be a repeat question, I apologize. I have a jsp page in which I have some buttons. Each button has its own servlet to call. I want to know if there is any way I can call these servlets without using form because the user may choose any of the 3 functionalities given. I also need to pass
Convert pixel location to latitude/longitude & vise versa
I need to convert latitude longitude values into pixel positions as well as do the opposite. I’ve found many solutions to go from lat/lng->pixel, but can’t find anything on the reverse. A couple of notes: The map is a fixed size, no zooming, no tiles. I don’t need anything super accurate,…
How do I pass JavaScript values to Scriptlet in JSP?
Can anyone tell me how to pass JavaScript values to Scriptlet in JSP? Answer Your javascript values are client-side, your scriptlet is running server-side. So if you want to use your javascript variables in a scriptlet, you will need to submit them. To achieve this, either store them in input fields and submi…
In GWT, How can I get all attributes of an element in the HTML DOM?
I can’t see any method on the com.google.gwt.dom.client.Element class that allows me to get all attributes of an element node. Have I missed anything? Presumably I can get the attributes array of the underlying Javascript object by dropping into native code? I know the results are browser-dependent, but…
Download and open PDF file using Ajax
I have an action class that generates a PDF. The contentType is set appropriately. I call this action through an Ajax call. I don’t know the way to deliver this stream to browser. I tried a few things but nothing worked. The above gives the error: Your browser sent a request that this server could not u…