• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

newbie question on passing parameters

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm tempted to post this on the beginner's forum, but because it is specifically regarding JSP and JSTL, I'll put it here, with apologies that it's a much more simple question than you might want to see here.

I'm new-ish to jsp.

I'm using the newest versions of Tomcat and JSTL.

I am trying to do something relatively simple: Have a user input a string on a form, and then have that string passed to a .jsp page. For some reason, which I'm guessing is probably something very, very basic that I'm missing, the parameter isn't getting passed.

Here's the form (add_form.html):


and here's the jsp page (adddoc.jsp):


So--the combination of these two neither updates the database nor prints out the input string from the form on the page.

If I create a form which includes the adddoc.jsp stuff within itself, then once I fill out the form and click 'submit', everything goes as planned--the database gets updated, and the value of the input gets printed out to the screen (adddocform.jsp):

So, I'm thinking that I'm not doing something that needs to be done to get the parameter to get passed from the form to the .jsp.

Any ideas? I'm using a great book, "JSTL in Action," but according to the book--as far as I can tell--my code should work. So.

Thanks in advance for your help.
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I'm using the newest versions of Tomcat and JSTL.



Version numbers please.

With regards to determining whether it's the form submission that's the problem or not, simplify. Remove the SQL stuff from the page and make sure that the value of "d" is making it through.

As a beginner, I'd be remiss if I did not point out that performin SQL operations on a JSP page is generally severly frowned upon as a heinous violation of the principle of "separation of concerns". I'd advise getting off on the right track early on and factoring your business logic out of the pages and into Java classes.
[ March 16, 2006: Message edited by: Bear Bibeault ]
 
Jeff Pollet
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bear--

Thanks for the quick response, and the advice.

JSTL version 1.1(2.0) and Tomcat 5.0 are what I'm using, if that helps.

I also appreciate the heads up on keeping business logic out of jsp pages. I'm doing this as a learning exercise for myself--in fact the applications that I deal with only use jsp pages to do simple select statements from simple databases for reports on what's in the database and such, and I'm just trying to expand my knowledge using them as starting points. I also understand that even select statements in jsp pages are frowned upon.

I took your advice and took out the sql stuff and tried to run things without the sql stuff, and the param was passed just fine. I then reinserted the sql stuff and IT works now too. So, I'm sort of back to square one (except that it now works!) and recognizing that I must have been doing something wrong in the implemetation of the code (along the lines of Tomcat not using the version of the .jsp that I thought it was, but not that, since I think I've checked and double checked all of that).

At any rate, thanks for your help!

(Was this an ok question for the jsp forum, or did it belong in the beginner forum?)
 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Glad to have helped in that round-a-bout way!

You question most certainly belongs here. The beginner forum is for general Java questions. Had you posted your question there, being JSP-specific, it would most certainly had been moved here.
 
Jeff Pollet
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And not to be too obsequious, but your advice to simplify it and try it again is just generally good advice to we newbies, so thanks!
 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you also want to look at uour uri's. You my have the jstl 1.1 jar's, but you are using the 1.0 uri's. The 1.1 ones look like this:

http://java.sun.com/jsp/jstl/core
 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good catch, Clifford!
 
Jeff Pollet
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Clifford--

Thanks for that information...you are right, of course, and now you've got me to double-check and I am indeed NOT using 1.2 as I had thought.

Just goes to show that my learning curve seems to be pretty steep here! Thanks again for the help.
 
Alas, poor Yorick, he knew this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic