jsf-2

JSF 2 and a link to file system

走远了吗. 提交于 2019-12-11 09:08:38
问题 I need to provide a link to a file in the server's filesystem. In plain HTML something like this does it: <a href="C:\Users\user\resources\147ebg.jpg">Image or word doc or whatever</a> But I can't seem to get this simple thing working with JSF 2. I tried h:outputLink like this: <h:outputLink value="C:\Users\e\workspace\IDEXRoughAuctions\WebContent\resources\147ebg.jpg" id="test1">Testing output link</h:outputLink> but when I click on the link nothing happens. (I tried windows and unix style

Primefaces Selectors: How to exclude some components when updating the closest form?

倾然丶 夕夏残阳落幕 提交于 2019-12-11 09:05:25
问题 I'm using a PrimeFaces commandButton to issue an Ajax request. I should set the update attribute so that the whole parent form be updated EXCEPT for some specific components (Let's say I've tagged them with styleClass="noupdate" ). I'm using PrimeFaces 3.5, so I think PrimeFaces JQuery Selectors may help. I tried something like this: <!-- ...some inputs/labels to be updated here... --> <p:overlayPanel styleClass="noupdate"> <!-- ...some inputs/labels to be updated here... --> <p:commandButton

Is there a converter for String?

浪子不回头ぞ 提交于 2019-12-11 09:03:38
问题 For converting String values in JSF bean validation, which converter will be used? Like for numeric values we use <f:convertNumber> and for date we use <f:convertDataTime> . My code snipest are as follows: JSF page: <h:inputText id="Name" label="Name" value="#{employee.eName}"/> <h:message for="Name" styleClass="errorMessages"/> Bean class: public class Employee implements Serializable{ @NotNull @Size(min = 3, max = 30) String eName; } 回答1: String doesn't have a default converter. Request

NotSerializableException in ViewScop Bean in JSF

China☆狼群 提交于 2019-12-11 08:58:47
问题 The code written below is to download the file from the database by using JSF2.0/Primefaces. The code below which is SessionScoped Bean runs perfectly fine and I am able to download the stored file @ManagedBean @SessionScoped public class FileProcessBB{ private ScreenDisplayData screenDisplayData; public void selectAttachment() { AttachedFileTable attachedFileTable = new AttachedFileTableManager().getAttachedFileById(screenDisplayData.getSelectedAttachedFileBO().getAttachedFileTableId());

Including jsp in jsf gives exception as Input length = 1

柔情痞子 提交于 2019-12-11 08:53:27
问题 I have below code in jsp myDisplayImage.jsp <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <h1>Hello World!</h1> <%@ page import="java.sql.*"%> <%@ page import="java.io.*"%> <% Blob image = null; Connection con = null; byte[] imgData = null; Statement stmt = null; ResultSet rs = null; try { Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql://localhost:8889/mySacDB",

Commandbutton in panelgroup

爷,独闯天下 提交于 2019-12-11 08:47:10
问题 I have a page which takes a GET parameter, for example: /manageSquare.xhtml?squareName=foobar . This page has a backing bean that is request scoped. To properly initialize the backing bean, the bean includes a initialize method which will be called since the page includes a <f:metadata> with an <f:viewParam> and <f:event type="preRenderView ...> . Sometimes the square does not exist, and some special error message will be shown. Therefore there is a <h:panelGroup rendered="#{squareBean

no redirect to page specified in web.xml

▼魔方 西西 提交于 2019-12-11 08:42:59
问题 in my JSF application whenever an exception occurs, it should display a JSF page, which I designed to show the user that an error occurred, but no such thing happens, that's the big problem. Part of my web.xml <error-page> <exception-type>java.lang.Exception</exception-type> <location>/faces/error.jsf</location> </error-page> <error-page> <error-code>500</error-code> <location>/faces/error.jsf</location> </error-page> 回答1: That can happen when the exception occurs during an ajax request, or

How to upload file in JSF

守給你的承諾、 提交于 2019-12-11 08:35:17
问题 Actually I'm creating an application for uploading file using JSF. But whenever I upload a file and click send it shows NullPointerException . The code I have used for the application is: code for JSF using Tomahawk: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%> <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%> <%@ taglib prefix="t" uri="http://myfaces.apache.org/tomahawk"%>

Disable page jumping to the top after commandButton is clicked

大憨熊 提交于 2019-12-11 08:28:35
问题 I got a <h:commandbutton> like <h:commandButton value="Neuer Abschnitt" styleClass="btn btn-primary btn-info" action="#{beitragBearbeitenBean.erstelleAbschnitt}" /> Well, I click onto the button, the method is called and after that, the page is jumping to the top (provied you are not at the top!) Interestingly, a <f:ajax execute="@form" /> does offer a little jump up. How can I avoid a jump, generally? 回答1: an <h:commandButton> doess a full post of the page, no ajax stuff. So it is normal to

JSF 2.0 NullPointerException exception after submitting commandButton

◇◆丶佛笑我妖孽 提交于 2019-12-11 08:25:14
问题 After migrating JSF from 1.2 to 2.0 I begin to receive exception after submitting commandButton: javax.faces.FacesException: java.lang.NullPointerException at org.apache.myfaces.shared_impl.context.ExceptionHandlerImpl.wrap(ExceptionHandlerImpl.java:241) at org.apache.myfaces.shared_impl.context.ExceptionHandlerImpl.handle(ExceptionHandlerImpl.java:156) at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:222) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:191