• 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

SEAM accessing clicked link's object on next page (SOLVED)

 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a page on which few hyperlinks are displayed. It's code is pasted below:



As you can see above, each hyperlink belongs to a java object whose class has name 'screen' under SEAM. Here's Screen class's code



My question is, when user clicks a hyperlink, how can I access corresponding screen object on next page. I am trying following on next page:



But I get nothing within second <h2> and </h2>. How do I access clicked link's object? Is it a scope thing for Screen class? I have tried Session and Event but to no use.
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<h:outputLink value="#{screen.url}">
<h:outputText value="#{screen.label}"/>
<f:param name="url" value="#{screen.url}" />
</h:outputLink><br></br>
<h:outputText value="#{screen.definition}"/>

In pages.xml, you can track it (event context)

<page view-id="/XXXXX.xhtml">
<param name="url"/>
</page>


Hope this helps!!
 
Varun Chopra
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Vivek, unfortunately that will not solve the problem.
I need whole screen object on next page, not url parameter only. I pasted simplified (next page) code to communicate requirement.
There must be a way in SEAM to propagate selected/clicked object to next page, I wonder if that has anything to do with its conversation scope.
Anybody to help please?
 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is how I do things with Seam, for cases like this.

First I create a SF bean. In this bean I would put your list of Screen objects, and an instance of the Screen (to select a specific one)




You can look up the annotations here.

Than a method to select the current screen, which you will call with your links...


So now if we change the first JSP a little bit..



So now the screenList is in the bean we just made as a list of screens (you'll have to populate it)
When you select a screen from your list, the DatamodelSelection annotation makes it really easy for us, and will automatically map the screen you clicked to the screen in the bean. Now you have that bean in the conversation and you can do whatever you want with it, before you end the conversation.

Let me know if that helped...I am still new to Seam myself...
 
Varun Chopra
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ryan for your help. I tried similar code earlier, but was not able to make that work. I am sure it will work and I was missing something (I was using ScopeType.Conversation for Screen object, not for the SB used to populate screen objects).

But good thing is problem is solved now with a very small change. I am still using ScopeType.EVENT for Screen object. Only thing changed is view file. Instead of using h: outputLink tag I am now using s: link with view attribute. Earlier I had tried s: link with action element and I was confused as to how to provide a JSP/JSF file to action which was supposed to call a method. I was not paying attention to view attribute of s: link. See the code below, it works and gives me selected screen object on next page:

 
LOOK! OVER THERE! (yoink) your tiny ad is now my tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic