Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsp 我可以格式化文本文件的数值,但不能更新它_Jsp_Struts2_Jstl - Fatal编程技术网

Jsp 我可以格式化文本文件的数值,但不能更新它

Jsp 我可以格式化文本文件的数值,但不能更新它,jsp,struts2,jstl,Jsp,Struts2,Jstl,我试图更新表单上的几个数值。一旦显示的值没有形成,我可以很容易地改变他们的任何数字和正确的数字将被发送到后端;但是,如果我输入一个大数字,例如6000000,它将在浏览器上更改为6.0E7,但正确的数字将发送到后端。我添加了fmt库来格式化数字,但当我提交表单时,它会将0发送到后端 <%@ taglib prefix="s" uri="/struts-tags"%> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jst

我试图更新表单上的几个数值。一旦显示的值没有形成,我可以很容易地改变他们的任何数字和正确的数字将被发送到后端;但是,如果我输入一个大数字,例如6000000,它将在浏览器上更改为6.0E7,但正确的数字将发送到后端。我添加了fmt库来格式化数字,但当我提交表单时,它会将0发送到后端

<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<s:textfield id="price" name="price" value="%{price}" theme="simple"/>  //6.0E7


<input name="price" id="price" value='<fmt:formatNumber value='${price}'/>'/> //0

//6.0E7
//0

如何使用
模式
属性

<input name="price" id="price" value=
    '<fmt:formatNumber value='${price}' pattern="##,####,###"/>'
/>

您不需要使用JSTL的fmt,Struts2内置了

而不是


例如


另外,请阅读,并记住6.0E7是(阅读更多)

<input name="price" id="price" value=
    '<fmt:formatNumber value='${price}' type="number" groupingUsed="false"/>'
/>