• 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
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
Bartenders:
  • Himai Minh
  • Carey Brown
  • Frits Walraven

Weld - passing parameters

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I have a method which gets an entity from db. It's a standart method:


I'd like to use the @Produces annotation, something like this:



and in a JSF managef bean



but i don't know how to pass the id to the method. Is it possible? How to do this?

Thanks for any help.
 
Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi. The int id is an injection point in a producer method, so you need to create a bean / producer that is able to produce values of type int / Integer (these are treated identically). You take the id from somewhere, so once you get it, you could put it to a static (yuck) variable somewhere (directly or calling a method, both suck) to a Bean that also has a producer method that returns this variable. To avoid statics you could also inject the Bean that has the producer method for the int, and call some arbitrary method on it to set the value to the id. It would probably be session / request scoped I suppose. Something along these lines will work.
 
Rototillers convert rich soil into dirt. Please note that this tiny ad is not a rototiller:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic