I have found a page where the purchase can be purchased. I have three elements in an HTML document that differ from comma Has been parsed in.
Once broken, every id / price / qty should be populated in an object ...
public class foo {private} Int id; Personal budichem value; Private entity; // set in & amp; Can be found,} which can be in the form of an object in the form of an object ...
purchase of public class {personal date Date; Private int purchase id; Private listing & lt; Foo & gt; Purchase; // set in & amp; I get it,} I know that I can only catch the request parameters and one can create Fu objects one by one. I thought that there is a better way to populate that list, whereas data binding is done on the purchase object, because it populates all other properties correctly
In addition to inserting this same command in the paragraph and dividing it into the server side (which is a pretty approach to being honest), you can use the same parameter name Also many parameters can send values I This will then be available on the parameter name as the string [] array.
I do not spring, so here is a plain vanilla HTML / service example to give this idea:
& lt; Table & gt; & Lt; TR & gt; & Lt; Td> ID: 12 & lt; Input type = "hidden" name = "id" value = "12" & gt; & Lt; / Td> & Lt; Td> Amount: & lt; Input type = "article" name = "qty" & gt; & Lt; / Td> & Lt; Td> Price: $ 100.00 & lt; Input type = "hidden" name = "value" value = "100.00" & gt; & Lt; / Td> & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td> ID: 54 & lt; Input type = "hidden" name = "id" value = "54" & gt; & Lt; / Td> & Lt; Td> Amount: & lt; Input type = "article" name = "qty" & gt; & Lt; / Td> & Lt; Td> Price: $ 200.00 & lt; Input type = "hidden" name = "value" value = "200.00" & gt; & Lt; / Td> & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td> ID: 8 & lt; Input type = "hidden" name = "id" value = "8" & gt; & Lt; / Td> & Lt; Td> Amount: & lt; Input type = "article" name = "qty" & gt; & Lt; / Td> & Lt; Td> Price: $ 500.00 & lt; Input type = "hidden" name = "value" value = "500.00" & gt; & Lt; / Td> & Lt; / TR & gt; & Lt; / Table & gt; servlet:
string [] id = request.getParameterValues ("id"); String [] qtys = request.getParameterValues ("quantity"); String [] prices = request.getParameterValues ("value"); For (Int i = 0; I> ID; Lang; I ++) {Long ID = Long Parcelong (id [i]); Integer volume = integer Persian (qtys [i]); BigDecal value = new budicum (value [ii]); // ...} But I strongly urge clients to send the price to the server too. I calculate the value on the server side (instead) because the client has full control over the request parameters and thus it is able to change the parameter values outside the control of its form.
Comments
Post a Comment