Link to home
Start Free TrialLog in
Avatar of Officially DeCrazyyy
Officially DeCrazyyy

asked on

JSP BUTTON SWITCH USING SESSIONS

Using jsp sessions HOW TO SWITCH / (SWAP) THE LEFT AND RIGHT BUTTON  WHEN THE CLICK BUTTON IS PRESSED.?  refer screenshot. need to swich tthe button on click of the click button.
Avatar of gsk
gsk

HI Freind,

 <%
        if(request.getParameter("buttonName") != null) {
               session.setAttribute("status", "guest");
        }
    %>

    <FORM NAME="form1" METHOD="POST">
        <INPUT TYPE="HIDDEN" NAME="buttonName">
        <INPUT TYPE="BUTTON" VALUE="Button 1" ONCLICK="button1()">
        <INPUT TYPE="BUTTON" VALUE="Button 2" ONCLICK="button2()">
    </FORM>

    <SCRIPT LANGUAGE="JavaScript">
        <!--
        function button1()
        {
            document.form1.buttonName.value = "leftClicked";
            form1.submit();
        }



        function button2()
        {
            document.form1.buttonName.value = "rightClicked";
            form2.submit();
        }
        // -->
    </SCRIPT>


=====================================================
Hope above code helps to handle two buttons
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.