Skip to content

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…

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…

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…

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…