how to assign javascript variable value to a jsp variable?

i 've following code

    Document   : Form_jsp
    Created on : May 19, 2012, 12:28:32 PM
    Author     : Srihari

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page language="java" %>
<%@ page import="newpackage.NewClass"%>
<!DOCTYPE html>
        <TITLE>Using Buttons</TITLE>

        <form name="form1" id="form1" method="POST">

            <input type="button" value="Button 1" onclick="button1()">

            <SCRIPT LANGUAGE="JavaScript">
                function button1()
                    var v="XXXXXXXX";
                <% String name = "<script>document.writeln(v)</script>";%>
                <% NewClass demo = new NewClass();%>
                        var Data=<%= "\"" + demo.GetData(name) + "\""%>;

in this i am getting alert as

"some data from the class NewClass +<script>document.writeln(v)</script> "

instead of "some data from the class NewClass +XXXXXXXX"

please help me in this scenario.