You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by wicketyan <wi...@gmail.com> on 2010/04/06 11:00:56 UTC

onlinepayment

Hi! Is anyone can give me code example about online payment using ajax.I have to use form action attribute to post a url,but wicket do not support directing a url  to external website on 'post' way in method submit().


2010-04-06 



wicketyan 

Re: onlinepayment

Posted by Jeremy Thomerson <je...@wickettraining.com>.
throw new redirect response and redirect, or write out javascript that does
the redirect (target.appendJavascript("")).

--
Jeremy Thomerson
http://www.wickettraining.com



On Tue, Apr 6, 2010 at 4:00 AM, wicketyan <wi...@gmail.com> wrote:

> Hi! Is anyone can give me code example about online payment using ajax.I
> have to use form action attribute to post a url,but wicket do not support
> directing a url  to external website on 'post' way in method submit().
>
>
> 2010-04-06
>
>
>
> wicketyan
>

Re: Re: onlinepayment

Posted by Jeremy Thomerson <je...@wickettraining.com>.
throw new RestartResponseAtInterceptPageException(new RedirectPage(url));

You haven't said anything about what payment solution you're using.  The
thing is, if you have to redirect the user to the payment solution with the
pricing (or whatever your "important" param is) as a URL parameter, then
that will NOT be secured by putting it in JS.  An intelligent user can just
as easily see the param there.

--
Jeremy Thomerson
http://www.wickettraining.com



On Tue, Apr 6, 2010 at 9:29 PM, wicketyan <wi...@gmail.com> wrote:

> Thanks Jeremy Thomerson !
> is "throw new redirect response and redirect" means this
> way:WebRequestCycle.get().setRequestTarget(new
> RedirectRequestTarget("URL...")),using a url like "Wicket.html?opt=admin"
> .but this will expose the important param in the url.So,writting out
> javascript is the only way?
>
>
> 2010-04-07
>
>
>
> wicketyan
>
>
>
> 发件人: Jeremy Thomerson
> 发送时间: 2010-04-07  04:17:05
> 收件人: users
> 抄送:
> 主题: Re: onlinepayment
>
> throw new redirect response and redirect, or write out javascript that does
> the redirect (target.appendJavascript("")).
> --
> Jeremy Thomerson
> http://www.wickettraining.com
> On Tue, Apr 6, 2010 at 4:00 AM, wicketyan <wi...@gmail.com> wrote:
> > Hi! Is anyone can give me code example about online payment using ajax.I
> > have to use form action attribute to post a url,but wicket do not support
> > directing a url  to external website on 'post' way in method submit().
> >
> >
> > 2010-04-06
> >
> >
> >
> > wicketyan
> >
>

Re: Re: Re: onlinepayment

Posted by wicketyan <wi...@gmail.com>.
Thank you very much.


2010-04-07 



wicketyan 



发件人: Jeremy Thomerson 
发送时间: 2010-04-07  14:12:42 
收件人: users 
抄送: 
主题: Re: Re: Re: onlinepayment 
 
