This question already has answers here:
back commandbutton in jsf
(5 answers)
Closed 8 years ago.
How do I make a link which navigates the user back one page (i.e. same as clicking browser back)?
Thanks.
To the point: just remember the request URL or the JSF viewId of the previous page so that you can use it in the href or value of the output/commandlink. There are several ways to achieve it, depending on how you're actually navigating through the pages and how "jsfish" you want to achieve it. You could pass it as a request parameter by f:param in h:outputLink, or you could set it as a bean property by f:setPropertyActionListener in h:commandLink, or you could create a PhaseListener which remembers the viewId and make use of navigation cases, or you could grab the -much less reliable- JavaScript history.go() function.
Related
This question already has answers here:
How to find out client ID of component for ajax update/render? Cannot find component with expression "foo" referenced from "bar"
(6 answers)
Closed 4 years ago.
I have such id of dialog form form:processFilterPanel_fpanel_tv:dialogFormIO:j_idt195:ItemWidget_input
And I want to work with one element of form at backend side. The problem that this part of id j_idt195 is always changing by jsf (when it starts a new session) and I don't know how to get it. Have any ideas?
Just use id="yourFavId" on the component and reference it.
JSF gives those weird looking ids to the html components that didn't have a defined one.
This question already has an answer here:
Difference between h:link and h:outputLink
(1 answer)
Closed 5 years ago.
Why does this JSF Tag
<h:link outcome="hello/sayhi">Spring MVC</h:link>
<h:outputLink value="hello/sayhi" >Spring MVC</h:outputLink>
becomes
<span>Spring MVC</span>
Spring MVC
in the browser so that the <span> is completely useless?
How can I get h:link working so it outputs the correct link including the context path?
The component h:link requires a valid (and existent) outcome target, if for any reason the server do not find the outcome target in your project, then a span will be rendered.
In this case, review your application files and check if the target "hello/sayhi" really exists and is declared correctly. Maybe you are just forgetting a bar ("/hello/sayhi") before the path (it's impossible for us to know).
According to it's documentation, an h:link should only render as a span if you set it as disabled=true. So I'm 100% sure that your problem really is a incorrect navigation path.
This question already has answers here:
Clear JSF form input values after submitting
(5 answers)
Closed 5 years ago.
I'm developing a project using JSF and Primefaces and I got some forms.
Every time I open those forms all fields are already filled with the last information I saved on database.
I'd like every time I open those forms all fields were blank.
How can I do this?
Thank you!!
What Scope are you using in your managed bean? if you are using session scope for example it will hold the last values of your bean properties as long as the application session exists. Depending on what you doing, I would use request scope instead. This will delete the bean when it is not being use and therefore clear the values when you request again. Or perhaps view scope, this will keep the values as long as you are in the same view. Another way would be to use javascript to clear the values by Ids.
if u are using
#SessionScoped
Try to change to :
#ViewScoped
This question already has answers here:
Conditionally displaying JSF components
(3 answers)
Closed 6 years ago.
I wanna add this action.
If EL is 'true' like this, #{trueFalseBean.isTrue}, I wanna pop up message without pressing any button like 'onload();', otherwise no action. How can I use if, else clause on JSF or PF? Please help me thanks
Define a boolean variable in your bean and set it with a method when an action is started. Then use variable last situation to make something.
This question already has an answer here:
How to decrease request payload of p:ajax during e.g. p:dataTable pagination
(1 answer)
Closed 6 years ago.
I am facing such a problem. I want to refresh one internal element of a h:form, a p:dataList, and in order to do it I have
<p:remoteCommand name="updateSet" update="import-statuses-admin-list" process="import-statuses-admin-list"/>
Function updateSet is called in every 5 seconds. The thing is that, there are some other elements in my form and they are also sent, eg.
<h:selectOneMenu value="#{importXmlManagementBean.statusFilter}" id="statusFilter">
I'd rather have only this list p:dataList submitted, without sending all form.
Is it normal behaviour or I am missing something?
Add to remoteCommand the attribute update with the id of the datalist you want to update, and in the process specify the same.