This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have attached the code. It is a POST, but I don't think it reliably fails on all browser/server combos, just the one that happens to matter I would be interest hearing more about the AJAX route. By the way, the bold line is where I am trying to stuff info into the session. It happens to execute because the authors of the code happened to also create a Java variable called sCommand in the jsp file (which does not have the correct value), how convenient.
If the method is post, I don't see how you are hitting any length restrictions.
Using jQuery for Ajax (life is just too short to do Ajax "by hand"), something along the lines of:
should do the trick (assumes JSP to get the context path).
This will post back to a servlet with parameters for the name and value that the servlet can create in the session/
Joined: May 07, 2009
Thanks for the example. We weren't using jQuery in the past, but I guess we are now as I have implemented that and downloaded the jQuery js file. Just a small question of clarification. It is my understanding that when I use jQuery.post as you have showed me, I would then reference the name as request.getParameter(name) where name is the name I have selected for my data ('gmids' was my example). Is this correct? I have sort of a double submit example which is why I was thinking session. The code I demonstrated prepares a form to be submitted so first I was trying to store that 'gmids' in a session (which is post #1 via jQuery) and then submit the generated form (post #2) which would clear the parameter I just set in jQuery post. Would you recommend I try to combine the two posts . The remained of the original function is:
Sorry, can't follow all that. How about backing up and describing what you are actually trying to accomplish. It sounds like you may be over-complicating the whole thing.
Joined: May 07, 2009
Trying to pass a long list of dynamically generated ids from one jsp to another. The page which generates the ids has its form dynamically generated. Therefore, I need to dynamically generate the form and in the process include the ids before executing a submit to navigate to the next jsp. I can not include the ids directly in the form, because there are too many and a white screen would result. I would like to pass the ids separately from the form itself because the creation of the form is so complex/involved.