Solved

invoking one line of jsp from javascript

Posted on 2006-11-13
6
251 Views
Last Modified: 2010-04-01

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


0
Comment
Question by:ip_packet
  • 2
6 Comments
 
LVL 16

Expert Comment

by:Peter Kwan
ID: 17929401
You cannot do that, since the scriptlet are evaluated on serverside before the page is presented to the client side.
0
 
LVL 16

Accepted Solution

by:
Peter Kwan earned 138 total points
ID: 17929408
One way is to submit a form to the server side and process your statement and then return back to the input page.
0
 

Author Comment

by:ip_packet
ID: 17930180


>>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
 
LVL 11

Assisted Solution

by:Manish
Manish earned 137 total points
ID: 17930318
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

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
trouble with PDF encryption using itext-1.3.1 17 84
difference between member and local variables. 29 135
EJB MDB example 4 85
best way to search/remove a file from an EAR file 3 109
Each year, investment in cloud platforms grows more than 20% (https://www.immun.io/hubfs/Immunio_2016/Content/Marketing/Cloud-Security-Report-2016.pdf?submissionGuid=a8d80a00-6fee-4b85-81db-a4e28f681762) as an increasing number of companies begin to…
When you have clients or friends from around the world, it becomes a challenge to arrange a meeting or effectively manage your time. This is where Outlook's capability to show 2 time zones in one calendar comes in handy.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question