将csv文件添加到HTTP POST

时间:2017-04-04 06:25:56

标签: postman

1 个答案:

答案 0 :(得分:7)

这可以使用

完成
  1. 选择 textField.getDocument().addDocumentListener(new DocumentListener() { @Override public void changedUpdate(DocumentEvent e) { } @Override public void insertUpdate(DocumentEvent e) { searchTableData(textField); } @Override public void removeUpdate(DocumentEvent e) { searchTableData(textField); } }); public void searchTableData(JTextField tf){ try { this.panelWares.calculate = false; String searchVal = tf.getText(); if(searchVal.equals("")){ this.panelWares.paramsRefresh = new HashMap<String, NamedParameter>(); this.panelWares.refreshTable(0); //tf.requestFocus(); return; } String colName = tf.getName(); this.panelWares.paramsRefresh = new HashMap<String, NamedParameter>(); this.panelWares.paramsRefresh.put(colName, new NamedParameter(searchVal, "string", "like_both")); this.panelWares.refreshTable(0); this.panelWares.calculate = true; } catch(Exception er){ er.printStackTrace(); UtilsStoreDepo.showMessage("Xeta:" + er.getMessage()); } } // paramsRefresh = Hashmap public boolean refreshTable(int selRow) { model.execute(connection, table, paramsRefresh); if(cc <= 1) initTable(model); cc++; table.setModel(model); scPane.setViewportView(table); int posIndex = table.getSelectedRow(); Rectangle rect = table.getCellRect(posIndex, 0, true); scPane.getViewport().scrollRectToVisible(rect); wares_amount = String.valueOf(table.getSelectedValue("amount")); return true; } public void initTable(CustomTableModel model){ table = new TableWares(model){ public Component prepareRenderer(TableCellRenderer renderer, int row, int column){ Component c = super.prepareRenderer(renderer, row, column); Object val = getModel().getValueAt(row, column); Object valLimit = getModel().getValueAt(row, column); Object valOrderAmount = getModel().getValueAt(row, column); if(getRowCount() > 0){ c.setForeground(Color.BLUE); c.setFont(c.getFont()); for(int i = 0 ; i < table.getColumnsName().length; i++ ){ int vCol = getColumnIndex(table.getColumnsName()[i], table.getColumnsName()); if(table.getColumnsResize()[i] == false){ if(column == vCol){ if(isRowSelected(row)) c.setForeground(selectionBackground); else c.setForeground(getBackground()); } } else { val = getModel().getValueAt(row, getColumnIndex("amount", table.getColumnsName())); valLimit = getModel().getValueAt(row, getColumnIndex("amount_limit", table.getColumnsName())); valOrderAmount = getModel().getValueAt(row, getColumnIndex("order_amount", table.getColumnsName())); BigDecimal valB = new BigDecimal("0"); BigDecimal valLimitB = new BigDecimal("0"); if(val != null && !val.equals("") && valLimit != null && !valLimit.equals("")){ val = val.toString().replaceAll(",", ""); valLimit = valLimit.toString().replaceAll(",", ""); valB = new BigDecimal(val.toString()); valLimitB = new BigDecimal(valLimit.toString()); } if(valB.compareTo(valLimitB) <= 0){ c.setForeground(Color.RED); } else{ c.setForeground(Color.BLACK); } if(Utils.bd(String.valueOf(valOrderAmount)).compareTo(Utils.BD_SIFIR) > 0 && column == colOrderAmountInd){ c.setFont(AllConstants.FONT_ARIAL_BOLD_14); c.setForeground(Color.MAGENTA); c.setBackground(Color.black); } else { c.setFont(getFont()); } } } } return c; } }; table.setName("wares"); table.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent arg0) { if(table.getRowCount() < 1) return; if(!calculate) return; Utils.plusMinus(table, arg0.getKeyChar(), table.getSelectedRow(), colOrderAmountInd, 0, 10000); if(arg0.getKeyCode() == KeyEvent.VK_ENTER){ editOrGet(); } } }); table.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if(table.getRowCount() < 1) return; if(!calculate) return; if (e.getClickCount() == 2) { editOrGet(); } } }); table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent arg0) { if(table.getRowCount() < 1) return; if(!calculate) return; int[] selRow = table.getSelectedRows(); BigDecimal bdValMiqdar = new BigDecimal("0"); BigDecimal bdValMD = new BigDecimal("0"); BigDecimal bdValMX = new BigDecimal("0"); for(int q = 0; q < selRow.length; q++){ BigDecimal valMD = new BigDecimal(table.getValue("amount",selRow[q]).toString()).multiply(new BigDecimal(table.getValue("pur_price",selRow[q]).toString())); bdValMD = bdValMD.add(valMD); BigDecimal valMX = new BigDecimal(table.getValue("amount",selRow[q]).toString()).multiply(new BigDecimal(table.getValue("sel_price",selRow[q]).toString())); bdValMX = bdValMX.add(valMX); BigDecimal valMiqdar = new BigDecimal(table.getValue("amount",selRow[q]).toString()); bdValMiqdar = bdValMiqdar.add(valMiqdar); } parent.sumStoreMiqdar = bdValMiqdar.setScale(2, BigDecimal.ROUND_HALF_UP).toString(); parent.sumStoreMD = bdValMD.setScale(2, BigDecimal.ROUND_HALF_UP).toString(); parent.sumStoreMX = bdValMX.setScale(2, BigDecimal.ROUND_HALF_UP).toString(); } }); } 方法并输入网址

  2. 在正文菜单标题中,点击POST复选框

  3. 在键值形式中,

    3.1将密钥添加为form-data

    3.2从密钥附近的下拉列表中选择类型fisier

    3.3打开文件选择器按钮,单击它,浏览文件并上传

    3.4单击发送方法发送请求

  4. Illustration for the steps