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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]