JSP JPA Form: how to insert value in a path variable

Posted by kajarigd on Stack Overflow See other posts from Stack Overflow or by kajarigd
Published on 2013-08-06T14:48:14Z Indexed on 2013/11/01 9:55 UTC
Read the original article Hit count: 218

Filed under:
|
|
|
|

I have the following code snippet in a jsp file:

<hr>
<form:form commandName="newTicketSale" id="reg" action="transactionResult.htm">
    <h3>Buy Movie Tickets:</h3>
    <form:label path="movieName">Movie Name:</form:label>
    <form:input path="movieName" />
    <form:errors class="invalid" path="movieName" />
    <form:label path="ticketPrice">Ticket Price:</form:label>
    <form:input path="ticketPrice" />
    <form:errors class="invalid" path="ticketPrice" />
     <input type="submit"> <br><br>
</form:form> 

I am using JPA tags in this jsp. Now, in the commandName "newTicketSale" there is another parameter called userId. In the jsp file itself I need to insert value ${name} in userId, so that in the Controller file when I am doing

@Valid @ModelAttribute("newTicketSale") MovieTicket newTicket

I can retrieve the value ${name} when I am doing newTicket.getUserId().

I don't know how to do this. Please help! Thanks in advance!

© Stack Overflow or respective owner

Related posts about forms

Related posts about hibernate