我正在使用jquery来显示日历,它完美地工作,但是当我提交表单后端没有收到结果>>结果为null。

    <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
    <script src="//code.jquery.com/jquery-1.10.2.js"></script>
    <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
    <link rel="stylesheet" href="/resources/demos/style.css">
    <script>
        $(function() {
            $("#datepicker").datepicker();
        });
.

jsp

   ...
   <s:textfield id="datepicker" name="datepicker"/>
   ...
.

java

  private String datepicker; 

  public String getDatepicker() {
      return datepicker;
  } 

  public void setDatepicker(String datepicker) {
     this.datepicker = datepicker;
  }
.

生成的html

<input type="text" id="datepicker" value="" name="datepicker" class="hasDatepicker">
.

有帮助吗?

解决方案

该值为您的文本字段为空,因此您可能会尝试设置值

<s:textfield id="datepicker" name="datepicker" value="%{datepicker}"/>
.

并确保将params拦截器配置为提交上面括在于上面文本字段的形式的操作。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top