jsf-2

JSF files inside WEB-INF directory, how do I access them?

こ雲淡風輕ζ 提交于 2019-12-17 06:46:40
问题 I want to put my JSF 2.0 xhtml files under WEB-INF\jsf. How do I access them then? I know that anything inside WEB-INF isn't exposed to the outside, so I need a controller to redirect me to the corresponding JSP, right? (This is also the model 2 pattern iirc). Can I achieve this with a parameter inside web.xml/faces-config.xml? I think the FacesServlet is the controller of my webapp so it should serve this purpose? And another question for understanding the Model 2 Pattern. Does every action

PrimeFaces <p:fileUpload mode=“advanced”> validator not fired

佐手、 提交于 2019-12-17 06:46:33
问题 since fileLimit doesn't exist in primefaces 3.4 anymore I'm trying a work around implementing a validator, the problem is that the method validate is never invoked. That's my Validator: @FacesValidator(value ="fileLimitValidator") public class FileLimitValidator implements Validator { @Override public void validate(final FacesContext context, final UIComponent component, final Object value) throws ValidatorException { final String fileLimit = (String)component.getAttributes().get("fileLimit")

How to use p:graphicImage with StreamedContent within p:dataTable? [duplicate]

老子叫甜甜 提交于 2019-12-17 06:45:35
问题 This question already has answers here : Display dynamic image from database or remote source with p:graphicImage and StreamedContent (4 answers) Closed 4 years ago . I want to dynamically load images from a database withing a PrimeFaces data table. Code looks like as follows which is based on this PF forum topic: <p:dataTable id="tablaInventario" var="inv" value="#{registrarPedidoController.inventarioList}" paginator="true" rows="10" selection="#{registrarPedidoController.inventarioSelected}

could not find Factory: javax.faces.context.FacesContextFactory

狂风中的少年 提交于 2019-12-17 06:38:08
问题 I notice that when trying to setup my JSF 2 webapp running on jetty, i have this error : java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory which is easily solved by adding this to my web.xml <listener> <listener-class> com.sun.faces.config.ConfigureListener </listener-class> </listener> I've tried searching for a detailed explanation but in futile .. jetty-maven-plugin:8.0.3.v20111011:run + jdk

What is the function of @this exactly?

旧街凉风 提交于 2019-12-17 06:36:19
问题 As far as I know the @this is to denote the current component triggering the event, such as : <p:commandButton process="@this" ... /> And in JSF 2 Ajax, the @this can also mean the encapsulating component, like : <h:inputText ...> <f:ajax execute="@this" ... /> </h:inputText> And I have one case where using p:datatable , including or excluding @this can have a different impact upon Ajax partial submit Here's the example, in this case, the process is using @this , and this works as expected,

How to save state when extending UIComponentBase

 ̄綄美尐妖づ 提交于 2019-12-17 06:14:31
问题 I'm creating a composite component that will wrap a datatable to implement very simple paging. I need to save state (the current page number) between ajax requests. I tried creating fields in my FacesComponent, but I discovered they are wiped out during the JSF lifecycle: @FacesComponent(value = "bfTableComponent") public class BFTableComponent extends UIComponentBase implements NamingContainer { private int currentPageNumber; ... I can't seems to find a concise guide to doing this anywhere!

Does view scope bean survive Navigation JSF

元气小坏坏 提交于 2019-12-17 06:10:11
问题 I am quite confused with the view scope. I thought it could survive a JSF navigation to another page (no redirect, obviously), but it doesn't. So what's the advantage to use it instead of request scope, that if i summoned the same view it will be the same object? 回答1: The advantage is that the bean survives postbacks to the same view. You don't need to preserve any data yourself anymore when used in rendered attributes or as model for h:dataTable or as hidden inputs, etcetera. In the past, a

How control access and rights in JSF?

送分小仙女□ 提交于 2019-12-17 05:45:25
问题 I would like to control the access after the user log in my system. For example: administrator : can add, delete and give rights to employee employee : fill forms only ... So after knowing which right the user has, checking in database, I would like to restrict what this user can see and do. There's a simple way to do that ? EDIT @WebFilter("/integra/user/*") public class LoginFilter implements Filter { @Override public void doFilter(ServletRequest request, ServletResponse response,

How and when is a @ViewScoped bean destroyed in JSF?

我怕爱的太早我们不能终老 提交于 2019-12-17 04:59:53
问题 The lifecycle of the @RequestScoped and @SessionScopedBean managed beans are managed by the Servlet container itself since they are basically stored as an attribute of HttpRequest and HttpSession respectively. How do JSF manage the lifecycle of the @ViewScopedBean ? I know it gets created when the view is created and is usable till there is a postback to a different view. But I found out that is not garbage collected immediately after we move from that view. 回答1: It will be destroyed when a

How to programmatically send POST request to JSF page without using HTML form?

穿精又带淫゛_ 提交于 2019-12-17 04:35:15
问题 I have very simple JSF bean like shown below: import org.jboss.seam.annotations.Name; @Name(Sample.NAME) public class Sample { public static final String NAME="df"; private String text = "text-test"; public void sampleM(){ System.out.println("Test: "+text); } public String getText() { return text; } public void setText(String text) { this.text = text; } } And JSF form connected with this component: <h:form id="sampleForm"> <h:commandButton id="sampleButton" action="#{df.sampleM()}" value="ok"