invoking one line of jsp from javascript


Hi all,

Im trying to call a piece of jsp code from within a javascript function like so:

function reset()
{
alert("change made");
<%
session.removeAttribute("value");
%>
}

<html:select property="process" onchange="reset()">

The alert gets called when its supposed to, in that every time I make a change the alert gets displayed. But everytime the user visits the page the line:
session.removeAttribute("value");
gets called when it should be just called when the function reset in invoked.

Any help is greatly appreciated.

Thanks


ip_packetAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Peter KwanConnect With a Mentor Commented:
One way is to submit a form to the server side and process your statement and then return back to the input page.
0
 
Peter KwanCommented:
You cannot do that, since the scriptlet are evaluated on serverside before the page is presented to the client side.
0
 
ip_packetAuthor Commented:


>>process your statement and then return back to the input page

Do you mean use javascript to re-direct to a jsp page and then do the processing on that page?
0
 
ManishConnect With a Mentor LeadCommented:
You are not using any servlet ? just submit the form to that servlet or jsp (if you are using jsp) ,remove whatever value you want to remove from session , come back to same page..with values.
0
All Courses

From novice to tech pro — start learning today.