取得url地址写入参数

String query="";

String encoding="UTF-8";

query += "&" ;
     query += URLEncoder.encode(name.toString(),encoding) + "=" +
     URLEncoder.encode(value.toString(),encoding);//进行编码转换;query中包含所有要传递的参数。

URLConnection conn = url.openConnection();
  conn.setUseCaches(false);
  conn.setDoOutput(true);
  ((HttpURLConnection)conn).setRequestMethod("POST");

  OutputStreamWriter out = new OutputStreamWriter(conn.getOutputStream());
//  qs.add("sessionid",Session.instance().getSessionID());
  
  out.write(qs.toString());
  //out.write("/r/n");
  //out.write("/r/n");
  out.flush();
  out.close(); 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
你可以使用C# WinForms来动态写入参数数据。以下是一个示例代码,演示如何在WinForms应用程序中动态写入参数数据。 首先,确保你已经创建了一个WinForms应用程序,并有一个窗体(Form)。 然后,打开窗体的代码文件,在窗体的构造函数中添加以下代码: ```csharp public partial class Form1 : Form { public Form1() { InitializeComponent(); // 动态写入参数数据 WriteParametersData(); } private void WriteParametersData() { // 创建并设置参数数据 string param1 = "参数1"; int param2 = 123; bool param3 = true; // 创建并设置参数容器控件 TableLayoutPanel panel = new TableLayoutPanel(); panel.AutoSize = true; panel.ColumnCount = 2; // 创建并添加参数标签和值控件 Label label1 = new Label(); label1.Text = "参数1:"; panel.Controls.Add(label1); TextBox textBox1 = new TextBox(); textBox1.Text = param1; panel.Controls.Add(textBox1); Label label2 = new Label(); label2.Text = "参数2:"; panel.Controls.Add(label2); TextBox textBox2 = new TextBox(); textBox2.Text = param2.ToString(); panel.Controls.Add(textBox2); Label label3 = new Label(); label3.Text = "参数3:"; panel.Controls.Add(label3); CheckBox checkBox1 = new CheckBox(); checkBox1.Checked = param3; panel.Controls.Add(checkBox1); // 将参数容器控件添加到窗体 this.Controls.Add(panel); } } ``` 在上述代码中,我们在窗体的构造函数中调用了`WriteParametersData`方法,该方法创建了参数数据并将其动态添加到窗体上的一个容器控件(TableLayoutPanel)中。每个参数都由一个标签(Label)和一个值控件(TextBox或CheckBox)组成。 你可以根据需要调整参数的类型和数量,并在`WriteParametersData`方法中设置参数的值。记得在窗体上添加一个适当的容器控件来容纳参数数据。 这样,当你运行应用程序时,参数数据将会被动态写入到窗体中,供用户查看和编辑。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值