• Post Reply Bookmark Topic Watch Topic
  • New Topic

SQL:PARAM tag (type not found error)  RSS feed

 
namrata suri
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have used the following code snippet but am getting errors.

Here is the code:



The error I am getting is :

org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException:
INSERT INTO positions(id,job_title) VALUES (?,?)


: Type is not supported.
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)



 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ugh--I hope you're just prototyping and not using the sql tags for anything real.

Are both params filled when the page is run?
 
namrata suri
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi David,

No the code I posted is the actual code and in fact is from an eclipse tutorial. Even before the form comes up, I get an error. If i replace the ? with actual values, the code runs just fine, so i am guessing something is wrong with the sql:update - sql:param part. Unable to figure that out though.

Thank You.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The part where the parameters are filled in or not, like I asked.
 
namrata suri
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not able to figure that out because the moment I run the jsp, i get the error messages.

As in, the form should come first asking me to enter the values... but instead I directly get the error without getting a chance to fill the form.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you have a misunderstanding about how JSPs work: the server side stuff (custom tags, scriptlets, etc.) are run in their entirety on the server side. *Then* the rendered HTML is returned back to the client (the browser). Your SQL tags are executing with no parameter values unless you pass parameters in.

Once you fill out the form and submit back to the JSP (a bad practice, by the way) there are parameters so the tags won't fail.
 
namrata suri
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for clearing my doubts to some extent. I am new to jsp's and was following this tutorial.

http://www.eclipse.org/articles/article.php?file=Article-EclipseDbWebapps/index.html

Here, he has written a similar code and the parameters seem to be getting passed. I think its better if I write the sql code in another jsp.



 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code on that page does a check to see if there are parameters before attempting to use non-existent parameters.

IMO this is the worst kind of tutorial: it provides a working example, but is full of worst practices without any references to how to actually do things right.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66156
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Uggh! I just looked, and I agree with David.

I'd use that tutorial as a good example of what not to do!
 
namrata suri
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,
Thanks for the answers. I found my way around the problem. Did not realize the tutorial was that bad.

I guess the thread can be closed now.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!