You should do the form submission on the server side - not actually forcing
the client to literally submit a form to their server.  In other words, use
HttpClient or similar and make the POST request to chinabank's servers
yourself.
--
Jeremy Thomerson
http://www.wickettraining.com
2010/4/7 wicketyan <wi...@gmail.com>
> I tend  to use chinabank.It's jsp solution is  posting a form to
> http://localhost/chinabank/Receive.jsp ,like this
>
>  send.jsp code:
> <%@ page contentType="text/html; charset=gb2312" language="java"%>
> <%@ page import="java.util.*"%>
> <%@ page import="java.text.*"%>
> <jsp:useBean id="MD5" scope="request" class="beartool.MD5"/>
> <%
> //***********************************************
>
> String v_mid,key,v_url,v_oid,v_amount,v_moneytype,v_md5info;
> v_mid = "1001";
> v_url = "http://localhost/chinabank/Receive.jsp";
>  key = "test";
>  Date currTime = new Date();
>  SimpleDateFormat sf = new
> SimpleDateFormat("yyyyMMdd-"+v_mid+"-hhmmss",Locale.US);
>  v_oid=sf.format(currTime);
> String text = v_amount+v_moneytype+v_oid+v_mid+v_url+key;
> v_md5info = MD5.getMD5ofStr(text);
> ...
>  %>
> <html>
> <body onLoad="javascript:document.E_FORM.submit()">
> <form action="https://pay3.chinabank.com.cn/PayGate" method="POST"
> name="E_FORM">
>
> <input type="hidden" name="v_md5info"    value="<%=v_md5info%>" size="100">
> <input type="hidden" name="v_mid"        value="<%=v_mid%>">
> <input type="hidden" name="v_oid"        value="<%=v_oid%>">
> <input type="hidden" name="v_amount"     value="<%=v_amount%>">
> <input type="hidden" name="v_moneytype"  value="<%=v_moneytype%>">
> <input type="hidden" name="v_url"        value="<%=v_url%>">
>
>
> the problem is I used submit() method,the form will not post to
> https://pay3.chinabank.com.cn/PayGate.
> But I want to process some thing in submit() while posting the form to
> PayGate.
>
> 2010-04-07
>
>
>
> wicketyan
>
>
>
> 发件人: Jeremy Thomerson
> 发送时间: 2010-04-07  10:36:49
> 收件人: users
> 抄送:
> 主题: Re: Re: onlinepayment
>
> throw new RestartResponseAtInterceptPageException(new RedirectPage(url));
> You haven't said anything about what payment solution you're using.  The
> thing is, if you have to redirect the user to the payment solution with the
> pricing (or whatever your "important" param is) as a URL parameter, then
> that will NOT be secured by putting it in JS.  An intelligent user can just
> as easily see the param there.
> --
> Jeremy Thomerson
> http://www.wickettraining.com
> On Tue, Apr 6, 2010 at 9:29 PM, wicketyan <wi...@gmail.com> wrote:
> > Thanks Jeremy Thomerson !
> > is "throw new redirect response and redirect" means this
> > way:WebRequestCycle.get().setRequestTarget(new
> > RedirectRequestTarget("URL...")),using a url like "Wicket.html?opt=admin"
> > .but this will expose the important param in the url.So,writting out
> > javascript is the only way?
> >
> >
> > 2010-04-07
> >
> >
> >
> > wicketyan
> >
> >
> >
> > 发件人: Jeremy Thomerson
> > 发送时间: 2010-04-07  04:17:05
> > 收件人: users
> > 抄送:
> > 主题: Re: onlinepayment
> >
> > throw new redirect response and redirect, or write out javascript that
> does
> > the redirect (target.appendJavascript("")).
> > --
> > Jeremy Thomerson
> > http://www.wickettraining.com
> > On Tue, Apr 6, 2010 at 4:00 AM, wicketyan <wi...@gmail.com> wrote:
> > > Hi! Is anyone can give me code example about online payment using
> ajax.I
> > > have to use form action attribute to post a url,but wicket do not
> support
> > > directing a url  to external website on 'post' way in method submit().
> > >
> > >
> > > 2010-04-06
> > >
> > >
> > >
> > > wicketyan
> > >
> >
>

Re: Re: Re: onlinepayment

Posted by Jeremy Thomerson <je...@wickettraining.com>.
You should do the form submission on the server side - not actually forcing
the client to literally submit a form to their server.  In other words, use
HttpClient or similar and make the POST request to chinabank's servers
yourself.

--
Jeremy Thomerson
http://www.wickettraining.com



2010/4/7 wicketyan <wi...@gmail.com>

