Server return http response code: 400 for URL 报错解决方法

使用下面URL进行http请求的时候报错 确定URL路径没有错误

String userName = "张三";
String URL = "http://..........:8080/user/getList?userName" 
+ userName;

报错原因:参数是中文字符串
解决方法:如下 修改拼接的参数

String URL  =  "http://...:8080/user/list?userName" + URLEncode.encode(userName, "utf-8");
  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
关于`img`标签的`src`属性双向绑定报错,可能是因为Vue.js版本问题。在Vue.js 2.x版本中,`img`标签的`src`属性双向绑定需要使用`.sync`修饰符,示例代码如下: ``` <template> <div> <img :src.sync="imageUrl"> <button @click="changeUrl">Change Image URL</button> </div> </template> <script> export default { data() { return { imageUrl: 'https://example.com/image.jpg' } }, methods: { changeUrl() { this.imageUrl = 'https://example.com/new-image.jpg'; } } } </script> ``` 如果你使用的是Vue.js 3.x版本,`img`标签的`src`属性双向绑定需要使用`v-model`指令,示例代码如下: ``` <template> <div> <img v-model="imageUrl"> <button @click="changeUrl">Change Image URL</button> </div> </template> <script> import { ref } from 'vue'; export default { setup() { const imageUrl = ref('https://example.com/image.jpg'); const changeUrl = () => { imageUrl.value = 'https://example.com/new-image.jpg'; } return { imageUrl, changeUrl } } } </script> ``` 另外,也可以通过在`img`标签中使用`key`属性来强制重新加载图片,例如: ``` <template> <div> <img :src="imageUrl" :key="imageUrl"> <button @click="changeUrl">Change Image URL</button> </div> </template> <script> export default { data() { return { imageUrl: 'https://example.com/image.jpg' } }, methods: { changeUrl() { this.imageUrl = 'https://example.com/new-image.jpg'; } } } </script> ``` 每次更新`imageUrl`的值时,`img`标签的`key`属性也会更新,从而强制重新加载图片。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值