Solved

invoking one line of jsp from javascript

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Problem with Pie chart in Jsp 20 180
simple jsp servlet and webservice web example 5 110
xjc and jaxb 2 88
java.util.concurrent.locks in java 3 177
This article explains in simple steps how to renew expiring Exchange Server Internal Transport Certificate.
In this article, I will show you HOW TO: Create your first Windows Virtual Machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, the Windows OS we will install is Windows Server 2016.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now