> I tend  to use chinabank.It's jsp solution is  posting a form to
> http://localhost/chinabank/Receive.jsp ,like this
>
>  send.jsp code:
> <%@ page contentType="text/html; charset=gb2312" language="java"%>
> <%@ page import="java.util.*"%>
> <%@ page import="java.text.*"%>
> <jsp:useBean id="MD5" scope="request" class="beartool.MD5"/>
> <%
> //***********************************************
>
> String v_mid,key,v_url,v_oid,v_amount,v_moneytype,v_md5info;
> v_mid = "1001";
> v_url = "http://localhost/chinabank/Receive.jsp";
>  key = "test";
>  Date currTime = new Date();
>  SimpleDateFormat sf = new
> SimpleDateFormat("yyyyMMdd-"+v_mid+"-hhmmss",Locale.US);
>  v_oid=sf.format(currTime);
> String text = v_amount+v_moneytype+v_oid+v_mid+v_url+key;
> v_md5info = MD5.getMD5ofStr(text);
> ...
>  %>
> <html>
> <body onLoad="javascript:document.E_FORM.submit()">
> <form action="https://pay3.chinabank.com.cn/PayGate" method="POST"
> name="E_FORM">
>
> <input type="hidden" name="v_md5info"    value="<%=v_md5info%>" size="100">
> <input type="hidden" name="v_mid"        value="<%=v_mid%>">
> <input type="hidden" name="v_oid"        value="<%=v_oid%>">
> <input type="hidden" name="v_amount"     value="<%=v_amount%>">
> <input type="hidden" name="v_moneytype"  value="<%=v_moneytype%>">
> <input type="hidden" name="v_url"        value="<%=v_url%>">
>
>
> the problem is I used submit() method,the form will not post to
> https://pay3.chinabank.com.cn/PayGate.
> But I want to process some thing in submit() while posting the form to
> PayGate.
>
> 2010-04-07
>
>
>
> wicketyan
>
>
>
> 发件人: Jeremy Thomerson
> 发送时间: 2010-04-07  10:36:49
> 收件人: users
> 抄送:
> 主题: Re: Re: onlinepayment
>
> throw new RestartResponseAtInterceptPageException(new RedirectPage(url));
> You haven't said anything about what payment solution you're using.  The
> thing is, if you have to redirect the user to the payment solution with the
> pricing (or whatever your "important" param is) as a URL parameter, then
> that will NOT be secured by putting it in JS.  An intelligent user can just
> as easily see the param there.
> --
> Jeremy Thomerson
> http://www.wickettraining.com
> On Tue, Apr 6, 2010 at 9:29 PM, wicketyan <wi...@gmail.com> wrote:
> > Thanks Jeremy Thomerson !
> > is "throw new redirect response and redirect" means this
> > way:WebRequestCycle.get().setRequestTarget(new
> > RedirectRequestTarget("URL...")),using a url like "Wicket.html?opt=admin"
> > .but this will expose the important param in the url.So,writting out
> > javascript is the only way?
> >
> >
> > 2010-04-07
> >
> >
> >
> > wicketyan
> >
> >
> >
> > 发件人: Jeremy Thomerson
> > 发送时间: 2010-04-07  04:17:05
> > 收件人: users
> > 抄送:
> > 主题: Re: onlinepayment
> >
> > throw new redirect response and redirect, or write out javascript that
> does
> > the redirect (target.appendJavascript("")).
> > --
> > Jeremy Thomerson
> > http://www.wickettraining.com
> > On Tue, Apr 6, 2010 at 4:00 AM, wicketyan <wi...@gmail.com> wrote:
> > > Hi! Is anyone can give me code example about online payment using
> ajax.I
> > > have to use form action attribute to post a url,but wicket do not
> support
> > > directing a url  to external website on 'post' way in method submit().
> > >
> > >
> > > 2010-04-06
> > >
> > >
> > >
> > > wicketyan
> > >
> >
>

Re: Re: Re: onlinepayment

Posted by wicketyan <wi...@gmail.com>.
I tend  to use chinabank.It's jsp solution is  posting a form to http://localhost/chinabank/Receive.jsp ,like this

 send.jsp code:
<%@ page contentType="text/html; charset=gb2312" language="java"%>
<%@ page import="java.util.*"%>
<%@ page import="java.text.*"%>
<jsp:useBean id="MD5" scope="request" class="beartool.MD5"/>
<%
//***********************************************
 
String v_mid,key,v_url,v_oid,v_amount,v_moneytype,v_md5info;   
v_mid = "1001";                              
v_url = "http://localhost/chinabank/Receive.jsp";      
  key = "test";   
 Date currTime = new Date();
  SimpleDateFormat sf = new SimpleDateFormat("yyyyMMdd-"+v_mid+"-hhmmss",Locale.US);
  v_oid=sf.format(currTime);  
