Hello, we have a JSP application running from eclipse. If we try to post a form to another JSP page, all pot variables returns null using request.getAttibyte o r request.getParameter. If we post the same form to the same page, the getParameter function works fine. Any ideas? Thanks
I feel you forgot to mention a lot in your post. I could bet that either there's something in the middle between your JSPs or you simply get the stuff the wrong way.
Code:
String myParam = request.getParameter("myParam");
1. If there's a servlet in the middle involved make sure you forward the request object.
2. Do not use redirect or the data will be lost.
3. Try to use GET method in the sending form to see the parameters in the url string and where they are being lost.
4. getAttribute() method has nothing to do with form parameters since custom request attributes are set manually.
To determine the nature of your problem your code is needed, better of both JSPs.
Wanna install linux on a vacuum cleaner. Could anyone tell me which distro sucks better?
I had a nightmare last night. I was dreaming that I’m 64-bit and my blanket is 32-bit and I couldn’t cover myself with it, so I’ve spent the whole night freezing. And in the morning I find that my blanket just had fallen off the bed. =S(from: bash.org.ru)
//always looking for job opportunities in AU/NZ/US/CA/Europe :P
willCodeForFood(Arrays.asList("Java","PHP","C++","bash","Assembler","XML","XHTML","CSS","JS","PL/SQL")); USE [code] TAGS!Read this FAQ if you are new here. If this post was helpful, please rate it!
I have a simple page that contains a form: testJsp.jsp, it calls prueba.jsp which receives the post vars and print them. There's nothing in the middle.
Didn't have time to see the problem right away... Have just tried to run it.
The problem with your pages is that you do not set name attribute for form fields, as soon as you set it all works fine. In other words the request does contain your params but under object addresses, each param does not have a name assigned to it, so when you try to print em out using getParameter() obviously nothing happens.
Last edited by Xeel; March 10th, 2010 at 04:09 PM.
Wanna install linux on a vacuum cleaner. Could anyone tell me which distro sucks better?
I had a nightmare last night. I was dreaming that I’m 64-bit and my blanket is 32-bit and I couldn’t cover myself with it, so I’ve spent the whole night freezing. And in the morning I find that my blanket just had fallen off the bed. =S(from: bash.org.ru)
//always looking for job opportunities in AU/NZ/US/CA/Europe :P
willCodeForFood(Arrays.asList("Java","PHP","C++","bash","Assembler","XML","XHTML","CSS","JS","PL/SQL")); USE [code] TAGS!Read this FAQ if you are new here. If this post was helpful, please rate it!
Hi, I put the name in the fields that didn't have it, and I hace still the same error. If you see the first textarea did have the name: <textarea
class="required" rows="4" cols="30" name="txtObjeto" id="txtObjeto"></textarea>
I ran the thing in Tomcat6 compiled with java 1.5 and 1.6 in Eclipse. Worked fine for me as soon as I set the inputs names.
1. Have you tried to use GET method instead of POST? What do you see in the URL?
2. Have you ever got to the second jsp? If yes, what is the printed output there?
(please use exactly the same jsps you attached before, and if you change them, please reattach)
Last edited by Xeel; March 11th, 2010 at 01:29 PM.
Wanna install linux on a vacuum cleaner. Could anyone tell me which distro sucks better?
I had a nightmare last night. I was dreaming that I’m 64-bit and my blanket is 32-bit and I couldn’t cover myself with it, so I’ve spent the whole night freezing. And in the morning I find that my blanket just had fallen off the bed. =S(from: bash.org.ru)
//always looking for job opportunities in AU/NZ/US/CA/Europe :P
willCodeForFood(Arrays.asList("Java","PHP","C++","bash","Assembler","XML","XHTML","CSS","JS","PL/SQL")); USE [code] TAGS!Read this FAQ if you are new here. If this post was helpful, please rate it!
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.