English 中文(简体)
在重新确定联合论坛和总理表格之前,对一些强制性投入领域进行了分析。
原标题:Checking some mandatory input fields are inputted before resetting the form in JSF + PrimeFaces

我在执行一个机制方面遇到问题,即使用总理法,检查共同基金表格中的强制性投入领域,或者在提交表格之前由用户填写。

I have used required="true" mechanism in inputTexts for checking and firing a custom message before submitting for prompting the user to enter some value to the mandatory fields such as this:

<p:inputText id="exp" required="true" requiredMessage="#{lang.dailyCurrencyValues_exp_req_txt}" value="#{marketDataDefinitionProcesses.currencyType.explanation}"/> 

如果用户成功完成呈报并在同一页中停留,我就要求我重新启用该页。 为了执行这一规定,我使用了oncomplete=”document.myForm.reset();<> on the submission button, which is amended reging the form and all the areas in the form.

然而,如果用户不进入所有强制领域,并报送提交纽特,则表格提供要求获得的明确的信息,并重新确定表格及其所有内容。 如果呈文失败,我想防止这种情况,重新确定价值观。 我试图履行 Java本功能,试图防止在强制领域没有填满的情况下重新确定形式。 然而,我再次面临以我的形式检索要素值的问题。

<p:calendar id="dateValueId" value="#{marketDataDefinitionProcesses.currencyType.dateValue}" pattern="dd.MM.yyyy" required="true" requiredMessage="#{lang.dailyCurrencyValues_dateValueId_req_txt}"/>

我没有回过 Java本收回日历要素价值。

现在,我正在等待大家对解决这一问题的意见。 我认为,利用贾瓦文检索日历值或检索required=“true” 外地/单位是否填满信息的任何共同财产/财产要素的解决办法是备选办法。

Yours Sincerely...

Faruk

问题回答

在员额之后,改用同一观点。 它将产生一种新的品牌要求,所有投入价值都空白,或至少对其缺省情况,如请求/调查范围大的星体所示。

public String submit() {
    // ...

    return FacesContext.getCurrentInstance().getViewRoot().getViewId() + "?faces-redirect=true";
}

I think you can achieve your goal with PrimeFaces s RequestContext:

<h:form id="myForm">
   ...
</h:form>

@ManagedBean
@RequestScoped
public class MrBean {
   public void doSomething() {
      // Do your thing

      RequestContext context = RequestContext.getCurrentInstance();
      context.execute("document.getElementById("myForm").reset()"); 
   }
}

或许你可以尝试这样做。

 public class MarketDataDefinitionProcesses{
    private CurrencyType currencyType;
    Boolean createStatus;


      public String create(){
         if(service.checkData(currencyType)){
    //insert data
    //show statusMessage or not
    createStatus=Boolean.TRUE;
    reflesh(create,createStatus);
    }
   return null;
    }
    public void reflesh(CurrencyType preNextCreateCurrency,Boolean createStatus){
     preNextCreateCurrency = new CurrencyType();
     this.currencyType = preNextCreateCurrency ;
     RequestContext rc = RequestContext.getCurrentInstance();
     rc.update("form:id"); // if the inputText in the panelGrid, you can put the panelGrid id 
     createStatus = Boolean.FALSE;
    }
    }

当用户提交数据时,该网页需要一个新案例,并使用ReuqestContext来更新表格或需要哪些部分数据。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签