基于Java代码实现支付充值的通用流程

本文主要介绍了如何使用Java代码实现支付充值的通用流程。通过具体的代码示例,帮助读者理解支付充值的步骤和技术要点。
摘要由CSDN通过智能技术生成

废话不多说了,直接给大家贴java代码了。

具体代码如下所示:

 
 
 
  1. /*支付流程*/
  2. /****Controller.java 代码如下:*/
  3. @RequestMapping(value = "/paySubmit.htm", method = RequestMethod.POST)
  4. public ModelAndView paySubmit(HttpServletRequest request,
  5. HttpServletResponse response, @RequestParam Map<String, Object> maps){
  6. ModelAndView model = new ModelAndView("***/submit");
  7. /**
  8. * 代码块
  9. */
  10. return model;
  11. }
  12. /*submit.jsp 代码如下:*/
  13. <%@ page contentType="text/html;charset=UTF-8" language="java" trimDirectiveWhitespaces="true" %>
  14. <%@ page import="com.***.util.PayUtil" %>
  15. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  16. <html>
  17. <head>
  18. <title>支付</title>
  19. <meta http-equiv="pragma" content="no-cache">
  20. <meta http-equiv="cache-control" content="no-cache">
  21. <meta http-equiv="expires" content="0">
  22. </head>
  23. <body>
  24. <%
  25. request.setCharacterEncoding("UTF-8");
  26. String type = (String) request.getAttribute("type");
  27. String sHtmlText = "";
  28. if ("1".equals(type)){
  29. sHtmlText = PayUtil.buildForm(
  30. (String) request.getAttribute("orderNo"),
  31. (String) request.getAttribute("amt"),type);
  32. }else{
  33. sHtmlText = PayUtil.allInPaybuildForm(
  34. (String) request.getAttribute("orderNo"),
  35. (String) request.getAttribute("amt"),type,request);
  36. }
  37. out.println(sHtmlText);
  38. %>
  39. </body>
  40. </html>
  41. /* PayUtil.java 代码如下:*/
  42. /**
  43. * 生成页面数据
  44. * @param url 三方支付的URL
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值