0

Hello Everybody,

Right, so I would like to see whether I can store a string in my session and send that over to my database.
For example, in a function that I have produced, I would like that function to return a string called "first step", I would like to send that string in a session to my JSP page that will in turn give that string to the servlet to enter to my database, any ideas please?

I have read about using an input hidden field, but I have not had all the required information to start coding it that way. Any help is much appreciated.

Thank you

3
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by omaiaa0p
0

I believe that the session value is stored in the server side (possible HTTPSession or whatever it is called). What you are looking for is to send a new value to the server, not manipulating session value from the client side. If you are going to use hidden field, just put the hidden field specify 'name' property inside the form that you may also have your session ID hidden as well. If a user submit the form, then your server side would be able to get the hidden value you want.

0

so, if I have an input field say

<FORM ACTION="GetSession.jsp" METHOD="post">
            <input type="text" name="text1">
            <input type="hidden" name="hidden" 
                value="<%= text%>">
            <input type="submit" value="Set Hidden Text">
        </FORM>

How can ( in javascript) a function send this session to the Servlet?

Please clarify your answers when replying

0

I believe that the session value is stored in the server side (possible HTTPSession or whatever it is called). What you are looking for is to send a new value to the server, not manipulating session value from the client side. If you are going to use hidden field, just put the hidden field specify 'name' property inside the form that you may also have your session ID hidden as well. If a user submit the form, then your server side would be able to get the hidden value you want.

Taywin, your response is not very clear to me. How would the input hidden be called, I assume this is a form, how can this be implemented, may you please clarify

0

Note that JSP pages are used with Java, which is not the same as JavaScript.

Thank you :) I am aware of the difference

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.