• Post Reply Bookmark Topic Watch Topic
  • New Topic

passing a variable to a Bean's method  RSS feed

 
Charessa Reilly
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have these two methods in a Bean:





of I call the first method from inside eclipse, it writes a new record in the database and all is well.

If I try to call the method from inside a jsp file, thusly:


I get no errors, but the connection to the database never closes and the new record never gets written.

I feel so newb about this. I keep asking questions that probably make me look foolish.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're mixing JSTL and scriptlets?
 
Charessa Reilly
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so.. I take it that's a no no?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. JSTL and EL are meant to replace scriptlets and they are not designed to work together. Choose either to use discredited scriptlets or JSTL/EL, but not both. That's just a big ol' mess.
 
Charessa Reilly
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
aight.

So my understanding then is my other real option is to make a custom tag?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's one of many approaches. There are also custom EL functions, and other means. Which to choose depends upon the scenario.

But the first thing to always do is to ponder whether it's something that should have been handled in the controller rather than waiting until you get to the JSP.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!