Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 4739 invoked from network); 11 Jan 2006 10:09:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 11 Jan 2006 10:09:52 -0000 Received: (qmail 78679 invoked by uid 500); 11 Jan 2006 10:09:39 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 77953 invoked by uid 500); 11 Jan 2006 10:09:37 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 77942 invoked by uid 99); 11 Jan 2006 10:09:37 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Jan 2006 02:09:37 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [217.158.103.214] (HELO maingate.mkodo.com) (217.158.103.214) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Jan 2006 02:09:36 -0800 Received: from smtp.uk1.mkodo.com (voyager.uk1.mkodo.com [192.168.11.233]) by maingate.mkodo.com (8.11.2/8.11.2) with ESMTP id k0BA9Eo10430 for ; Wed, 11 Jan 2006 10:09:14 GMT Received: from [127.0.0.1] (jjwlaptop.uk1.mkodo.com [192.168.11.239]) by smtp.uk1.mkodo.com (8.12.8/8.12.8) with ESMTP id k0BA96kT012589 for ; Wed, 11 Jan 2006 10:09:14 GMT Message-ID: <43C4D9E8.1070508@mkodo.com> Date: Wed, 11 Jan 2006 10:11:52 +0000 From: Jon Wingfield User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tomcat Users List Subject: Re: problem calling request.getParameter("myparameter") in jsp References: <20060110221659.12462.qmail@web54113.mail.yahoo.com> In-Reply-To: <20060110221659.12462.qmail@web54113.mail.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Your underlying problem is the exclamation mark at the start of your scriptlet. This makes the jsp ompiler put free standing code into the init method or creates methods on the servlet that you can call within your jsp. Without the exclamation mark the compiler inlines the scriptlet into the _jspService() method, which is the behaviour you require. So, you should have: <% String query = request.getParameter("display") ; %> instead of <%! String query = request.getParameter("display") ; %> HTH, Jon marju jalloh wrote: > I got it. HttpRequest throws an exception by enclosing > String query = request.getParameter("display") in a try and catch block everything was fine > marju jalloh wrote: I see > <%! String query = request.getParameter("display") ; %> > is declared in the init() of the servlet.I changed it but now I`m getting > > org.apache.jasper.JasperException > java.lang.NullPointerException which should not execute the query > > Can anyone throw licht on this > > Thanks > > > > marju jalloh wrote: Hi everyone > I `m writing a bean application to execute sql query.The query properties in the Bean works perfect.I have a jsp with textArea where the user can enter query.The query is the required parameter that the Bean should execute. > > snippet > ... > > > [input] > > > > <%! String query = request.getParameter("display") ; %> > > <% > if(!query.equals("") || !query.equals(null)) > { > String selector = (query.substring(0,6)).trim(); > out.write(selector); > if(selector.equals("SELECT")){ > out.write(myBean.getData()); > }else > if(selector.equals("INSERT")){ > myBean.setData(query) ; > }else > if(selector.equals("DELETE")){ > myBean.setDelete(query); > } > else > out.write("nothing is entered"); > } > %> > ... > My problem is when the jsp page is requested for the first time > I got this error: > cannot find symbol variable request. > I know I should have null for request.getParameter("display") at first access and that is caugt.If I submit the form then the content of the textarea should be > request.getParameter("display") .That was what I was expecting. > > Can anyone help > Thanks in advance > > > > > --------------------------------- > Yahoo! Photos > Got holiday prints? See all the ways to get quality prints in your hands ASAP. > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > > > --------------------------------- > Yahoo! Photos > Got holiday prints? See all the ways to get quality prints in your hands ASAP. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org