• 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 get javascript value into bean

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am having command links on my.jspx page, when I rigth-click on that command links my menupopup get executed.
I have put onmouseover javascript event, using that I am getting the value of that link.

now my problem is I want that value in backing bean. for that i have used hidden textbox but value is not getting displayed init.

so, how can I get the value of link in backing bean without pageload.
 
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

It makes it a lot easier if you post up some code, but I think I get it. You display a popup menu,
select an option which navigates to a target page. The target page knows which option was
selected.

I think I originally got this code from the Core JSF 3 book, with a bit of help from BalusC
http://balusc.blogspot.com/2006/06/communication-in-jsf.html.

I think the easiest way to do it is with URL parameters so that you don't require a hidden
input field. As a starting point you have a commandButton (you use a commandLink with a
right click but ignore that):

main.xhtml


showMenu.js


menuContents.xhtml


Then you need to be able to access the parameters in the page. There is an implicit object "param" for
this purpose:

editPage.xhtml


You can access the parameter from the editPage backing bean also:

EditPageBackingBean.java


There are some significant limitations of this simple example, whilst menuContents is passing
parameters to editPage it's all static data. You can pass parameters to menuContents.xhtml like
this:

main.xhtml (changes)


showMenu.js (changes)


I hope this is going to be of some help.

Brendan.
 
sam sami
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for replay,

My problem is I am not getting the value of selected node in backingbean, that's why I am using JavaScript.

Process -
1) tree in which tree node is defined as commandlink.
2) When I right click on tree node, I'll get menupopup which is having options like Open, Deleet etc.
3)When I click on any option, I have to get the selected Node and the menuitem value in backingbean for next process.

test.jspx -



.js (JavaScript)

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic