java - How To Create JSON Array Object With JSP Declarations -
I am new to JEE. I want to make json data in the jsp declarion tag, e can help me.
This is my source code
& lt;%! Public double getTax (string name, double AMT, double DI) {double total = 0.0; Hashmap & lt; String, double & gt; Hm = new Hashmop & lt; String, double & gt; (); Prepared state PS = DBCNation.Jetpreiere ("value, op, intelligence, select formula," + "Tax type tax where name =?"); Try {System.out.println ("Discount:" + D); Ps.setString (1, name); Results set rs = ps.executeQuery (); String form = "sub-discount"; System.out.println ("---------------- Tax Value Details -------------------"); JSONObject json1 = new JSONObject (); JSONArray jarr = new JSONArray (); While (rsnext ()) {JSONObject o = New JSONObject (); Double val = rs.getDouble (1); String op = rjest string (2); String IQ = R.Jest String (3); Form = rs.getString (4); String type = rs.getString (5); O.put ("val", val); Double sub = 0.0; If (wit.equalsIgnoreCase ("sub-discount")) {sub = amt-dis; } And {sub = hm.get (intelligence); } If (op.equals ("%")) {sub = (val / 100) * sub; Hm.put (op, val); } And if (op.equals ("*")) {sub = val * sub; } Other {sub + = val; } Hm.put (type, sub); System.out.println ("Tax Type:" + Type + "; Tax Amount:" + Sub); System.out.println ("operator:" + op + "; tax value:" + val); } String s [] = form. Split (";"); For (int i = 1; i
and it displays logs in the Apache's tomcat
Discount: 0.0 --------------- --- ---- Tax Value Details -------------------------------- Taxes Type: VAT; Tax Amount: 15.200000000000001 Operator:%; Tax Value: 4.0 Tax Type: Stack; Tax Amount: 19.0 Operator:%; Tax Value: 5.0 Tax Type: Scharge; Tax Amount: 22.8 Operator:%; Tax Value: 6.0 Taxes Type: CST; Tax Amount: 19.0 Operator:%; Tax Data:
text ">You can use some code like this (I'm just specifying the code required for the creation of JSON Array):
Comments
Post a Comment