String text = v_amount+v_moneytype+v_oid+v_mid+v_url+key;    
v_md5info = MD5.getMD5ofStr(text);  
...
 %>
<html>
<body onLoad="javascript:document.E_FORM.submit()">
<form action="https://pay3.chinabank.com.cn/PayGate" method="POST" name="E_FORM">
  
<input type="hidden" name="v_md5info"    value="<%=v_md5info%>" size="100">
<input type="hidden" name="v_mid"        value="<%=v_mid%>">
<input type="hidden" name="v_oid"        value="<%=v_oid%>">
<input type="hidden" name="v_amount"     value="<%=v_amount%>">
<input type="hidden" name="v_moneytype"  value="<%=v_moneytype%>">
<input type="hidden" name="v_url"        value="<%=v_url%>"> 
 

the problem is I used submit() method,the form will not post to https://pay3.chinabank.com.cn/PayGate.
But I want to process some thing in submit() while posting the form to PayGate.

2010-04-07 



wicketyan 



发件人: Jeremy Thomerson 
发送时间: 2010-04-07  10:36:49 
收件人: users 
抄送: 
主题: Re: Re: onlinepayment 
 
throw new RestartResponseAtInterceptPageException(new RedirectPage(url));
You haven't said anything about what payment solution you're using.  The
thing is, if you have to redirect the user to the payment solution with the
pricing (or whatever your "important" param is) as a URL parameter, then
that will NOT be secured by putting it in JS.  An intelligent user can just
as easily see the param there.
--
Jeremy Thomerson
http://www.wickettraining.com
On Tue, Apr 6, 2010 at 9:29 PM, wicketyan <wi...@gmail.com> wrote:
> Thanks Jeremy Thomerson !
> is "throw new redirect response and redirect" means this
> way:WebRequestCycle.get().setRequestTarget(new
> RedirectRequestTarget("URL...")),using a url like "Wicket.html?opt=admin"
> .but this will expose the important param in the url.So,writting out
> javascript is the only way?
>
>
> 2010-04-07
>
>
>
> wicketyan
>
>
>
> 发件人: Jeremy Thomerson
> 发送时间: 2010-04-07  04:17:05
> 收件人: users
> 抄送:
> 主题: Re: onlinepayment
>
> throw new redirect response and redirect, or write out javascript that does
> the redirect (target.appendJavascript("")).
> --
> Jeremy Thomerson
> http://www.wickettraining.com
> On Tue, Apr 6, 2010 at 4:00 AM, wicketyan <wi...@gmail.com> wrote:
> > Hi! Is anyone can give me code example about online payment using ajax.I
> > have to use form action attribute to post a url,but wicket do not support
> > directing a url  to external website on 'post' way in method submit().
> >
> >
> > 2010-04-06
> >
> >
> >
> > wicketyan
> >
>

Re: Re: onlinepayment

Posted by wicketyan <wi...@gmail.com>.
Thanks Jeremy Thomerson !
is "throw new redirect response and redirect" means this way:WebRequestCycle.get().setRequestTarget(new RedirectRequestTarget("URL...")),using a url like "Wicket.html?opt=admin" .but this will expose the important param in the url.So,writting out javascript is the only way?


2010-04-07 



wicketyan 



发件人: Jeremy Thomerson 
发送时间: 2010-04-07  04:17:05 
收件人: users 
抄送: 
主题: Re: onlinepayment 
 
throw new redirect response and redirect, or write out javascript that does
the redirect (target.appendJavascript("")).
--
Jeremy Thomerson
http://www.wickettraining.com
On Tue, Apr 6, 2010 at 4:00 AM, wicketyan <wi...@gmail.com> wrote:
> Hi! Is anyone can give me code example about online payment using ajax.I
> have to use form action attribute to post a url,but wicket do not support
> directing a url  to external website on 'post' way in method submit().
>
>
> 2010-04-06
>
>
>
> wicketyan
>