JavaScript and JSP
First, I did my research and already know that JavaScript = client JSPs = server. I don't want to waste time.
My situation is that I want to execute JSP code from an event (not from an HTML form).
I have an HTML link ( <a href="...">XXX</a>
) that is not in tags <form>
; it's just a regular HTML link. Through Javascript I will be able to get the href value and store it in a hidden input field. Instantly after that, I want to execute request.getAttribute ("...") and pass the parameter between JSP pages.
Now I know how to do the last part (that is, get the request.getAttribute code to continue executing JavaScript code instantly.
Anyone have any advice?
Thankyou, Lucas
a source to share
You cannot run JSP code like this.
The JSP code, as you said, runs on the server side, so you cannot run it from a web browser.
If you are just trying to pass a parameter between JSP pages, you can add that parameter to the URL's queryString when you call the second JSP, and inside of it, request.getAttribute () is used.
Remember that the JSP code is executed before the page is sent to the browser.
Hope this helps.
a source to share