JSP JPA Form: how to insert value in a path variable
- by kajarigd
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!