Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to invoke JavaBean methods in JSP/JSF  RSS feed

 
koti satheesh
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a requirement , as part of that i have to get one UI value (JSP/JSF) , due to code avaialability the value i can't get in JSP directly for that i uses Javascript that value have to pass to JavaBean method which return some string. codes have given below

JavaBean method:


JSP code:
 
Tim Holloway
Bartender
Posts: 18704
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Koti!

We have a "Code" button on our message editor that helps make structured code (java, XML) easier to read. I've done some editing on your post to use it.

Actually, instead of monster blocks of code, it's easier for us if you mention exactly what you're trying to do. Ideally in "business terms", not in terms of specific logic, since often when you pre-select a technical solution it obscures the actual requirement and we may know a much easier solution.

I can say this much, however, without spending a lot of time poring over the code:

1. JSPs are no longer supported in JSF. That was dropped when JSF version 2 came out. You now use View Definition files (.xhtml). Incidentally, JSTL and JSF don't mix well.

2. Your "get" method is going to be horribly expensive. A "get" can be called up to about 6 times per page request, which means 6 database fetches. The get and set methods should avoid doing heavy-duty work or anything that alters bean state (side-effects).

3. Probably what you really need is some AJAX, but I see too many trees and not the forest, so I'm not sure.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!