• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to invoke JavaBean methods in JSP/JSF

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic