Solved

invoking one line of jsp from javascript

Posted on 2006-11-13
6
252 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
eclipse problems view not showing all the time 4 88
hashcode is calculated on the basis of value object 2 118
oracle fusion vs MQ 2 122
maven webservice example issue 2 144
Ransomware is a malware that is again in the list of security  concerns. Not only for companies, but also for Government security and  even at personal use. IT departments should be aware and have the right  knowledge to how to fight it.
Smart phones, smart watches, Bluetooth-connected devices—the IoT is all around us. In this article, we take a look at the security implications of our highly connected world.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

820 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