Forums Register Login

How to invoke JavaBean methods in JSP/JSF

+Pie Number of slices to send: Send
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:
+Pie Number of slices to send: Send
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.
Life just hasn't been the same since the volcano erupted and now the air is full of tiny ads.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1026 times.
Similar Threads
pass a variable in the URl
Null value is coming
Foreign key field population from datatable to textbox?
Ajax, Struts, and a few pesky event based issues
JSF with fileupload and iframe
Thread Boost feature
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 17:21:56.