1

I have a javascript variable say,

var a ='2013-01-03' 

I want to access this variable inside my scriptlet. i.e.] I have a map that contains my data.
I want to fetch the value of the map corresponding to the key='2013-01-03' that is in javascript variable 'a'.

How can i use like following in my scriptlet.?

map.get(a);

I know the scriptlets will execute first even then without reloading I want to access the variable a inside my scriptlet. Can any one help me solve this problem.?

2
  • Yes it is possible..If you provide some your code, I will try to do that Commented Mar 29, 2013 at 10:54
  • 3
    why this down vote for this question Commented Mar 29, 2013 at 11:06

2 Answers 2

1

You need to submit client data (javascript) to the server (servlets, jsp). You can do it without reloading a page using ajax.

Sign up to request clarification or add additional context in comments.

Comments

0

You have not mentioned the action for which to perform operation .Assuming If you are making call on focuslost then

$('#yourdom').blur(function() {
        serverCall;

    });




function serverCall{
        $('#yourdom').val('2013-01-03')

            $('#form').submit();


    }

In servlet

String value=request.getParameter("yourdom");
request.setAttribute("test",value);
RequestDispatcher rd = request.getRequestDispatcher("your.jsp");  
  rd.forward(request,response);

In jsp

<% request.getAttribute("test")  %>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.