tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marju jalloh <jallohma...@yahoo.com>
Subject Re: problem calling request.getParameter("myparameter") in jsp
Date Tue, 10 Jan 2006 22:16:59 GMT
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 <jallohmarju@yahoo.com> 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.
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message