Re: Re: Re: onlinepayment
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 > 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.*"%> > > <% > //*** > > 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("MMdd-"+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); > ... > %> > > > https://pay3.chinabank.com.cn/PayGate"; method="POST" > name="E_FORM"> > > > > > > > > > > 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 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 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
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 > 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.*"%> > > <% > //*** > > 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("MMdd-"+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); > ... > %> > > > https://pay3.chinabank.com.cn/PayGate"; method="POST" > name="E_FORM"> > > > > > > > > > > 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 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 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
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.*"%> <% //*** 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("MMdd-"+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); ... %> https://pay3.chinabank.com.cn/PayGate"; method="POST" name="E_FORM"> 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 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 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
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 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 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
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 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: Javascript from panel does not work
Please make sure that your JS files are loading. I suspect you may be getting a 404 when loading the JS because you are not referencing them correctly (you're using a relative URL, which may not work depending on where your panel is placed). Also, where is the JS that adds the onclick handler that highlights a row when it is clicked? I'm assuming it much be "ToggleHighLigh.js"? -- Jeremy Thomerson http://www.wickettraining.com On Tue, Apr 6, 2010 at 5:41 PM, Daniela Valero wrote: > Hi everybody > > I'm having a problem with my call to javascript from a panel. The problem > is > tah javascript does not work (if i call it from a page it works fine) > > I'm doing this: > > > src="views/js/jquery-1.3.2.min.js"> > src="views/js/ToggleHighLigh.js"> > > > Click to toggle > highlight > on these > paragraphs > > When I click the element it should call ToggleHighLigh.js, and add a > css > background. > > I tried calling the javascript from Page parent, but it isn't work > > What I'm missing? > > > -- > | Daniela Valero > > "No hay vientos favorables para quien no sabe a donde quiere ir! >
Re: ajaxfallback
Read the javadocs? Callback for the onClick event. If ajax failed and this event was generated > via a normal link the target argument will be null http://wicket.apache.org/docs/1.4/wicket/apidocs/org/apache/wicket/ajax/markup/html/AjaxFallbackLink.html -- Jeremy Thomerson http://www.wickettraining.com On Tue, Apr 6, 2010 at 5:20 PM, tubin gen wrote: > I am using AjaxLink all my application and we add to AjaxRequestTarget > for > repainting components , now we want to change it to use AjaxFallback , but > in ajaxfallback AjaxRequestTarget is null and I get null pointer > exception.Please tell me if there is any way I can move from AjaxLink to > AjaxFallBack link without breaking ? >
Re: Javascript from panel does not work
I tried adding public void renderHead(IHeaderResponse response) { response.renderJavascriptReference("views/js/ToggleHighLigh.js"); response.renderJavascriptReference("views/js/jquery-1.3.2.min.js"); } from IHeaderResponse, but it isn't work 2010/4/6 Daniela Valero > Hi everybody > > I'm having a problem with my call to javascript from a panel. The problem > is tah javascript does not work (if i call it from a page it works fine) > > I'm doing this: > > > src="views/js/jquery-1.3.2.min.js"> > src="views/js/ToggleHighLigh.js"> > > > Click to toggle > highlight > on these > paragraphs > > When I click the element it should call ToggleHighLigh.js, and add a > css background. > > I tried calling the javascript from Page parent, but it isn't work > > What I'm missing? > > > -- > | Daniela Valero > > "No hay vientos favorables para quien no sabe a donde quiere ir! > -- | Daniela Valero "No hay vientos favorables para quien no sabe a donde quiere ir!
Javascript from panel does not work
Hi everybody I'm having a problem with my call to javascript from a panel. The problem is tah javascript does not work (if i call it from a page it works fine) I'm doing this: Click to toggle highlight on these paragraphs element it should call ToggleHighLigh.js, and add a css background. I tried calling the javascript from Page parent, but it isn't work What I'm missing? -- | Daniela Valero "No hay vientos favorables para quien no sabe a donde quiere ir!
Re: Display timeout page for long running requests
alternatively you can have a filter that adds the current thread to some background monitoring process which can, if needed, take over the request. you will need to play around with that and your container - eg test what happens if you interrupt a thread, etc. -igor On Tue, Apr 6, 2010 at 3:33 PM, Gerolf Seitz wrote: > you can use an ajax timer to check if the long running process has finished > after > 5 seconds and abort the process and redirect the user to the timeout page if > it hasn't. > > gerolf > > On Wed, Apr 7, 2010 at 12:11 AM, Mak wrote: > >> Hi All, >> I am new to wicket framework. I have a requirement that my wicket >> application needs to abandon its request processing after the specified >> time (say 5 secs ) has elapsed. Also, an error page / popup >> should be displayed after timeout to notify the user. In other words, >> from user point of view either we should get the correct output page before >> 5 seconds or display timeout page after 5 seconds. >> >> Any ideas/directions on how to implement this requirement would be >> highly appreciated!! >> >> Thanks >> Mak >> > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ajaxfallback
before adding a component to the ajaxrequesttarget, simply check that the target is not null (aka the request is an ajax request). otherwise you don't need to add the components to the ajaxrequesttarget anyway. gerolf On Wed, Apr 7, 2010 at 12:20 AM, tubin gen wrote: > I am using AjaxLink all my application and we add to AjaxRequestTarget > for > repainting components , now we want to change it to use AjaxFallback , but > in ajaxfallback AjaxRequestTarget is null and I get null pointer > exception.Please tell me if there is any way I can move from AjaxLink to > AjaxFallBack link without breaking ? >
Re: Display timeout page for long running requests
you can use an ajax timer to check if the long running process has finished after 5 seconds and abort the process and redirect the user to the timeout page if it hasn't. gerolf On Wed, Apr 7, 2010 at 12:11 AM, Mak wrote: > Hi All, > I am new to wicket framework. I have a requirement that my wicket > application needs to abandon its request processing after the specified > time (say 5 secs ) has elapsed. Also, an error page / popup > should be displayed after timeout to notify the user. In other words, > from user point of view either we should get the correct output page before > 5 seconds or display timeout page after 5 seconds. > > Any ideas/directions on how to implement this requirement would be > highly appreciated!! > > Thanks > Mak >
ajaxfallback
I am using AjaxLink all my application and we add to AjaxRequestTarget for repainting components , now we want to change it to use AjaxFallback , but in ajaxfallback AjaxRequestTarget is null and I get null pointer exception.Please tell me if there is any way I can move from AjaxLink to AjaxFallBack link without breaking ?
Display timeout page for long running requests
Hi All, I am new to wicket framework. I have a requirement that my wicket application needs to abandon its request processing after the specified time (say 5 secs ) has elapsed. Also, an error page / popup should be displayed after timeout to notify the user. In other words, from user point of view either we should get the correct output page before 5 seconds or display timeout page after 5 seconds. Any ideas/directions on how to implement this requirement would be highly appreciated!! Thanks Mak
need developer with wicket experience in Seattle/Bothell area
Hi I am looking to hire a Java dev with some wicket experience along with Hibernate and good object modeling skills. This will be a long term contract position at a major company in the Seattle/Bothell area. If interested please contact s...@yahoo.com with your resume and best times to contact. Thanks sdeo
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 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: DataView, ReuseIfModelsEqualStrategy, Ajax
Thanks Jeremy, that info is very usefull 2010/4/6 Jeremy Thomerson > No - I mean use jQuery, YUI, or whatever you are currently using (or custom > JS that you write without one of these frameworks), and just add a CSS > class > to the dom element on the client-side. There is no reason to make a > roundtrip to the server to simply change the CSS class. That wastes time > and resources, and makes the app less responsive. > > Do something (jQuery code) like > onfocus="$(this).parent().addClass('highlightedfield');" to get started, > then onblur="$(this).parent().removeClass('highlightedfield');" > > -- > Jeremy Thomerson > http://www.wickettraining.com > > > > On Tue, Apr 6, 2010 at 3:02 PM, Daniela Valero > wrote: > > > Hi Jeremy, I'm doing something similar than Araun, but with > > > > item.add(new AjaxEventBehavior("onclick") { > >@Override > > protected void onEvent(AjaxRequestTarget target) { > > HighLitableDataItem hitem = > > (HighLitableDataItem)item; > > hitem.toggleHighlite(); > > > >target.addComponent(item); > > > >} > >}); > > > > > > But, when I click the item, it Highlites a few seconds, then turns back > its > > normal style. > > > > Is that because you suggest do not do it with ajax? > > Is there a way to do this, without rendering all page? > > When you said "JS library and attach to onfocus.". Do you reference > > JSLibrarie inside wicketStuff trunk? > > > > 2010/4/6 Jeremy Thomerson > > > > > Don't do this with AJAX - that's overkill. Just use a JS library and > > > attach > > > to onfocus. > > > > > > -- > > > Jeremy Thomerson > > > http://www.wickettraining.com > > > > > > > > > > > > On Tue, Apr 6, 2010 at 1:21 PM, Arnaud Garcia > > >wrote: > > > > > > > ok, find, so just do: > > > >item.setOutputMarkupPlaceholderTag(true); > > > > and > > > > > > > > myTextField.add(new AjaxEventBehavior("onfocus") { > > > > > > > >@Override > > > >protected void onEvent(AjaxRequestTarget target) > > > > { > > > >item.add(new SimpleAttributeModifier("class", > > > > "selected")); > > > >target.addComponent(item); > > > >} > > > >}); > > > > > > > > > > > > Arnaud > > > > 2010/4/6 Arnaud Garcia > > > > > > > > > Hello, > > > > > > > > > > I have a simple DataView where each row has some labels and > > textfields. > > > > > Each time the user enter in a textfield I would like to highlight > the > > > > > selected row. (The idea is to adapt the wicket stuff example > > > > (OIRPage.java) > > > > > with an AjaxFormComponentUpdatingBehavior("onfocus") instead of a > > > simple > > > > > Link) > > > > > > > > > > > > > > > The example in wicket stuff > > > > > ( > > > > > > > > > > > > > > > http://wicketstuff.org/wicket/repeater/?wicket:bookmarkablePage=:org.apache.wicket.examples.repeater.OIRPage > > > > > ) > > > > > > > > > > shows how to highlight the selected row using > > > ReuseIfModelsEqualStrategy > > > > > when the user click on a Link. > > > > > > > > > > Using the AjaxFormComponentUpdatingBehavior with the "onfocus" > event > > I > > > > try > > > > > to simulate the Link click but it does not work... > > > > > > > > > > myTextField.add(new AjaxFormComponentUpdatingBehavior("onfocus") { > > > > > > > > > > @Override > > > > > protected void onUpdate(AjaxRequestTarget > target) > > { > > > > > HighlitableDataItem hitem = > > > > > (HighlitableDataItem) item; > > > > > hitem.toggleHighlite(); > > > > >// target.addComponent( ??? don' know what > to > > > put > > > > > here, how to re-render the item) > > > > > > > > > > } > > > > > }); > > > > > > > > > > > > > > > Well, any idea > > > > > > > > > > thanks > > > > > > > > > > Arnaud > > > > > > > > > > > > > > > > > > > > -- > > | Daniela Valero > > > > "No hay vientos favorables para quien no sabe a donde quiere ir! > > > -- | Daniela Valero "No hay vientos favorables para quien no sabe a donde quiere ir!
RE: Build custom JavaScript
If the javascript will change often then it's probably best to include it directly into the of the page, otherwise it's just another HTTP request that probably won't be cachable. So to put something in the , you can try a StringHeaderContributor or implement IHeaderContributor. If you really want to use a file, I guess you could probably use JavaScriptResourceReference. The Resource itself would be WebResource or one of its subclasses and would return a StringResourceStream that wraps your generated JS. This is just a guess though since I haven't actually tried it. Craig -Original Message- From: Steven Haines [mailto:lyg...@yahoo.com] Sent: Tuesday, April 06, 2010 9:32 AM To: Wicket User List Subject: Build custom JavaScript For my application I need to dynamically generate JavaScript, which can either be in its own file or even added to my HTML document. I'll handle the generation of the JavaScript, but does anyone have any good strategies for injecting it into a web page or even generating a JavaScript file with Wicket? Thanks Steve - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: DataView, ReuseIfModelsEqualStrategy, Ajax
No - I mean use jQuery, YUI, or whatever you are currently using (or custom JS that you write without one of these frameworks), and just add a CSS class to the dom element on the client-side. There is no reason to make a roundtrip to the server to simply change the CSS class. That wastes time and resources, and makes the app less responsive. Do something (jQuery code) like onfocus="$(this).parent().addClass('highlightedfield');" to get started, then onblur="$(this).parent().removeClass('highlightedfield');" -- Jeremy Thomerson http://www.wickettraining.com On Tue, Apr 6, 2010 at 3:02 PM, Daniela Valero wrote: > Hi Jeremy, I'm doing something similar than Araun, but with > > item.add(new AjaxEventBehavior("onclick") { >@Override > protected void onEvent(AjaxRequestTarget target) { > HighLitableDataItem hitem = > (HighLitableDataItem)item; > hitem.toggleHighlite(); > >target.addComponent(item); > >} >}); > > > But, when I click the item, it Highlites a few seconds, then turns back its > normal style. > > Is that because you suggest do not do it with ajax? > Is there a way to do this, without rendering all page? > When you said "JS library and attach to onfocus.". Do you reference > JSLibrarie inside wicketStuff trunk? > > 2010/4/6 Jeremy Thomerson > > > Don't do this with AJAX - that's overkill. Just use a JS library and > > attach > > to onfocus. > > > > -- > > Jeremy Thomerson > > http://www.wickettraining.com > > > > > > > > On Tue, Apr 6, 2010 at 1:21 PM, Arnaud Garcia > >wrote: > > > > > ok, find, so just do: > > >item.setOutputMarkupPlaceholderTag(true); > > > and > > > > > > myTextField.add(new AjaxEventBehavior("onfocus") { > > > > > >@Override > > >protected void onEvent(AjaxRequestTarget target) > > > { > > >item.add(new SimpleAttributeModifier("class", > > > "selected")); > > >target.addComponent(item); > > >} > > >}); > > > > > > > > > Arnaud > > > 2010/4/6 Arnaud Garcia > > > > > > > Hello, > > > > > > > > I have a simple DataView where each row has some labels and > textfields. > > > > Each time the user enter in a textfield I would like to highlight the > > > > selected row. (The idea is to adapt the wicket stuff example > > > (OIRPage.java) > > > > with an AjaxFormComponentUpdatingBehavior("onfocus") instead of a > > simple > > > > Link) > > > > > > > > > > > > The example in wicket stuff > > > > ( > > > > > > > > > > http://wicketstuff.org/wicket/repeater/?wicket:bookmarkablePage=:org.apache.wicket.examples.repeater.OIRPage > > > > ) > > > > > > > > shows how to highlight the selected row using > > ReuseIfModelsEqualStrategy > > > > when the user click on a Link. > > > > > > > > Using the AjaxFormComponentUpdatingBehavior with the "onfocus" event > I > > > try > > > > to simulate the Link click but it does not work... > > > > > > > > myTextField.add(new AjaxFormComponentUpdatingBehavior("onfocus") { > > > > > > > > @Override > > > > protected void onUpdate(AjaxRequestTarget target) > { > > > > HighlitableDataItem hitem = > > > > (HighlitableDataItem) item; > > > > hitem.toggleHighlite(); > > > >// target.addComponent( ??? don' know what to > > put > > > > here, how to re-render the item) > > > > > > > > } > > > > }); > > > > > > > > > > > > Well, any idea > > > > > > > > thanks > > > > > > > > Arnaud > > > > > > > > > > > > > -- > | Daniela Valero > > "No hay vientos favorables para quien no sabe a donde quiere ir! >
Re: DataView, ReuseIfModelsEqualStrategy, Ajax
Hi Jeremy, I'm doing something similar than Araun, but with item.add(new AjaxEventBehavior("onclick") { @Override protected void onEvent(AjaxRequestTarget target) { HighLitableDataItem hitem = (HighLitableDataItem)item; hitem.toggleHighlite(); target.addComponent(item); } }); But, when I click the item, it Highlites a few seconds, then turns back its normal style. Is that because you suggest do not do it with ajax? Is there a way to do this, without rendering all page? When you said "JS library and attach to onfocus.". Do you reference JSLibrarie inside wicketStuff trunk? 2010/4/6 Jeremy Thomerson > Don't do this with AJAX - that's overkill. Just use a JS library and > attach > to onfocus. > > -- > Jeremy Thomerson > http://www.wickettraining.com > > > > On Tue, Apr 6, 2010 at 1:21 PM, Arnaud Garcia >wrote: > > > ok, find, so just do: > >item.setOutputMarkupPlaceholderTag(true); > > and > > > > myTextField.add(new AjaxEventBehavior("onfocus") { > > > >@Override > >protected void onEvent(AjaxRequestTarget target) > > { > >item.add(new SimpleAttributeModifier("class", > > "selected")); > >target.addComponent(item); > >} > >}); > > > > > > Arnaud > > 2010/4/6 Arnaud Garcia > > > > > Hello, > > > > > > I have a simple DataView where each row has some labels and textfields. > > > Each time the user enter in a textfield I would like to highlight the > > > selected row. (The idea is to adapt the wicket stuff example > > (OIRPage.java) > > > with an AjaxFormComponentUpdatingBehavior("onfocus") instead of a > simple > > > Link) > > > > > > > > > The example in wicket stuff > > > ( > > > > > > http://wicketstuff.org/wicket/repeater/?wicket:bookmarkablePage=:org.apache.wicket.examples.repeater.OIRPage > > > ) > > > > > > shows how to highlight the selected row using > ReuseIfModelsEqualStrategy > > > when the user click on a Link. > > > > > > Using the AjaxFormComponentUpdatingBehavior with the "onfocus" event I > > try > > > to simulate the Link click but it does not work... > > > > > > myTextField.add(new AjaxFormComponentUpdatingBehavior("onfocus") { > > > > > > @Override > > > protected void onUpdate(AjaxRequestTarget target) { > > > HighlitableDataItem hitem = > > > (HighlitableDataItem) item; > > > hitem.toggleHighlite(); > > >// target.addComponent( ??? don' know what to > put > > > here, how to re-render the item) > > > > > > } > > > }); > > > > > > > > > Well, any idea > > > > > > thanks > > > > > > Arnaud > > > > > > -- | Daniela Valero "No hay vientos favorables para quien no sabe a donde quiere ir!
Re: LoadableDetachable Models
Yes, this method won't work for all cases, but it does help for some. On Tue, Apr 6, 2010 at 12:26 PM, Russell Morrisey wrote: > Sorry; what I meant is that the value of the model is stored as a hard > reference. So this will work if your model is a string (person.firstName) but > the OP was concerned with manipulating a list of objects. The concern is if > your model's value is also a persistent object. For example a drop-down, to > select person.manager from a list; or a custom list control to set the value > of person.managerList, if person has 7 bosses (and has to hear about their > mistakes 7 times). The value of "manager" would be stored on the proxy (which > is a potential issue if the value of "manager" is a persistent person object). > > RUSSELL E. MORRISEY > Programmer Analyst Professional > Mission Solutions Engineering, LLC > > | russell.morri...@missionse.com | www.missionse.com > 304 West Route 38, Moorestown, NJ 08057 > > -Original Message- > From: James Carman [mailto:jcar...@carmanconsulting.com] > Sent: Monday, April 05, 2010 10:16 PM > To: users@wicket.apache.org > Subject: Re: LoadableDetachable Models > > It doesn't hold onto the persistent object. Here's an example usage: > > IModel personModel = ...; // Some LDM here! > ProxyModelManager mgr = new ProxyModelManager(); > add(new TextField("firstName", mgr.proxy(new > PropertyModel(personModel, "firstName"; > > Then, later on in the onSubmit() method, you'd call mgr.commit(). > It's not going to hold onto the object that's loaded from the LDM. It > would hold onto the property values of the object that's loaded from > the LDM, but that's okay. > > On Mon, Apr 5, 2010 at 9:23 PM, Russell Morrisey > wrote: >> This approach stores a hard reference to the object. It seems prone to >> causing LazyInitializationExceptions when used with Hibernate. You are >> storing a reference to a persistent object (in this case, the regular Model >> object of the ProxyModel), so if you close your session at the end of the >> request, I would expect you to get this exception on the next request when >> you call a method on a lazy proxy object (ex: >> ((MyObject)model.getObject()).getLazyProperty().getName()). >> >> Do you have some other code to work around it? (like loading a fresh object >> from the session at the beginning of the request) It may be you don't hit >> this problem in your use case. >> >> RUSSELL E. MORRISEY >> Programmer Analyst Professional >> Mission Solutions Engineering, LLC >> >> | russell.morri...@missionse.com | www.missionse.com >> 304 West Route 38, Moorestown, NJ 08057 >> >> >> -Original Message- >> From: James Carman [mailto:jcar...@carmanconsulting.com] >> Sent: Monday, April 05, 2010 9:05 PM >> To: users@wicket.apache.org >> Subject: Re: LoadableDetachable Models >> >> You can use what we call a "shadow model" or a "proxy model." >> >> https://wicketopia.svn.sourceforge.net/svnroot/wicketopia/trunk/wicketopia/src/main/java/org/wicketopia/model/proxy/ProxyModelManager.java >> >> This approach will work for you. Basically, you use the >> ProxyModelManager to "wrap" all of your real models (you have to >> explicitly create models to use this and can't use >> CompoundPropertyModel). Then, when you're done with what you're >> doing, you "commit" your changes into the real models. >> >> On Mon, Apr 5, 2010 at 6:11 PM, Russell Morrisey >> wrote: >>> Jeffrey, >>> >>> The problem is that if you use an LDM, the list is loaded from persistent >>> storage, and any non-persisted changes from the previous request are lost. >>> If you don't use an LDM, though, you will have stale objects hanging around >>> from the previous Hibernate session (as you mentioned). >>> >>> Think in the mindset that persistent Hibernate objects are only "valid" >>> within the context of a request. Only transient objects are safe to hold >>> references to. You can implement a custom model which keeps track of >>> transient items between requests. It can extend LDM. >>> >>> For example: >>> -Custom LDM loads the list from persistent storage >>> -User clicks a button to add an object to the list >>> -myCustomModel.addObject(newObject) is called by your ajax behavior >>> (triggered by the click) >>> -The list is modified, and your model internally stores a list of transient >>> objects which were added or removed >>> -On the next request, your implementation of load() can get the persistent >>> list from the database, and modify it according to the un-persisted changes >>> the model knows about (make a copy of the list and add or remove the >>> transient items). >>> >>> If you don't like putting a method like addObject(...) on your model, you >>> could put some logic in your setObject(...) method which sorts out the >>> changes made to the list. You should not hold a reference to a persistent >>> object after detach(). A tool like JProbe or jvisualvm (in JDK6) is great >>> for identifying problem cases. >>> >>
Re: What happens after browser's 'back' button?
Thanks for the tip! I'll make sure I set that up in my base page. On Tue, Apr 6, 2010 at 3:53 PM, Craig McIlwee wrote: > You're right James, I failed to mention that my approach will not work for > stateless pages. A stateful URL is needed to identify the previous page > instance. Regarding Firefox's lack of server trip on back button, this is > what I was getting at with the cache header stuff I mentioned. The WebPage > class's setHeaders method (in v1.4.1) looks like > > protected void setHeaders(WebResponse response) > { > response.setHeader("Pragma", "no-cache"); > response.setHeader("Cache-Control", "no-cache, max-age=0, > must-revalidate"); // no-store > } > > The "// no-store" is actually there. Overriding it with > > protected void setHeaders(WebResponse response) > { > response.setHeader("Pragma", "no-cache"); > response.setHeader("Cache-Control", "no-cache, max-age=0, > must-revalidate, no-store"); > } > > Will cause firefox to make a trip to the server when back button is pressed. > In my experience this is required for AJAX & the back button, otherwise > wicket won't know that the user hit back and will ignore AJAX requests > because they are being executed against a page that (as far as wicket knows) > is not the active page. > > Craig > > -Original Message- > From: James Carman [mailto:jcar...@carmanconsulting.com] > Sent: Tuesday, April 06, 2010 8:56 AM > To: users@wicket.apache.org > Subject: Re: What happens after browser's 'back' button? > > On Tue, Apr 6, 2010 at 8:07 AM, McIlwee, Craig > wrote: >> As long as you prevent the browser from caching the page with the form (just >> the page itself, caching the resources is fine) then when the user hits back >> wicket will pull the old page instance from the pagemap and rerender it. >> That page instance is the same one that was used the first time, so its >> state will still be the same. Just set some flag when the user submits, and >> also check that flag when processing the form like this: >> > > Not exactly. How would Wicket know to pull the "old" page instance if > the browser is re-requesting a bookmarkable URL? It wouldn't. It > would just reconstruct the page from scratch. In fact, Firefox > doesn't re-request anything from Wicket when you click the back button > (at least it doesn't in my app when IE does, go figure). The way > Wicket keeps everything in synch is that each URL in your rendered > page (for forms, links, etc.) has information on it that "points" to a > specific page in the page map (that's what all the ?wicket:interface > stuff is). So, when a form is submitted or a link (non-bookmarkable) > is clicked on your page, Wicket will load the specific page instance > from the page map and invoke the request on that. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: What happens after browser's 'back' b utton?
You're right James, I failed to mention that my approach will not work for stateless pages. A stateful URL is needed to identify the previous page instance. Regarding Firefox's lack of server trip on back button, this is what I was getting at with the cache header stuff I mentioned. The WebPage class's setHeaders method (in v1.4.1) looks like protected void setHeaders(WebResponse response) { response.setHeader("Pragma", "no-cache"); response.setHeader("Cache-Control", "no-cache, max-age=0, must-revalidate"); // no-store } The "// no-store" is actually there. Overriding it with protected void setHeaders(WebResponse response) { response.setHeader("Pragma", "no-cache"); response.setHeader("Cache-Control", "no-cache, max-age=0, must-revalidate, no-store"); } Will cause firefox to make a trip to the server when back button is pressed. In my experience this is required for AJAX & the back button, otherwise wicket won't know that the user hit back and will ignore AJAX requests because they are being executed against a page that (as far as wicket knows) is not the active page. Craig -Original Message- From: James Carman [mailto:jcar...@carmanconsulting.com] Sent: Tuesday, April 06, 2010 8:56 AM To: users@wicket.apache.org Subject: Re: What happens after browser's 'back' button? On Tue, Apr 6, 2010 at 8:07 AM, McIlwee, Craig wrote: > As long as you prevent the browser from caching the page with the form (just > the page itself, caching the resources is fine) then when the user hits back > wicket will pull the old page instance from the pagemap and rerender it. > That page instance is the same one that was used the first time, so its state > will still be the same. Just set some flag when the user submits, and also > check that flag when processing the form like this: > Not exactly. How would Wicket know to pull the "old" page instance if the browser is re-requesting a bookmarkable URL? It wouldn't. It would just reconstruct the page from scratch. In fact, Firefox doesn't re-request anything from Wicket when you click the back button (at least it doesn't in my app when IE does, go figure). The way Wicket keeps everything in synch is that each URL in your rendered page (for forms, links, etc.) has information on it that "points" to a specific page in the page map (that's what all the ?wicket:interface stuff is). So, when a form is submitted or a link (non-bookmarkable) is clicked on your page, Wicket will load the specific page instance from the page map and invoke the request on that. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Any "mature" work on integrating Hibernate Validator with Wicket?
Hi David, The code may be simple, but the idea/benefits I see may be great. Wouldn't > be better to make it available on wicketstuff in good shape instead of me or > others googling it out? :) Just my 2 cents. > I totally agree with you here. I find JSR-303 to be a great standard that addresses the validation problem very well, so having a minimal start point inside wicket to use it would be a good idea. Seeing as it is only 2 simple classes, and that the external dependencies can be reduced to a minimum (just javax-validation-api), I proposed a RFE in wickets jira: https://issues.apache.org/jira/browse/WICKET-2825 Vote for it if you like the idea :-) > Regards, > > David > > > --- On Mon, 4/5/10, Carlos Vara wrote: > > > From: Carlos Vara > > Subject: Re: Any "mature" work on integrating Hibernate Validator with > Wicket? > > To: users@wicket.apache.org > > Date: Monday, April 5, 2010, 4:52 PM > > Hi David, > > > > I'm the author of the first article that you linked to: > > http://carinae.net/tag/hibernate-validator/ > > > > < > http://carinae.net/2009/12/integration-of-jsr-303-bean-validation-standard-and-wicket-1-4/ > >Basically, > > you hardly need more than the two provided validators (for > > property > > validation on field input, and full bean validation on form > > input). I added > > some extra code to integrate it with Spring and to > > centralize the locale, > > but if you don't need it, you can easily use only those > > validators without > > anything else. > > > > The way I see it, there is no code in wicketstuff because > > it is quite simple > > to integrate jsr303 and wicket, so picking the code from my > > or others blog, > > and maybe tweaking it a little for your needs is probably > > all you need. > > > > > > > > On Mon, Apr 5, 2010 at 9:39 PM, Ben Tilford > > wrote: > > > > > So far this is what I've got. Doesn't do anything with > > groups or the more > > > advanced stuff but this may be all it takes. > > > > > > public class BeanComponentValidator extends > > AbstractValidator { > > > > > > > > >public BeanComponentValidator() { > > >super(); > > >} > > > > > > > > >@Override > > >protected void > > onValidate(IValidatable validatable) { > > > > > for(ConstraintViolation violation : > > > validate(validatable.getValue())) { > > > > > validatable.error(new > > > > > ValidationError().addMessageKey(violation.getMessage())); > > >} > > > > > >} > > > > > >Set> > > validate(T value) { > > >Validator validator = > > > > > > > > Validation.buildDefaultValidatorFactory().getValidator();//this > > may only > > > be > > > working because I'm using Spring 3.0.2 and Hibernate > > 3.5 I don't know for > > > sure. > > >return > > validator.validate(value); > > >} > > > } > > > > > > > > > On Mon, Apr 5, 2010 at 12:15 PM, Martin Makundi < > > > martin.maku...@koodaripalvelut.com> > > wrote: > > > > > > > Hi! > > > > > > > > It's quite easy to add trivial min/max/required > > validators using (any) > > > > helper method. Maybe bindgen project would be > > closest to this.. it's > > > > already working with annotations, it could > > perhaps parse also > > > > annotations of property target objects. > > > > > > > > ** > > > > Martin > > > > > > > > 2010/4/5 David Chang : > > > > > Using Hibernate Validator may bring a few > > good things: > > > > > > > > > > 1. On the data end, it helps to improve > > data, performance, etc. Also > > > the > > > > annotation you write on domain objects get > > translated into database > > > creation > > > > and objects save/update. You can find more on in > > this area. Obviously, > > > this > > > > has nothing to do with wicket. > > > > > > > > > > 2. Regarding the web tier, it is often > > needed to write validation rules > > > > such as not null or the maximum chars in an input > > field being less than > > > 10. > > > > In pure wicket, you have to add many validation > > rules yourself manually > > > for > > > > each field. Why should I do so second time in > > wicket if I can explicitly > > > > specify them on domain objects via Hibernate > > Validator (or Bean > > > Validation, > > > > JSR 303, now official)? I hope to see wicket can > > take adavantage of bean > > > > validation to let us code faster and have more > > maintainable code. > > > > > > > > > > Please feel free to comment I am wrong. > > > > > > > > > > Best. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --- On Mon, 4/5/10, Martin Makundi < > martin.maku...@koodaripalvelut.com > > > > > > > > wrote: > > > > > > > > > >> From: Martin Makundi > > > > >> Subject: Re: Any "mature" work on > > integrating Hibernate Validator with > > > > Wicket? > > > > >> To: users@wicket.apache.org > > > > >> Date: Monday, April 5, 2010, 11:31 AM > > > > >> Do you have any user stories on the > > > > >> topic? It would be useful to > > > > >> evaluate how interesting the use case > > is. Me myself I > > > > >> cannot immagine > > > >
Re: DataView, ReuseIfModelsEqualStrategy, Ajax
Don't do this with AJAX - that's overkill. Just use a JS library and attach to onfocus. -- Jeremy Thomerson http://www.wickettraining.com On Tue, Apr 6, 2010 at 1:21 PM, Arnaud Garcia wrote: > ok, find, so just do: >item.setOutputMarkupPlaceholderTag(true); > and > > myTextField.add(new AjaxEventBehavior("onfocus") { > >@Override >protected void onEvent(AjaxRequestTarget target) > { >item.add(new SimpleAttributeModifier("class", > "selected")); >target.addComponent(item); >} >}); > > > Arnaud > 2010/4/6 Arnaud Garcia > > > Hello, > > > > I have a simple DataView where each row has some labels and textfields. > > Each time the user enter in a textfield I would like to highlight the > > selected row. (The idea is to adapt the wicket stuff example > (OIRPage.java) > > with an AjaxFormComponentUpdatingBehavior("onfocus") instead of a simple > > Link) > > > > > > The example in wicket stuff > > ( > > > http://wicketstuff.org/wicket/repeater/?wicket:bookmarkablePage=:org.apache.wicket.examples.repeater.OIRPage > > ) > > > > shows how to highlight the selected row using ReuseIfModelsEqualStrategy > > when the user click on a Link. > > > > Using the AjaxFormComponentUpdatingBehavior with the "onfocus" event I > try > > to simulate the Link click but it does not work... > > > > myTextField.add(new AjaxFormComponentUpdatingBehavior("onfocus") { > > > > @Override > > protected void onUpdate(AjaxRequestTarget target) { > > HighlitableDataItem hitem = > > (HighlitableDataItem) item; > > hitem.toggleHighlite(); > >// target.addComponent( ??? don' know what to put > > here, how to re-render the item) > > > > } > > }); > > > > > > Well, any idea > > > > thanks > > > > Arnaud > > >
Re: retrieve class value
You might consider making a dynamic behavior that can change itself. ** Martin 2010/4/6 Arnaud Garcia : > Hello, > > It is pretty easy using SimpleAttributeModifier to set the class of a Label > for example, but how to retrieve it ? > > My css classes due to lot of AjaxBehaviors change very often for a Label > field and I would like to find the associated class before changing it ? > > > thanks > > arnaud > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
retrieve class value
Hello, It is pretty easy using SimpleAttributeModifier to set the class of a Label for example, but how to retrieve it ? My css classes due to lot of AjaxBehaviors change very often for a Label field and I would like to find the associated class before changing it ? thanks arnaud
Speaking about Wicket
Hi guys, I am organising a talk on Wicket at the end of April for the Java User Group Scotland. We expect about 20 people for our meeting in Edinburgh and are comparing the framework to GWT which was presented last month. I am posting to the list because I was wondering if anyone was in the area and would be happy to come and speak. If not I would still be interested in any useful material or tips for such a topic. Many thanks in advance for any responses, Andrew Williams Java User Group Scotland - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: DataView, ReuseIfModelsEqualStrategy, Ajax
ok, find, so just do: item.setOutputMarkupPlaceholderTag(true); and myTextField.add(new AjaxEventBehavior("onfocus") { @Override protected void onEvent(AjaxRequestTarget target) { item.add(new SimpleAttributeModifier("class", "selected")); target.addComponent(item); } }); Arnaud 2010/4/6 Arnaud Garcia > Hello, > > I have a simple DataView where each row has some labels and textfields. > Each time the user enter in a textfield I would like to highlight the > selected row. (The idea is to adapt the wicket stuff example (OIRPage.java) > with an AjaxFormComponentUpdatingBehavior("onfocus") instead of a simple > Link) > > > The example in wicket stuff > ( > http://wicketstuff.org/wicket/repeater/?wicket:bookmarkablePage=:org.apache.wicket.examples.repeater.OIRPage > ) > > shows how to highlight the selected row using ReuseIfModelsEqualStrategy > when the user click on a Link. > > Using the AjaxFormComponentUpdatingBehavior with the "onfocus" event I try > to simulate the Link click but it does not work... > > myTextField.add(new AjaxFormComponentUpdatingBehavior("onfocus") { > > @Override > protected void onUpdate(AjaxRequestTarget target) { > HighlitableDataItem hitem = > (HighlitableDataItem) item; > hitem.toggleHighlite(); >// target.addComponent( ??? don' know what to put > here, how to re-render the item) > > } > }); > > > Well, any idea > > thanks > > Arnaud >
Re: multiple feedback panels in same page
I just had this page with 2 forms issue - each form has some RequiredTextFields, and some fields with custom StringValidators that I didn't want to change from error to form.error. This thread got me 90% of the way there, but new FeedbackPanel("feedback", new *Container*FeedbackMessageFilter(myForm)) did the trick for my situation. Just thought I'd mention it for benefit of fellow googlers in case they try *Component*FeedbackMessageFilter and wonder where the messages went... -- Jim P. On Fri, Aug 21, 2009 at 8:34 PM, satar wrote: > > Thank you for the quick example. I think I actually seen this way of > setting > up a feedback panel at one point in time but had forgotten and then bumped > into the problem of having two feedback panels on one page. This got me > moving on quickly -- thank again! > -- > View this message in context: > http://www.nabble.com/multiple-feedback-panels-in-same-page-tp22298693p25089341.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: Best Practices for Using JavaScript With Wicket
ah, great! Thanks Stefan. This is what I was looking for. - Nishant On Tue, Apr 6, 2010 at 9:45 PM, Stefan Lindner wrote: > Hi Nishant, > > you should use > >component.setOutputMarkupId(true); > > this tells wicket to generate a unique markup id. You can refer to the > generated id with > > component.getMerkupId(); > > later. > > If you want to add some javascript to your page, you may use two different > tricks: > > A: Ajax-related > If you have an AjaxTrigger (e.g. an AjaxLink) do the following > >AjaxLink() { >onClick(AjaxRequestTarget target) { >target.appendJavaScript(); >// e.g. doSomethingWithDomelementWithId('"+ > component.getmarkupId()+ "'); >} >} > > B. during page creation > If you want to bind some javascript during page creation/HTML render time > try this > >Class MyPanel extends Panel { >... > >@Override >public void renderHead(HtmlHeaderContainer container) { > > container.getHeaderResponse().renderJavascriptReference( reference to your js library here>); > > container.getHeaderResponse().renderOnDomReadyJavascript("soSomethingWith('" > + getMarkupId() + "');"); >} >} > > And: Please have a look at the javadocs. > > Stefan > > -Ursprüngliche Nachricht- > Von: Nishant Neeraj [mailto:nishant.has.a.quest...@gmail.com] > Gesendet: Dienstag, 6. April 2010 18:02 > An: users@wicket.apache.org > Betreff: Re: Best Practices for Using JavaScript With Wicket > > Thanks Jeremy. > > I had been using component.setMarkupId(..); which is not recommended... so > I > was wondering what is the standard. > I need to get hands-on JS-Wicket integration, so I was looking for a good > organized documentation/resource (other than WIA). > > > So, what's the objection to using it? > > :) Nothing against wiQuery and I, probably, will go with wiQuery... I was > worried if I can integrate various the plug-ins available like jNice ( > http://www.whitespace-creative.com/jquery/jNice/) and likes. > > Thanks for pointers. > Nishant > > On Tue, Apr 6, 2010 at 4:26 AM, Jeremy Thomerson > wrote: > > > > > > > I am finding it very cumbersome to integrate JavaScript/JS-library. Can > > > someone point to (or probably write a blog-post on :->) the best > > practices > > > of integrating JS/JS-library with Wicket. > > > > > > > Wicket is pretty flexible in that you can integrate your JS a dozen > > different ways. jQuery is especially easy to integrate with because the > > programming model matches Wicket's fairly nicely. The primary thing is > > that > > if you want to use element IDs to tie in to jQuery, you'll need to do > this > > from behaviors in your java code so that you get the correct ID. > > > > > > > > > > I am using JQuery but I would like to know the best approach without > > using > > > WiQuery or jWicket. (Unless, I have to write my own jWicket to get this > > > done.) > > > > > > > I'm not sure I understand. wiQuery has been fairly well recognized as a > > very nice Wicket/jQuery integration. It has active development and a > > helpful mailing list. So, what's the objection to using it? I'm not > > saying > > that you can't have an objection, I just wonder what it is. It's an open > > source project, so you can use it as a base and add your own > functionality > > as needed (hopefully contributing back). > > > > Even if you don't want to use it, you can see some of the things they are > > doing with it - it has some very nice features, including mergin all the > JS > > header contributions into a common (single) resource file. > > > > -- > > Jeremy Thomerson > > http://www.wickettraining.com > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
method error on construction time
Hi all, I have a page when an error is thrown. This page is constructed in MyCustomRequestCycle.onRuntimeException. This page is also use to send any kind of message apart from errors. I add an error("some error has occurred, please complete the form explaining what happened "); for error cases. But this message is not render in the page. The cases I usually use for error messages are in the onClick and onError methods.* But this is the first time I need an error message in construction time. Why is not rendered?* thanks in advance -- Fernando Wermus. www.linkedin.com/in/fernandowermus
RE: LoadableDetachable Models
Sorry; what I meant is that the value of the model is stored as a hard reference. So this will work if your model is a string (person.firstName) but the OP was concerned with manipulating a list of objects. The concern is if your model's value is also a persistent object. For example a drop-down, to select person.manager from a list; or a custom list control to set the value of person.managerList, if person has 7 bosses (and has to hear about their mistakes 7 times). The value of "manager" would be stored on the proxy (which is a potential issue if the value of "manager" is a persistent person object). RUSSELL E. MORRISEY Programmer Analyst Professional Mission Solutions Engineering, LLC | russell.morri...@missionse.com | www.missionse.com 304 West Route 38, Moorestown, NJ 08057 -Original Message- From: James Carman [mailto:jcar...@carmanconsulting.com] Sent: Monday, April 05, 2010 10:16 PM To: users@wicket.apache.org Subject: Re: LoadableDetachable Models It doesn't hold onto the persistent object. Here's an example usage: IModel personModel = ...; // Some LDM here! ProxyModelManager mgr = new ProxyModelManager(); add(new TextField("firstName", mgr.proxy(new PropertyModel(personModel, "firstName"; Then, later on in the onSubmit() method, you'd call mgr.commit(). It's not going to hold onto the object that's loaded from the LDM. It would hold onto the property values of the object that's loaded from the LDM, but that's okay. On Mon, Apr 5, 2010 at 9:23 PM, Russell Morrisey wrote: > This approach stores a hard reference to the object. It seems prone to > causing LazyInitializationExceptions when used with Hibernate. You are > storing a reference to a persistent object (in this case, the regular Model > object of the ProxyModel), so if you close your session at the end of the > request, I would expect you to get this exception on the next request when > you call a method on a lazy proxy object (ex: > ((MyObject)model.getObject()).getLazyProperty().getName()). > > Do you have some other code to work around it? (like loading a fresh object > from the session at the beginning of the request) It may be you don't hit > this problem in your use case. > > RUSSELL E. MORRISEY > Programmer Analyst Professional > Mission Solutions Engineering, LLC > > | russell.morri...@missionse.com | www.missionse.com > 304 West Route 38, Moorestown, NJ 08057 > > > -Original Message- > From: James Carman [mailto:jcar...@carmanconsulting.com] > Sent: Monday, April 05, 2010 9:05 PM > To: users@wicket.apache.org > Subject: Re: LoadableDetachable Models > > You can use what we call a "shadow model" or a "proxy model." > > https://wicketopia.svn.sourceforge.net/svnroot/wicketopia/trunk/wicketopia/src/main/java/org/wicketopia/model/proxy/ProxyModelManager.java > > This approach will work for you. Basically, you use the > ProxyModelManager to "wrap" all of your real models (you have to > explicitly create models to use this and can't use > CompoundPropertyModel). Then, when you're done with what you're > doing, you "commit" your changes into the real models. > > On Mon, Apr 5, 2010 at 6:11 PM, Russell Morrisey > wrote: >> Jeffrey, >> >> The problem is that if you use an LDM, the list is loaded from persistent >> storage, and any non-persisted changes from the previous request are lost. >> If you don't use an LDM, though, you will have stale objects hanging around >> from the previous Hibernate session (as you mentioned). >> >> Think in the mindset that persistent Hibernate objects are only "valid" >> within the context of a request. Only transient objects are safe to hold >> references to. You can implement a custom model which keeps track of >> transient items between requests. It can extend LDM. >> >> For example: >> -Custom LDM loads the list from persistent storage >> -User clicks a button to add an object to the list >> -myCustomModel.addObject(newObject) is called by your ajax behavior >> (triggered by the click) >> -The list is modified, and your model internally stores a list of transient >> objects which were added or removed >> -On the next request, your implementation of load() can get the persistent >> list from the database, and modify it according to the un-persisted changes >> the model knows about (make a copy of the list and add or remove the >> transient items). >> >> If you don't like putting a method like addObject(...) on your model, you >> could put some logic in your setObject(...) method which sorts out the >> changes made to the list. You should not hold a reference to a persistent >> object after detach(). A tool like JProbe or jvisualvm (in JDK6) is great >> for identifying problem cases. >> >> If you have a component who depends on the data from another component with >> unsaved changes, you can submit data for the "prerequisite" in the same >> request, so that the information is current. >> >> HTH, >> >> RUSSELL E. MORRISEY >> Programmer Analyst P
AW: Best Practices for Using JavaScript With Wicket
Hi Nishant, you should use component.setOutputMarkupId(true); this tells wicket to generate a unique markup id. You can refer to the generated id with component.getMerkupId(); later. If you want to add some javascript to your page, you may use two different tricks: A: Ajax-related If you have an AjaxTrigger (e.g. an AjaxLink) do the following AjaxLink() { onClick(AjaxRequestTarget target) { target.appendJavaScript(); // e.g. doSomethingWithDomelementWithId('"+ component.getmarkupId()+ "'); } } B. during page creation If you want to bind some javascript during page creation/HTML render time try this Class MyPanel extends Panel { ... @Override public void renderHead(HtmlHeaderContainer container) { container.getHeaderResponse().renderJavascriptReference(); container.getHeaderResponse().renderOnDomReadyJavascript("soSomethingWith('" + getMarkupId() + "');"); } } And: Please have a look at the javadocs. Stefan -Ursprüngliche Nachricht- Von: Nishant Neeraj [mailto:nishant.has.a.quest...@gmail.com] Gesendet: Dienstag, 6. April 2010 18:02 An: users@wicket.apache.org Betreff: Re: Best Practices for Using JavaScript With Wicket Thanks Jeremy. I had been using component.setMarkupId(..); which is not recommended... so I was wondering what is the standard. I need to get hands-on JS-Wicket integration, so I was looking for a good organized documentation/resource (other than WIA). > So, what's the objection to using it? :) Nothing against wiQuery and I, probably, will go with wiQuery... I was worried if I can integrate various the plug-ins available like jNice ( http://www.whitespace-creative.com/jquery/jNice/) and likes. Thanks for pointers. Nishant On Tue, Apr 6, 2010 at 4:26 AM, Jeremy Thomerson wrote: > > > > I am finding it very cumbersome to integrate JavaScript/JS-library. Can > > someone point to (or probably write a blog-post on :->) the best > practices > > of integrating JS/JS-library with Wicket. > > > > Wicket is pretty flexible in that you can integrate your JS a dozen > different ways. jQuery is especially easy to integrate with because the > programming model matches Wicket's fairly nicely. The primary thing is > that > if you want to use element IDs to tie in to jQuery, you'll need to do this > from behaviors in your java code so that you get the correct ID. > > > > > > I am using JQuery but I would like to know the best approach without > using > > WiQuery or jWicket. (Unless, I have to write my own jWicket to get this > > done.) > > > > I'm not sure I understand. wiQuery has been fairly well recognized as a > very nice Wicket/jQuery integration. It has active development and a > helpful mailing list. So, what's the objection to using it? I'm not > saying > that you can't have an objection, I just wonder what it is. It's an open > source project, so you can use it as a base and add your own functionality > as needed (hopefully contributing back). > > Even if you don't want to use it, you can see some of the things they are > doing with it - it has some very nice features, including mergin all the JS > header contributions into a common (single) resource file. > > -- > Jeremy Thomerson > http://www.wickettraining.com > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Best Practices for Using JavaScript With Wicket
Thanks Jeremy. I had been using component.setMarkupId(..); which is not recommended... so I was wondering what is the standard. I need to get hands-on JS-Wicket integration, so I was looking for a good organized documentation/resource (other than WIA). > So, what's the objection to using it? :) Nothing against wiQuery and I, probably, will go with wiQuery... I was worried if I can integrate various the plug-ins available like jNice ( http://www.whitespace-creative.com/jquery/jNice/) and likes. Thanks for pointers. Nishant On Tue, Apr 6, 2010 at 4:26 AM, Jeremy Thomerson wrote: > > > > I am finding it very cumbersome to integrate JavaScript/JS-library. Can > > someone point to (or probably write a blog-post on :->) the best > practices > > of integrating JS/JS-library with Wicket. > > > > Wicket is pretty flexible in that you can integrate your JS a dozen > different ways. jQuery is especially easy to integrate with because the > programming model matches Wicket's fairly nicely. The primary thing is > that > if you want to use element IDs to tie in to jQuery, you'll need to do this > from behaviors in your java code so that you get the correct ID. > > > > > > I am using JQuery but I would like to know the best approach without > using > > WiQuery or jWicket. (Unless, I have to write my own jWicket to get this > > done.) > > > > I'm not sure I understand. wiQuery has been fairly well recognized as a > very nice Wicket/jQuery integration. It has active development and a > helpful mailing list. So, what's the objection to using it? I'm not > saying > that you can't have an objection, I just wonder what it is. It's an open > source project, so you can use it as a base and add your own functionality > as needed (hopefully contributing back). > > Even if you don't want to use it, you can see some of the things they are > doing with it - it has some very nice features, including mergin all the JS > header contributions into a common (single) resource file. > > -- > Jeremy Thomerson > http://www.wickettraining.com >
Re: Forms in a base class
Hi All, I'm sorry if this is off-topic but I have a problem that's very similar and since you are talking about this here and seem to know what you're doing, I was thinking you might be able to help. I'm trying to create a basic form that all other forms in my project will extend, it's gonna have basic fields like name and description, and the rest (type specific fields) will be implemented by the children. however, my question is, does a form have an associated html file like a panel, or should all the children write the name and description fields in their respective markups? Now I saw that you're using a different methodology, which could maybe apply to my use case, but this method makes more sense to me but maybe it's not possible. just to reiterate, here's what I'm trying to do: Let's say i have 2 Pages A and B Now these both share a form that has a name and description field (and a specific ajax submit button and action) so page 1 will have a line like: add(new BaseForm()); and then we will add other fields to that form and the same will be in page 2 but the question is, will this form have an associated html? are we going to have to write the html with the name and description wicket fields on each page that has that form, or is there a way to generalize it? or should i just use the method defined in the thread above? -- View this message in context: http://old.nabble.com/Forms-in-a-base-class-tp27981164p28153812.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Properties of model are set to NULL even though we have setRequired set to true
Hi David, thing is - we cannot reproduce it at all, so we cannot debug at all and hence we don't know where to start. I suppose we could put debugging traces in our code and the wicket code to help us understand but that doesn't feel right.. On Tue, Apr 6, 2010 at 3:58 PM, David Chang wrote: > Hello Wayne, > > I understand your frustration. Recently, I got a similar case but it > eventually turned out that it was my fault due to being new in Wicket. Long > story short, for a dropdownchoice list with loadabledetachablemodel, I set up > a load method, but in another place, I used dropdownchoice#setChoices to > update the list for ajax update. This method actually changes the model, but > i did not know about its impact. I spent almost a whole day to figure out why > the load method did not get called again. > > So in your case, there MUST be a reason. Look everywhere these fields get > changed. > > Good luck! > David > > > --- On Tue, 4/6/10, nino martinez wael wrote: > >> From: nino martinez wael >> Subject: Re: Properties of model are set to NULL even though we have >> setRequired set to true >> To: users@wicket.apache.org >> Date: Tuesday, April 6, 2010, 9:51 AM >> Hi Wayne >> >> I guess you've tried debugging it, so it's not a consistent >> error? Are >> you using any special web container or is wrapped somehow >> (like >> terracotta)? >> >> 2010/4/6 Wayne Pope : >> > Hi, >> > >> > has anyone got any idea about this? I'm still >> 'spinning my wheels' on it. >> > >> > thanks for any help. >> > >> > On Fri, Apr 2, 2010 at 5:00 PM, Wayne Pope >> > >> wrote: >> >> Hi, >> >> >> >> we've got several examples in our logs of >> properties of the model >> >> being set to null even though the textfield is set >> to required. >> >> I have NO idea how on earth this can happen - its >> just doesn't make >> >> sense - and its really frustrating me!! >> >> >> >> here's an example: >> >> >> >> Caused by: java.lang.NullPointerException >> >> at >> org.apache.commons.codec.digest.DigestUtils.md5(DigestUtils.java:86) >> >> at >> org.apache.commons.codec.digest.DigestUtils.md5Hex(DigestUtils.java:108) >> >> at >> hub.app.wicket.admin.ChangePasswordPage$1.onSubmit(ChangePasswordPage.java:49) >> >> at >> org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1518) >> >> ... >> >> >> >> >> >> Form form = >> new Form("form", new >> >> CompoundPropertyModel(new >> HibernateEntityModel(User.class, >> >> u.getId( { >> >> �...@override >> >> protected void >> onSubmit() { >> >> >> User u = getModelObject(); >> >> >> >> >> u.setPassword(DigestUtils.md5Hex(u.getPassword()); >> >> >> userDAO.save(u); >> >> >> >> >> setRedirect(true); >> >> >> setResponsePage(HubApplication.get().getHomePage()); >> >> } >> >> >> >> }; >> >> form.add(new >> Label("email")); >> >> PasswordTextField password >> = new PasswordTextField("password"); >> >> form.add(password); >> >> PasswordTextField >> repeatPassword = new PasswordTextField("repeatPassword"); >> >> >> repeatPassword.setModel(password.getModel()); >> >> form.add(repeatPassword); >> >> >> >> form.add(new >> EqualPasswordInputValidator(password, repeatPassword)); >> >> form.add(new >> SubmitLink("submitLink")); >> >> add(form); >> >> >> >> >> >> This is just one example - we see elsewhere in the >> logs sometimes a >> >> textfield that is setrequired(true) ends up >> nullpointering somewhere >> >> when saving the object. >> >> >> >> What could do this? >> >> >> > >> > >> - >> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> > For additional commands, e-mail: users-h...@wicket.apache.org >> > >> > >> >> - >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> > > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Properties of model are set to NULL even though we have setRequired set to true
Hi Nino, we cannot reproduce it locally at all. Only happens in production. we have a straight forward setup - apache balancing to 2 tomcat instances - no clustering. really annoying! On Tue, Apr 6, 2010 at 3:51 PM, nino martinez wael wrote: > Hi Wayne > > I guess you've tried debugging it, so it's not a consistent error? Are > you using any special web container or is wrapped somehow (like > terracotta)? > > 2010/4/6 Wayne Pope : >> Hi, >> >> has anyone got any idea about this? I'm still 'spinning my wheels' on it. >> >> thanks for any help. >> >> On Fri, Apr 2, 2010 at 5:00 PM, Wayne Pope >> wrote: >>> Hi, >>> >>> we've got several examples in our logs of properties of the model >>> being set to null even though the textfield is set to required. >>> I have NO idea how on earth this can happen - its just doesn't make >>> sense - and its really frustrating me!! >>> >>> here's an example: >>> >>> Caused by: java.lang.NullPointerException >>> at >>> org.apache.commons.codec.digest.DigestUtils.md5(DigestUtils.java:86) >>> at >>> org.apache.commons.codec.digest.DigestUtils.md5Hex(DigestUtils.java:108) >>> at >>> hub.app.wicket.admin.ChangePasswordPage$1.onSubmit(ChangePasswordPage.java:49) >>> at >>> org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1518) >>> ... >>> >>> >>> Form form = new Form("form", new >>> CompoundPropertyModel(new HibernateEntityModel(User.class, >>> u.getId( { >>> �...@override >>> protected void onSubmit() { >>> User u = getModelObject(); >>> >>> >>> u.setPassword(DigestUtils.md5Hex(u.getPassword()); >>> userDAO.save(u); >>> >>> setRedirect(true); >>> >>> setResponsePage(HubApplication.get().getHomePage()); >>> } >>> >>> }; >>> form.add(new Label("email")); >>> PasswordTextField password = new >>> PasswordTextField("password"); >>> form.add(password); >>> PasswordTextField repeatPassword = new >>> PasswordTextField("repeatPassword"); >>> repeatPassword.setModel(password.getModel()); >>> form.add(repeatPassword); >>> >>> form.add(new EqualPasswordInputValidator(password, >>> repeatPassword)); >>> form.add(new SubmitLink("submitLink")); >>> add(form); >>> >>> >>> This is just one example - we see elsewhere in the logs sometimes a >>> textfield that is setrequired(true) ends up nullpointering somewhere >>> when saving the object. >>> >>> What could do this? >>> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Properties of model are set to NULL even though we have setRequired set to true
Hello Wayne, I understand your frustration. Recently, I got a similar case but it eventually turned out that it was my fault due to being new in Wicket. Long story short, for a dropdownchoice list with loadabledetachablemodel, I set up a load method, but in another place, I used dropdownchoice#setChoices to update the list for ajax update. This method actually changes the model, but i did not know about its impact. I spent almost a whole day to figure out why the load method did not get called again. So in your case, there MUST be a reason. Look everywhere these fields get changed. Good luck! David --- On Tue, 4/6/10, nino martinez wael wrote: > From: nino martinez wael > Subject: Re: Properties of model are set to NULL even though we have > setRequired set to true > To: users@wicket.apache.org > Date: Tuesday, April 6, 2010, 9:51 AM > Hi Wayne > > I guess you've tried debugging it, so it's not a consistent > error? Are > you using any special web container or is wrapped somehow > (like > terracotta)? > > 2010/4/6 Wayne Pope : > > Hi, > > > > has anyone got any idea about this? I'm still > 'spinning my wheels' on it. > > > > thanks for any help. > > > > On Fri, Apr 2, 2010 at 5:00 PM, Wayne Pope > > > wrote: > >> Hi, > >> > >> we've got several examples in our logs of > properties of the model > >> being set to null even though the textfield is set > to required. > >> I have NO idea how on earth this can happen - its > just doesn't make > >> sense - and its really frustrating me!! > >> > >> here's an example: > >> > >> Caused by: java.lang.NullPointerException > >> at > org.apache.commons.codec.digest.DigestUtils.md5(DigestUtils.java:86) > >> at > org.apache.commons.codec.digest.DigestUtils.md5Hex(DigestUtils.java:108) > >> at > hub.app.wicket.admin.ChangePasswordPage$1.onSubmit(ChangePasswordPage.java:49) > >> at > org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1518) > >> ... > >> > >> > >> Form form = > new Form("form", new > >> CompoundPropertyModel(new > HibernateEntityModel(User.class, > >> u.getId( { > >> �...@override > >> protected void > onSubmit() { > >> > User u = getModelObject(); > >> > >> > u.setPassword(DigestUtils.md5Hex(u.getPassword()); > >> > userDAO.save(u); > >> > >> > setRedirect(true); > >> > setResponsePage(HubApplication.get().getHomePage()); > >> } > >> > >> }; > >> form.add(new > Label("email")); > >> PasswordTextField password > = new PasswordTextField("password"); > >> form.add(password); > >> PasswordTextField > repeatPassword = new PasswordTextField("repeatPassword"); > >> > repeatPassword.setModel(password.getModel()); > >> form.add(repeatPassword); > >> > >> form.add(new > EqualPasswordInputValidator(password, repeatPassword)); > >> form.add(new > SubmitLink("submitLink")); > >> add(form); > >> > >> > >> This is just one example - we see elsewhere in the > logs sometimes a > >> textfield that is setrequired(true) ends up > nullpointering somewhere > >> when saving the object. > >> > >> What could do this? > >> > > > > > - > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Properties of model are set to NULL even though we have setRequired set to true
Hi Wayne I guess you've tried debugging it, so it's not a consistent error? Are you using any special web container or is wrapped somehow (like terracotta)? 2010/4/6 Wayne Pope : > Hi, > > has anyone got any idea about this? I'm still 'spinning my wheels' on it. > > thanks for any help. > > On Fri, Apr 2, 2010 at 5:00 PM, Wayne Pope > wrote: >> Hi, >> >> we've got several examples in our logs of properties of the model >> being set to null even though the textfield is set to required. >> I have NO idea how on earth this can happen - its just doesn't make >> sense - and its really frustrating me!! >> >> here's an example: >> >> Caused by: java.lang.NullPointerException >> at >> org.apache.commons.codec.digest.DigestUtils.md5(DigestUtils.java:86) >> at >> org.apache.commons.codec.digest.DigestUtils.md5Hex(DigestUtils.java:108) >> at >> hub.app.wicket.admin.ChangePasswordPage$1.onSubmit(ChangePasswordPage.java:49) >> at >> org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1518) >> ... >> >> >> Form form = new Form("form", new >> CompoundPropertyModel(new HibernateEntityModel(User.class, >> u.getId( { >> �...@override >> protected void onSubmit() { >> User u = getModelObject(); >> >> >> u.setPassword(DigestUtils.md5Hex(u.getPassword()); >> userDAO.save(u); >> >> setRedirect(true); >> >> setResponsePage(HubApplication.get().getHomePage()); >> } >> >> }; >> form.add(new Label("email")); >> PasswordTextField password = new >> PasswordTextField("password"); >> form.add(password); >> PasswordTextField repeatPassword = new >> PasswordTextField("repeatPassword"); >> repeatPassword.setModel(password.getModel()); >> form.add(repeatPassword); >> >> form.add(new EqualPasswordInputValidator(password, >> repeatPassword)); >> form.add(new SubmitLink("submitLink")); >> add(form); >> >> >> This is just one example - we see elsewhere in the logs sometimes a >> textfield that is setrequired(true) ends up nullpointering somewhere >> when saving the object. >> >> What could do this? >> > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Build custom JavaScript
For my application I need to dynamically generate JavaScript, which can either be in its own file or even added to my HTML document. I'll handle the generation of the JavaScript, but does anyone have any good strategies for injecting it into a web page or even generating a JavaScript file with Wicket? Thanks Steve - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: root context, IE, home page is not found
Hi, I use Glassfish v 2.1.1 with wicket 1.4.6 and in this version is redirect to root changed form "./" to "." (BookmarkablePageRequestTarget.respond(RequestCycle requestCycle)). But I have still problem with this in IE(See attached picture). When I send redirect with location finishing with "." IE will generate new request with url also finishing with "." than IE receives redirect response (it is not generated from wicket) with location "./" and we are at the same point like in version wicket 1.4.3 where root context was represented by "./" Result is the same 404 Page not found. I used "/" for context root and it works fine in all browser. Why we are using "." in wicket 1.4.6 or "./" in 1.4.3? Thanks Dave. http://old.nabble.com/file/p28151694/ContextRootRedirect.png http://old.nabble.com/file/p28151694/ContextRootRedirect.png ContextRootRedirect.png vadikt wrote: > > > looks like BookmarkablePageRequestTarget.respond(RequestCycle > requestCycle) has code to strip "./" if url starts with it. > > can it be changed to strip "." as well? will it be the right fix? > >> From: vad...@hotmail.com >> To: users@wicket.apache.org >> Subject: root context, IE, home page is not found >> Date: Mon, 18 Jan 2010 20:36:55 + >> >> >> all, >> >> >> >> my wicket 1.4.5 application is configured to run in root context. for >> some reason, when it sets response page to the home page (which is not >> mounted), the webserver produces error: The requested resource () is not >> available. >> >> >> >> here's the code: >> >> formFooter.add(new Link(ID_LINK_HOME) >> { >> private static final long serialVersionUID = 1L; >> @Override >> public void onClick() >> { >> setResponsePage(getApplication().getHomePage()); >> } >> }); >> >> >> >> >> it happens only with IE (6, 7), only with root context, with Tomcat 6 and >> Sun's Glassfish servers. looks like URL generated in that case has '.' >> appended to it: "http://localhost/.";. >> >> if i simply hit F5 in the browser after the error shows up, it opens home >> page just fine. >> >> if i use bookmarkable link, it works fine: formFooter.add(new >> BookmarkablePageLink(ID_LINK_HOME, >> getApplication().getHomePage()).setAutoEnable(true)); >> >> >> >> the issue looks very similar to >> http://issues.apache.org/jira/browse/WICKET-1449 >> >> >> >> is there a workaround? >> >> >> >> Thanks, >> >> Vadim >> >> _ >> Hotmail: Trusted email with powerful SPAM protection. >> http://clk.atdmt.com/GBL/go/196390707/direct/01/ > > _ > Hotmail: Trusted email with powerful SPAM protection. > http://clk.atdmt.com/GBL/go/196390707/direct/01/ > -- View this message in context: http://old.nabble.com/root-context%2C-IE%2C-home-page-is-not-found-tp27216383p28151694.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: What happens after browser's 'back' button?
On Tue, Apr 6, 2010 at 8:07 AM, McIlwee, Craig wrote: > As long as you prevent the browser from caching the page with the form (just > the page itself, caching the resources is fine) then when the user hits back > wicket will pull the old page instance from the pagemap and rerender it. > That page instance is the same one that was used the first time, so its state > will still be the same. Just set some flag when the user submits, and also > check that flag when processing the form like this: > Not exactly. How would Wicket know to pull the "old" page instance if the browser is re-requesting a bookmarkable URL? It wouldn't. It would just reconstruct the page from scratch. In fact, Firefox doesn't re-request anything from Wicket when you click the back button (at least it doesn't in my app when IE does, go figure). The way Wicket keeps everything in synch is that each URL in your rendered page (for forms, links, etc.) has information on it that "points" to a specific page in the page map (that's what all the ?wicket:interface stuff is). So, when a form is submitted or a link (non-bookmarkable) is clicked on your page, Wicket will load the specific page instance from the page map and invoke the request on that. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: What happens after browser's 'back' but ton?
As long as you prevent the browser from caching the page with the form (just the page itself, caching the resources is fine) then when the user hits back wicket will pull the old page instance from the pagemap and rerender it. That page instance is the same one that was used the first time, so its state will still be the same. Just set some flag when the user submits, and also check that flag when processing the form like this: onSubmit(...) { if (!submitted) { submitted = true; // do some stuff } else { // redirect to another page } } Wicket does set some cache headers, but to disable it in FF we had to set 1 extra header. If you check the setHeaders method in WebPage you'll see that they set 3 headers I think and then there is one other header (must revalidate?) that they have commented out. That commented header did the trick for us. As for the redirect, you might be able to pull the 'last valid page' as you call it from the page map, not sure though. Craig - Original Message - From: Sergey Olefir [mailto:solf.li...@gmail.com] To: users@wicket.apache.org Sent: Tue, 06 Apr 2010 06:32:35 -0400 Subject: What happens after browser's 'back' button? > Hi, > > our first Wicket-based application is about to go into testing and I'm > feeling rather uncomfortable about the fact that I don't really > understand what happens when user uses browser's back button and then > submits some 'outdated' form. Can someone elaborate please on what > exactly happens when Wicket receives submit from the 'old' page? > > On a more specific note, I will most probably need to block user from > submitting the same form more than once. E.g.: > > - If I wanted to prevent user from using back button at all, how would > I determine that the incoming submit is from the 'old' page? > > - If I determined that Wicket received submit from the 'old' page, how > would I send user back to the last 'valid' page they were on? > > - If I wanted to detect that user submits the same form twice (without > necessarily blocking the back button in all cases), how would I go > about it? I suppose I could store something in Session to track which > forms were already submitted? > > P.S. Sorry for kind of 'reposting' my previous question, but I'm > running out of time on this project and really would love to > understand how to properly handle browser's 'back' button... > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Wicket GAE performance
Hi Tony, I presume that you have studied the GAE/J documentation about datastore transactions at "http://code.google.com/intl/en/appengine/docs/java/datastore/transactions.html";. In particular, I note: "JDO performs all actions between the call to tx.begin() and the call to tx.commit() in a single transaction. If any action fails due to the requested entity group being in use by another process, JDO throws a JDODataStoreException or a JDOException, cause by a java.util.ConcurrentModificationException." In essence, let the JDO transaction do all the work for you! This should help you in the case where a maximum of one thread (= request) only is allowed to update persistent data at any time. All you will need to do then (apart from thinking though your design) is to handle the exceptions mentioned properly. Cheers, Ian Anton Veretennikov wrote: > > Thank you very much, Ian, you clarified some things to me. > > I'm trying to block some entity got for processing by one session from > other > possibly concurrent session. > I know what i would do if it were RDBMS: lock my object with "FOR UPDATE", > if success, i would check if status field is still what i assume it must > be > and then update it to new status. > > But i'm not sure yet how to do this in GAE. > > -- Tony > -- View this message in context: http://old.nabble.com/Wicket-GAE-performance-tp28118591p28149943.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
What happens after browser's 'back' button?
Hi, our first Wicket-based application is about to go into testing and I'm feeling rather uncomfortable about the fact that I don't really understand what happens when user uses browser's back button and then submits some 'outdated' form. Can someone elaborate please on what exactly happens when Wicket receives submit from the 'old' page? On a more specific note, I will most probably need to block user from submitting the same form more than once. E.g.: - If I wanted to prevent user from using back button at all, how would I determine that the incoming submit is from the 'old' page? - If I determined that Wicket received submit from the 'old' page, how would I send user back to the last 'valid' page they were on? - If I wanted to detect that user submits the same form twice (without necessarily blocking the back button in all cases), how would I go about it? I suppose I could store something in Session to track which forms were already submitted? P.S. Sorry for kind of 'reposting' my previous question, but I'm running out of time on this project and really would love to understand how to properly handle browser's 'back' button... - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket GAE performance
Thank you very much, Ian, you clarified some things to me. I'm trying to block some entity got for processing by one session from other possibly concurrent session. I know what i would do if it were RDBMS: lock my object with "FOR UPDATE", if success, i would check if status field is still what i assume it must be and then update it to new status. But i'm not sure yet how to do this in GAE. -- Tony On Tue, Apr 6, 2010 at 12:06 AM, Ian Marshall wrote: > > Hello Tony, > > > > Anton Veretennikov wrote: > > > > This is a transaction of every session? > > > > I believe that there is some pooling of at least one of > PersistenceManager[s] (PM[s]) and Transaction[s] (TX[s]). Nevertheless, the > code extract I provided will yield a PM and TX unique to the thread (and > therefore the request too in GAE/J) running that code. Your PM and TX will > not leak to another request. I believe that the PersistenceManagerFactory > (PMF) ensures this (if I am wrong, will someone please correct me). > > > > Anton Veretennikov wrote: > > > > If no, how may i handle this situation: > > > > When one user is accessing a page i must return data from one entity from > > the datastore, then close it from returning to any other users. What can > > be > > done here? > > > Do you ask here "How do I ensure that a user cannot see data 'belonging' to > another user"? > > Of course, your code will controls what data you exchange with the GAE > datastore, so if it already ensures that some persistent entities are to be > accessed by a specific user only, then this should continue. A different > user calling your persistence code will have a different PM and TX; your > user-specific data exchange should continue to be user-specific. > > Just ensure that the PMF is global to your Wicket application instance (a > singleton only is required), and that your data exchange code gets, uses > and > closes PMs (using this PMF instance) as and when needed. As for > transactions, the combination of what data exchange you perform, your JDO > settings, and the GAE/J and DataNucleus documentation will determine > whether > you need to use a transaction. > > If I have not addressed your question Tony, would you please be so kind as > to re-phrase it? > > Regards, > > Ian > -- > View this message in context: > http://old.nabble.com/Wicket-GAE-performance-tp28118591p28141583.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: Properties of model are set to NULL even though we have setRequired set to true
Hi, has anyone got any idea about this? I'm still 'spinning my wheels' on it. thanks for any help. On Fri, Apr 2, 2010 at 5:00 PM, Wayne Pope wrote: > Hi, > > we've got several examples in our logs of properties of the model > being set to null even though the textfield is set to required. > I have NO idea how on earth this can happen - its just doesn't make > sense - and its really frustrating me!! > > here's an example: > > Caused by: java.lang.NullPointerException > at org.apache.commons.codec.digest.DigestUtils.md5(DigestUtils.java:86) > at > org.apache.commons.codec.digest.DigestUtils.md5Hex(DigestUtils.java:108) > at > hub.app.wicket.admin.ChangePasswordPage$1.onSubmit(ChangePasswordPage.java:49) > at > org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1518) > ... > > > Form form = new Form("form", new > CompoundPropertyModel(new HibernateEntityModel(User.class, > u.getId( { > �...@override > protected void onSubmit() { > User u = getModelObject(); > > > u.setPassword(DigestUtils.md5Hex(u.getPassword()); > userDAO.save(u); > > setRedirect(true); > > setResponsePage(HubApplication.get().getHomePage()); > } > > }; > form.add(new Label("email")); > PasswordTextField password = new PasswordTextField("password"); > form.add(password); > PasswordTextField repeatPassword = new > PasswordTextField("repeatPassword"); > repeatPassword.setModel(password.getModel()); > form.add(repeatPassword); > > form.add(new EqualPasswordInputValidator(password, > repeatPassword)); > form.add(new SubmitLink("submitLink")); > add(form); > > > This is just one example - we see elsewhere in the logs sometimes a > textfield that is setrequired(true) ends up nullpointering somewhere > when saving the object. > > What could do this? > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
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: Displaying HTML
Thanks. It worked. Regards. On Tue, Apr 6, 2010 at 11:43 AM, Wilhelmsen Tor Iver wrote: > > > I > > want to display the same on for example a label, is there any component > > that > > displays the text as HTML , i mean i dont want to see the tags, i want > > to > > see some formatted text. > > Use a Label, but call setEscapeModelStrings(false) on it. > > -- > - Tor Iver > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
SV: Displaying HTML
> I > want to display the same on for example a label, is there any component > that > displays the text as HTML , i mean i dont want to see the tags, i want > to > see some formatted text. Use a Label, but call setEscapeModelStrings(false) on it. -- - Tor Iver - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Displaying HTML
Hi guys; I am using TinyMCE to created styled text and save it in the database. I want to display the same on for example a label, is there any component that displays the text as HTML , i mean i dont want to see the tags, i want to see some formatted text. Kind regards. Josh
DataView, ReuseIfModelsEqualStrategy, Ajax
Hello, I have a simple DataView where each row has some labels and textfields. Each time the user enter in a textfield I would like to highlight the selected row. (The idea is to adapt the wicket stuff example (OIRPage.java) with an AjaxFormComponentUpdatingBehavior("onfocus") instead of a simple Link) The example in wicket stuff ( http://wicketstuff.org/wicket/repeater/?wicket:bookmarkablePage=:org.apache.wicket.examples.repeater.OIRPage ) shows how to highlight the selected row using ReuseIfModelsEqualStrategy when the user click on a Link. Using the AjaxFormComponentUpdatingBehavior with the "onfocus" event I try to simulate the Link click but it does not work... myTextField.add(new AjaxFormComponentUpdatingBehavior("onfocus") { @Override protected void onUpdate(AjaxRequestTarget target) { HighlitableDataItem hitem = (HighlitableDataItem) item; hitem.toggleHighlite(); // target.addComponent( ??? don' know what to put here, how to re-render the item) } }); Well, any idea thanks Arnaud