By Ramakrishna on Jul 24, 2008 in JSF Interview Questions | 0 Comments
Q) How to show Confirmation Dialog when user Click the Command Link?
A)
h:commandLink assign the onclick attribute for internal use. So, you cannot use it to write your own code. This problem will fixed in the JSF 1.2. For the current JSF version you can use onmousedown event that occurs before onclick.
<script language=”javascript”> function ConfirmDelete(link) [...]
By Ramakrishna on Jul 24, 2008 in JSF Interview Questions | 0 Comments
Q) How to get current page URL from backing bean?
A) You can get a reference to the HTTP request object via FacesContext like this:
FacesContext fc = FacesContext.getCurrentInstance();
HttpServletRequest request = (HttpServletRequest) fc.getExternalContext().getRequest();
and then use the normal request methods to obtain path information. Alternatively,
context.getViewRoot().getViewId();
will return you the name of the current JSP (JSF view IDs are basically [...]