Problem Finding Value from List
Okay, so here's the setup... I have main.xhtml file that displays four links to the user. These links are categories that determine what category is viewed on the next page. The categories are in a database, and are pulled into a List. I use this list to create the links. Note** I decided to do it this way, so when it's time to add more categories, I can update the database, and not have to create more JSF.** The problem I have is that I cannot figure out how to pass the selected category back to my Java class. Here is what I have for the links...
HTML Code:
<h:form>
<div id="indexRightColumn">
<ui:repeat var="category" value="#{vpsForm.category}">
<div class="categoryBox">
<h:commandLink action="#{vpsForm.findForward}">
<span class="categoryLabelText">#{category}</span>
<img src="#{initParam.categoryImagePath}#{category}.png"
alt="#{category}" class="categoryImage"/>
</h:commandLink>
</div>
</ui:repeat>
</div>
</h:form>
I can get all the links to display and function, all I need is a way to set my selctedCategory var in my Java class so I can prepare my next page. Please note I am using JSF here and not Struts. However, if I absolutely have to use the actionForward from Struts, I guess I will. But I'd like to avoid that if at all possible...
Re: Problem Finding Value from List
Do NOT post the same question within the forums more than once, as it breaks forum policy.
Additionally, out of both your posts, you haven't placed it questions under the correct sub-forum, as Java Server Faces is a web framework.
Original question found here: http://www.javaprogrammingforums.com...html#post57675
Re: Problem Finding Value from List
The above said, Lets see where you're at with this.
As I'm sure you're aware, JFS relies on correctly built beans, from which it will call the getters or setter appropriately.
To set a value, you would take input from the user using a textfield, from which you would send the value to the backing bean.
E.g:
<h:inputText id="catGuide" value="#{catalogue.location}"/>
In that above example, If I remember correctly, JSF would assign the text from the textfield to a 'location' variable found in your backing bean, using a method called setLocation().
Does that answer any queries you have?
Re: Problem Finding Value from List
I do have all the variables being set in a backing bean. Problem is, because the links are being set from a List, I don't think the page knows what link is being clicked (or at least I don't know how to relay that back to the bean.