0

I am trying to send some values from a form to a responsebody for doing some actions on those values. But the values are not at all getting forwarded to that handler. i couldn't find a reason. What could be the problem here?

My handler

    @RequestMapping(value="/redemptionRedirect1/{userId}", method=RequestMethod.GET)
     @ResponseBody 
     public Transaction submitRedemption(@PathVariable("userId") long userId,@RequestParam(value="amount") String amount1,@RequestParam("bankaccount") int bankaccount,@RequestParam("demataccount") int demataccount)
    {
        boolean flag;
        Double amount=Double.parseDouble(amount1);
        Transaction transaction=new Transaction();
        transaction.setBankAccount(transactionService.getBank(bankaccount));
        transaction.setDematAccount(transactionService.getDemat(demataccount));
        transaction.setTransactionAmount(amount);
        Authentication auth = SecurityContextHolder.getContext().getAuthentication();
        String name = auth.getName();
        User user=userService.getUser(name);
        transaction.setUser(user);
        flag = transactionService.addRedemptionTransactions(transaction);
        return transaction;
    }

My JSP

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form  action="redemptionRedirect1/${user.userId}.htm" method="get">
<table>
 <tr><td>Amount: </td><td><input id="amount" type="text" maxlength="5" value='<c:out     value="${amount}"/>' placeholder='<c:out value="${amount}"/>'/></td></tr>
 <tr><td>
 Bank Accounts: </td><td><select id="bankaccount" >
 <c:forEach items="${baccounts}" var="account">
  <option value='<c:out value="${account.accountNumber}"/>'>
 <c:out value="${account.name}"/>
 </option>
 </c:forEach>
 </select>
 </td></tr>
   <tr><td>Demat Account: </td><td><input  id="demataccount" type="text"  placeholder='<c:out value="${daccount.dematName}"/>' value='<c:out  value="${daccount.dematAccountNumber}"/>'/></td></tr>
 <tr><td><input type="submit" value="Confirm"/></td></tr>
 </table>
 </form>
 </body>
 </html>
1
  • is there any not null properties in your table?? Commented Dec 26, 2013 at 12:23

1 Answer 1

0

The form serializes itself via name attribute of every input.
So first you may run the developer tools feature of your browser and check if the values are added to the request or (this works only for GET requests) check if the values are added to the URL after the submit. If not - add the name attribute for every corresponding input.

Sign up to request clarification or add additional context in comments.

2 Comments

i guess u are correct now the values are passing into the url but the error has changed to this. "The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers."
great! that means the way is correct. could you please try to use POST instead of GET? (In both, the JSP side and the Handler method attribute)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.