废话不多说了,直接给大家贴java代码了。
具体代码如下所示:
- /*支付流程*/
- /****Controller.java 代码如下:*/
- @RequestMapping(value = "/paySubmit.htm", method = RequestMethod.POST)
- public ModelAndView paySubmit(HttpServletRequest request,
- HttpServletResponse response, @RequestParam Map<String, Object> maps){
- ModelAndView model = new ModelAndView("***/submit");
- /**
- * 代码块
- */
- return model;
- }
- /*submit.jsp 代码如下:*/
- <%@ page contentType="text/html;charset=UTF-8" language="java" trimDirectiveWhitespaces="true" %>
- <%@ page import="com.***.util.PayUtil" %>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html>
- <head>
- <title>支付</title>
- <meta http-equiv="pragma" content="no-cache">
- <meta http-equiv="cache-control" content="no-cache">
- <meta http-equiv="expires" content="0">
- </head>
- <body>
- <%
- request.setCharacterEncoding("UTF-8");
- String type = (String) request.getAttribute("type");
- String sHtmlText = "";
- if ("1".equals(type)){
- sHtmlText = PayUtil.buildForm(
- (String) request.getAttribute("orderNo"),
- (String) request.getAttribute("amt"),type);
- }else{
- sHtmlText = PayUtil.allInPaybuildForm(
- (String) request.getAttribute("orderNo"),
- (String) request.getAttribute("amt"),type,request);
- }
- out.println(sHtmlText);
- %>
- </body>
- </html>
- /* PayUtil.java 代码如下:*/
- /**
- * 生成页面数据
- * @param url 三方支付的URL