我的控制器类是

@RequestMapping(method = RequestMethod.POST, value = "/auditregistry/collectionentry/cid/{cid}/collid/{collid}/colldt/{collectiondate}/amount/{amt}")

public ModelAndView saveManualCollection(@PathVariable("cid") Integer custId, @PathVariable("collid") Integer collRtId, @PathVariable("collectiondate") String dt, **@PathVariable("amt") String amount**) throws Exception
{
    debug("amount recieving=="+amount);

和我传递给网址的值是

/ auditregistry / collectionentry / cid / 9991 / collid / 10 / colldt / 20120726 / amount / $ 14.55

当我尝试将金额值打印为“$ 14”而不是“$ 14.55”时,我应该怎么做才能打印实际值“$ 14.55”

任何帮助都非常感谢

最佳答案

将您的RequestMapping更改为以下

@RequestMapping(method = RequestMethod.POST, value = "/auditregistry/collectionentry/cid/{cid}/collid/{collid}/colldt/{collectiondate}/amount/{amt:.*}")

此处更改已被拒绝 {amt:。*} 在您的RequestMapping中插入了 {amt}

10-01 19:11