实现支付宝充值的问题

Zemo 2013-12-27 06:59:05
我的项目是springMVC+Tiles的

现在支付宝官方的demo 已经调通了。
但是放到我的项目里就有点问题了。
这是我的alipay*.java

这是jsp页面目录结构

fund.jsp就是我的充值页面
代码如下:

<form id="deposit" action="${ctx}/fund/alipay" method="post" target="_blank">
<table cellpadding="10">
<tr>
<td>账户余额</td>
<td class="balance" id="userBalance"></td>
</tr>
<tr>
<td><i class="zfb"></i></td>
<td style="padding-bottom: 0px;">
亲爱的<span class="suppliment_user" id="suppliment_user"></span>,您可以使用支付宝充值积善分,请填写以下信息
</td>
</tr>
<tr>
<td></td>
<td><label class="radio inline"> <input type="radio"
name="WIDtotal_fee" id="optionsRadios1" value="5" checked> 5元
</label></td>
</tr>
<tr>
<td></td>
<td><label class="radio inline"> <input type="radio"
name="WIDtotal_fee" id="optionsRadios2" value="20"> 20元
</label></td>
</tr>
<tr>
<td></td>
<td><label class="radio inline"> <input type="radio"
name="WIDtotal_fee" id="optionsRadios3" value="50"> 50元
</label></td>
</tr>
<tr>
<td></td>
<td><label class="radio inline"> <input type="radio"
name="WIDtotal_fee" id="optionsRadios4" value="100"> 100元
</label></td>
</tr>
<tr>
<td></td>
<td><label class="radio inline"> <input type="radio"
name="WIDtotal_fee" id="optionsRadios5" value="1000"> 1000元
</label></td>
</tr>
<tr>
<td></td>
<td><label class="radio inline"> <input type="radio"
name="WIDtotal_fee" id="optionsRadios6" value="5000"> 5000元
</label></td>
</tr>
<tr>
<td></td>
<td><label class="radio inline"> <input type="radio"
name="amount" id="optionsRadios7" value="option7">自定义<input
class="compliment_count" name="WIDtotal_fee" placeholder="充值金额">元
</label></td>
</tr>
<tr>
<td></td>
<td class="warm_prompt">温馨提示:<br />1.采用支付宝充值,1元可以充值1积善值。<br />2.若出现已充值成功的提示,但积善值未到账,可能是网络或者系统繁忙导致,我们会在2个工作日内核对后为您充值<br />3在充值过程中如出现网页错误或打开缓慢时,请先查询支付宝的交易记录,检查扣款是否成功;然后查看积善之家账户是否成功充值。若没有确认,请不要反复刷新页面,以防止重复购买。
</td>
</tr>
<tr>
<td></td>
<td><button class="affirm-donate">立即充值</button></td>
</tr>
</table>

</form>


效果图如下:

其他必要数据后台生成直接传到相应的地方。
怎么把值传到alipayapi.jsp页面中?
注:项目使用tiles模块加载。所以调转页面需要后台返回一个String
...全文
669 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
多读书多看报 2014-01-18
  • 打赏
  • 举报
回复
可以是以下直接从后台传值。
Zemo 2014-01-16
  • 打赏
  • 举报
回复
还是没有人帮忙。。。
Zemo 2013-12-31
  • 打赏
  • 举报
回复
不要沉阿。。。
Zemo 2013-12-29
  • 打赏
  • 举报
回复
引用 2 楼 defonds 的回复:
你是要支付宝的返回数据?
目前先遇到的问题是我不知道怎么吧支付宝必要的值传过去。

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.alipay.config.*"%>
<%@ page import="com.alipay.util.*"%>
<%@ page import="java.util.HashMap"%>
<%@ page import="java.util.Map"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>支付宝即时到账交易接口</title>
	</head>
	<%
		////////////////////////////////////请求参数//////////////////////////////////////

		//支付类型
		String payment_type = "1";
		//必填,不能修改
		//服务器异步通知页面路径
		String notify_url = "http://www.xxx.com/create_direct_pay_by_user-JAVA-UTF-8/notify_url.jsp";
		//需http://格式的完整路径,不能加?id=123这类自定义参数

		//页面跳转同步通知页面路径
		String return_url = "http://www.xxx.com/create_direct_pay_by_user-JAVA-UTF-8/return_url.jsp";
		//需http://格式的完整路径,不能加?id=123这类自定义参数,不能写成http://localhost/

		//卖家支付宝帐户
		String seller_email = new String(request.getParameter("WIDseller_email").getBytes("ISO-8859-1"),"UTF-8");
		//必填

		//商户订单号
		String out_trade_no = new String(request.getParameter("WIDout_trade_no").getBytes("ISO-8859-1"),"UTF-8");
		//商户网站订单系统中唯一订单号,必填

		//订单名称
		String subject = new String(request.getParameter("WIDsubject").getBytes("ISO-8859-1"),"UTF-8");
		//必填

		//付款金额
		String total_fee = new String(request.getParameter("WIDtotal_fee").getBytes("ISO-8859-1"),"UTF-8");
		//必填

		//订单描述

		String body = new String(request.getParameter("WIDbody").getBytes("ISO-8859-1"),"UTF-8");
		//商品展示地址
		String show_url = new String(request.getParameter("WIDshow_url").getBytes("ISO-8859-1"),"UTF-8");
		//需以http://开头的完整路径,例如:http://www.xxx.com/myorder.html

		//防钓鱼时间戳
		String anti_phishing_key = "";
		//若要使用请调用类文件submit中的query_timestamp函数

		//客户端的IP地址
		String exter_invoke_ip = "";
		//非局域网的外网IP地址,如:221.0.0.1
		
		
		//////////////////////////////////////////////////////////////////////////////////
		
		//把请求参数打包成数组
		Map<String, String> sParaTemp = new HashMap<String, String>();
		sParaTemp.put("service", "create_direct_pay_by_user");
        sParaTemp.put("partner", AlipayConfig.partner);
        sParaTemp.put("_input_charset", AlipayConfig.input_charset);
		sParaTemp.put("payment_type", payment_type);
		sParaTemp.put("notify_url", notify_url);
		sParaTemp.put("return_url", return_url);
		sParaTemp.put("seller_email", seller_email);
		sParaTemp.put("out_trade_no", out_trade_no);
		sParaTemp.put("subject", subject);
		sParaTemp.put("total_fee", total_fee);
		sParaTemp.put("body", body);
		sParaTemp.put("show_url", show_url);
		sParaTemp.put("anti_phishing_key", anti_phishing_key);
		sParaTemp.put("exter_invoke_ip", exter_invoke_ip);
		
		//建立请求
		String sHtmlText = AlipaySubmit.buildRequest(sParaTemp,"get","确认");
		out.println(sHtmlText);
	%>
我的页面填这些必要数据传到这个页面里。。。
Defonds 2013-12-28
  • 打赏
  • 举报
回复
你是要支付宝的返回数据?
lovelessisbU 2013-12-28
  • 打赏
  • 举报
回复
新人进来看下大神的回复

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