有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java加密表单参数并通过url发送,然后使用spring mvc解密并打开所需页面

如何加密表单参数并通过url发送,然后使用spring mvc解密并打开所需页面

这是我的主页

<html>
<form:form action="go/show" method="get" target="_blank" >
    <table>
        <tr>
            <td class="label"><label>Application Name:</label></td>
            <td class="field"><form:input path="appnames"  name="appname"        value="test" id="appname"/></td>
        </tr>
  </table>
</form>

从这个参数转到getter和setters 然后是控制器

@RequestMapping(value = "/", method = RequestMethod.GET)
public ModelAndView form() {


     return new ModelAndView("form","command",new Credentials());
}

  @RequestMapping(value = "/go/show", method = RequestMethod.GET)

public ModelAndView show(@ModelAttribute("credentials") Credentials credentials()
{
        return new ModelAndView("go/show")}

我的着陆点在哪里

我的URL显示为localhost:8080/go/show?appnames=test 并显示我的登录页面显示。jsp

不,Https不是一个选项,每当我试图将url重定向到localhost:8080/go/show这样的东西时?cjavs%20cknbs=显示未找到页面。。。之后,如何显示所需的页面


共 (1) 个答案

  1. # 1 楼答案

    • 如果你不想在url中发送你的参数,你应该使用POST而不是GET方法

    • 如果需要加密参数的值,则必须使用密钥对和密码算法(例如RSA)

    • 如果你想混淆你的参数(我看不出这样做的原因),你可以很容易地转换到Base64(例如),但你应该分别编码名称和值,并注意url编码,因为你不能使用像“+”,“/”,“=”这样的特殊字符