Rectangle 27 2

It looks like your are mixing things between javascript and jsp scriptlet.

onclick is a javascript event that occurs when an element gets clicked, in this case a button.onlick="" should reference a javascript function but in your code sample you have a scriptlet.

Scriptlet are executed when the JSP is invoked, so when the page loads.

Great.Thanks ! I'm kind of new to this. ! Now, how can I involke my java/jsp scriplet functions on the event of onclick of the Delete button in the code above? Can u help please.

javascript - JSP: Onclick code is being performed when on page load ev...

javascript jsp onclick onload
Rectangle 27 0

I am too late but if you are still facing this issue, use pure javascript setTimeout() and window.scrollBy() combination on your required event. I solved it onClick as I had to show images under tabbed panes where only the first loaded tab showed images when the page loaded but rest of the tabs didn't show when clicked until the user scrolls a bit. my code is below:

function myFunction() {
  setTimeout(function() {
    window.scrollBy(0, 100)
  }, 1000);;
}
<style>
  div {
    background-color: #FF9900;
    height: 999px;
    width: 100%;
  }
</style>

<a href="#" onClick="myFunction()">Click me to scroll after 1000 milliseconds</a>
<div></div>

It's a clever work-around, but it just masked the problem instead of solving it.

As I understand, not showing images until scroll is the very basis of writing Lazy Load plugin. So, if we try to change it, it might not work properly for the purpose it was seemingly built. The only solution remains is to mask the problem as needed. :)

lazy loading - jQuery LazyLoad do not load images until scroll - Stack...

jquery lazy-loading
Rectangle 27 0

onclick is client side event and you can only specify any javascript function which will be called when this event will occur. You can not specify any server side jsp/java function.

Hi Thanks ! How should i go about it if i need to call jsp/java function on the click of a button ?

onclick on a buttton, you need to call a javascript function which will send Ajax request to server, if you are using jquery you can see api.jquery.com/jQuery.ajax

javascript - JSP: Onclick code is being performed when on page load ev...

javascript jsp onclick onload
Rectangle 27 0

LiveEdit synchronizes html,css and javascrit using hotswap browser tab is not reloaded. But PHP and layout files (smarty, twig) can obly be synchronized using reload. Note also that not each and every change in javascript code results in immediate page update: new code is loaded to the browser instantly, but the results of the change will be visible only when you do something to trigger this new code. For example if you change the onClick handler and write new text in alert, you will see the new text after the click without reloading the page. But if the JS code is executed only on page load (and not on certain event), you have to manually reload the page to see the results - live edit doesn't force new code execution

And one more note: live editing for AngularJS doesn't currently work as expected - see WEB-7734 and related tickets

When connected, does intellij have a clue which resources make up the page ? Does intellij leverage path<->resource name mapping, or how does intellij figure out which changes need to propagate to chrome ? I mean assume I have a project directory /foo in intellij mapped to localhost/bar, and I update /foo/sample/test.css which is referenced as /bar/sample/test.css from the page. That should be working, right ?

right. But you need to make sure that the mappings are available to WebStorm - it needs to know what web URL the certain local file is mapped to. This is what 'remote URL' field in javaScript Debug run configuration is used for

Just tried it again with Javascript and found Chrome does not pick up changes I make in Intellij when http is used. Breakpoints, and stack works as expected. What a pity. :(

works fine for me. Please file a bug to youtrack providing the details (sample project is welcome) or create a support ticket

intellij idea - What kind of changes does Chrome pick up using Live Ed...

google-chrome intellij-idea webstorm
Rectangle 27 0

Actually Live Edit works in both cases. But changes in embedded javascript always cause page reloading, whereas changes in 'external' javascript are hotswapped - just as for HTML and CSS. But not each and every change in external javascript code results in immediate page update: new code is loaded to the browser instantly, but the results of the change will be visible only when you do something to trigger this new code. For example if you change the onClick handler and write new text in alert, you will see the new text after the click without reloading the page. Same for functions triggered by timer But if the JS code is executed only on page load (and not on certain event), you have to manually reload the page to see the results - live edit doesn't force new code execution

Note also that hotswapping doesn't currently work for file-level variables due to Chrome limitations - see WEB-7390

Webstorm Live Edit not working for an external JavaScript file - Stack...

javascript webstorm liveedit
Rectangle 27 0

You need to construct a delete url with an Unique Id to identify the deletion row from the server side and reload the full page again.

<a href="/yoururl?mode=delete&id="+<Unique Id>>Delete Row</a>
if("delete".equals(request.getParameter("mode"))
{
String id = request.getParameter("id");

// write code for deletion
}

//redirect to the same page again

If you don't want to reload the full page, then you have to write ajax calls to perform deletion in the server side and use javascript remove the row from the table

javascript - JSP: Onclick code is being performed when on page load ev...

javascript jsp onclick onload
Rectangle 27 0

It looks like your are mixing things between javascript and jsp scriptlet.

onclick is a javascript event that occurs when an element gets clicked, in this case a button.onlick="" should reference a javascript function but in your code sample you have a scriptlet.

Scriptlet are executed when the JSP is invoked, so when the page loads.

Great.Thanks ! I'm kind of new to this. ! Now, how can I involke my java/jsp scriplet functions on the event of onclick of the Delete button in the code above? Can u help please.

javascript - JSP: Onclick code is being performed when on page load ev...

javascript jsp onclick onload
Rectangle 27 0

You need to construct a delete url with an Unique Id to identify the deletion row from the server side and reload the full page again.

<a href="/yoururl?mode=delete&id="+<Unique Id>>Delete Row</a>
if("delete".equals(request.getParameter("mode"))
{
String id = request.getParameter("id");

// write code for deletion
}

//redirect to the same page again

If you don't want to reload the full page, then you have to write ajax calls to perform deletion in the server side and use javascript remove the row from the table

javascript - JSP: Onclick code is being performed when on page load ev...

javascript jsp onclick onload
Rectangle 27 0

onclick is client side event and you can only specify any javascript function which will be called when this event will occur. You can not specify any server side jsp/java function.

Hi Thanks ! How should i go about it if i need to call jsp/java function on the click of a button ?

onclick on a buttton, you need to call a javascript function which will send Ajax request to server, if you are using jquery you can see api.jquery.com/jQuery.ajax

javascript - JSP: Onclick code is being performed when on page load ev...

javascript jsp onclick onload