Re: setOutputMarkupPlaceholderTag not working to render panel with setvisible false...
You make you panel invisible (first time when you create it), but where are you make it visible? The idea is to override public boolean isVisible() { return !commentDomainList().isEmpty(); } in your panel. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/setOutputMarkupPlaceholderTag-not-working-to-render-panel-with-setvisible-false-tp4650313p4650318.html Sent from the Users forum 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: setOutputMarkupPlaceholderTag not working to render panel with setvisible false...
Thanks a lot...that worked...:) -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/setOutputMarkupPlaceholderTag-not-working-to-render-panel-with-setvisible-false-tp4650313p4650319.html Sent from the Users forum 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
off-topic: developer for hire
Sorry for the quick note that is unrelated to Wicket development. I am looking for work involving either Java or Oracle development. Wicket would of course be preferable as a web ui. :) Contact me directly if you are interested instead of posting to the list please. Cheers, Scott - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: setResponsePage swallows my session feedback messages
Hi Martin, Thanks for your answer and code. Indeed, in my case, option 2 is most desirable because the session message is set in a completely different place than where the redirect is done. NonResettingRestartException works great when thrown from a page constructor. However, when thrown from a link or form handler, a list concurrent modification exception occurs. This email is rather long so I divided it in 2 parts. Part 1 - NonResettingRestartException problem = The list is the actions list of the BufferedWebResponse with the following stack trace: BufferedWebResponse.addCookie(Cookie) line: 421 HeaderBufferingWebResponse.addCookie(Cookie) line: 72 BufferedWebResponse$AddCookieAction.invoke(WebResponse) line: 240 BufferedWebResponse.writeMetaData(WebResponse) line: 75 HeaderBufferingWebResponse.writeMetaData(WebResponse) line: 205 NonResettingRestartException.init(ClassPage, PageParameters, RequestCycle) line: 28 LinkPage$4.onClick() line: 38 Analysis: 1) HeaderBufferingWebResponse delegates #writeMetaData() to its bufferedResponse (a BufferedWebResponse instance). 2) BufferedWebResponse iterates its action list with the single AddCookieAction and invoke()s it 3) BufferedWebResponse$AddCookieAction.invoke does response.addCookie(cookie) 4) The addCookie is executed with this==BufferedWebResponse from 2) which modifies the action list illegally I created a set of test pages to test the different ways to redirect to a page from a page constructor, a link handler and a form submit handler. They all set a cookie and a session message to validate the behaviors. I will gladly share this if desired. In conclusion, with Wicket 1.5.7, NonResettingRestartException works in a page constructor, but setResponsePage must be used in a link or form handler. So there is a workable alternative, but the difference in behavior depending on where the exception is thrown is not so good. And maybe other code paths are at risk of triggering this exception. Part 2 - Cookie problem with Jetty == A heads up for anybody using redirects, cookies and Jetty 7.5.0, 7.5.4, 7.6.4 or 8.1.4 (so I guess all versions essentially). Normally, throwing a RestartResponseException throws away anything added to the response before that point. This is not always the case for cookies when using Jetty! If a cookie is set before the exception is thrown AND it already exists on the client (with any value), Jetty will erroneously think the new value is set on the client. Here is what happens: when a cookie already exists, CookieUtils#save() updates its value instead of creating a new one. However, Jetty's CookieCutter class caches the client's parsed cookies across requests (server-side) so the cached copy is updated with the new value. Afterwards, Jetty does not check properly whether the cookies sent by the client match the cached values so the cookie is considered modified with the new phantom value until a new session is created. This bug had me scratching my head for a while when testing the different ways to redirect clients! This does not happen with Tomcat 7.0.27 This definitely seems like a bug in Jetty but I don't have time to file it and follow up since I'm only using Jetty for quickstarts. I can give more info on request. On 01/07/2012 10:36 AM, Martin Grigorov wrote: Hi, Here is my later response. I see two ways to solve this: 1) Use setResponsePage(pageInstance) as I described in my previous response: setMyCookie(); PageB pageB = new PageB(); pageB.info(some text); setResponsePage(pageB); This way the feedback is associated with a component (pageB) and wont be rendered when PageA is rendered. The drawback is that this way you will get a url like 'wicket/page?42' instead of the nice looking one (e.g. /customers/12) 2) the second way is to use non-resetting RestartResponsePage I've rolled this out several months ago for our app: public class NonResettingRestartException extends ReplaceHandlerException { public NonResettingRestartException(final Class? extends Page? pageClass, final PageParameters params, final RequestCycle cycle) { super(createRequestHandler(pageClass, params), true); Response response = cycle.getResponse(); if (response instanceof IMetaDataBufferingWebResponse) { IMetaDataBufferingWebResponse bufferingWebResponse = (IMetaDataBufferingWebResponse) response; bufferingWebResponse.writeMetaData((WebResponse) cycle.getOriginalResponse()); } } private static IRequestHandler createRequestHandler(Class? extends Page? pageClass, PageParameters params) { return new RenderPageRequestHandler(new PageProvider(pageClass, params)); } } and use it: setMyCookie(); throw new NonResettingRestartException(PageB.class, params); I guess you will prefer option 2) I'll also file a ticket as you suggested regarding
Re: Why my model doesn't refresh
On Mon, Jul 2, 2012 at 11:19 PM, very.sad.developer very.sad.develo...@gmail.com wrote: Hello everyone, I don't know why my model doesn't refresh in this example: (maven project created from wicket quickstart:http://dl.dropbox.com/u/1280777/myproject.zip) wicket version: *6.0.0-beta2* *LoginPage.java* import org.apache.wicket.Component; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.markup.html.form.Button; import org.apache.wicket.markup.html.form.StatelessForm; import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.markup.html.panel.FeedbackPanel; import org.apache.wicket.model.PropertyModel; public class LoginPage extends WebPage{ private UserLoginRequest userLoginRequest = new UserLoginRequest(); public LoginPage() { add(createLoginForm()); add(createFeebackPanel()); } private Component createFeebackPanel() { return new FeedbackPanel(feedbackPanel); } private Component createLoginForm() { final TextFieldString login = new TextFieldString(login, PropertyModel.Stringof(this, userLoginRequest.username)); login.setRequired(true); final TextFieldString password = new TextFieldString(password, PropertyModel.Stringof(this, userLoginRequest.username)); I guess you need the password field, not the username ^^^ password.setRequired(true); StatelessFormVoid statelessForm = new StatelessFormVoid(loginForm){ @Override protected void onSubmit() { String user = userLoginRequest.getUsername(); String password = userLoginRequest.getPassword(); if ((null == user) || (password == null)) { throw new RuntimeException(Why models didn't refresh when put correct values into inputs); } } }; statelessForm.add(login); statelessForm.add(password); statelessForm.add(new Button(submitForm)); return statelessForm; } } class UserLoginRequest implements java.io.Serializable{ private String username; private String password; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public void cleanPassword(){ password = null; } } *html:* !DOCTYPE html html xmlns:wicket=http://wicket.apache.org; head meta charset=utf-8 / titleApache Wicket Quickstart/title link href='http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:regular,bold' rel='stylesheet' type='text/css' / link rel=stylesheet href=style.css type=text/css media=screen title=Stylesheet / /head body form wicket:id=loginForm Logininput type=text value= wicket:id=login / br / Passwordinput type=text value= wicket:id=password / br / br / input type=submit value=Log in wicket:id=submitForm / /form br / /body /html -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Why-my-model-doesn-t-refresh-tp4650321.html Sent from the Users forum 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 -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Model is not created
Hello, I have a problem with the creation of a model in one of my pages. It works as follows: I have a link that uses setResponsePage(new MyPage(parameters)) on the click with parameters as PageParameters. At the MyPage site, the constructor creates a: IModelMyModel model = new IModelMyModel() { public void setObject .. public MyModel getObject.. } This variable is used to create a CompoundPropertyModel for a Form. The first time when I click on my link to the MyPage site, everything is fine. At the second time, the MyModel variable is not empty. The variable is filled with the selected values from the first time when I clicked on the link to the MyPage site. I do not understand this behavior. Normally, the MyModel variable should be empty and not filled with the last selection. Has someone an idea? Thanks, Andre -- Andre Schütz wic...@faustas.de - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Why my model doesn't refresh
Thank you for fast answer, Yes, there should be used PasswordTextField, but for showing problem I simplify the boring part :).After done this quickstart (this is part of bigger application) my models suddently start to refresh. I check my configuration and now I suspect JRebel for my last problems. Are you using JRebel with wicket? Do you faced any problems when you use this tool with wicket? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Why-my-model-doesn-t-refresh-tp4650321p4650325.html Sent from the Users forum 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: Model is not created
On Mon, Jul 2, 2012 at 4:45 PM, Andre Schütz wic...@faustas.de wrote: Hello, I have a problem with the creation of a model in one of my pages. It works as follows: I have a link that uses setResponsePage(new MyPage(parameters)) on the click with parameters as PageParameters. At the MyPage site, the constructor creates a: IModelMyModel model = new IModelMyModel() { public void setObject .. public MyModel getObject.. } This variable is used to create a CompoundPropertyModel for a Form. The first time when I click on my link to the MyPage site, everything is fine. At the second time, the MyModel variable is not empty. The variable is filled with the selected values from the first time when I clicked on the link to the MyPage site. I do not understand this behavior. Normally, the MyModel variable should be empty and not filled with the last selection. Has someone an idea? Thanks, Andre -- Andre Schütz wic...@faustas.de - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org You'd need to show more code for us to be more helpful. I'm suspecting that you are clicking a stateful link on that page, which means of course that your constructor will not be called again. -- Jeremy Thomerson http://wickettraining.com *Need a CMS for Wicket? Use Brix! http://brixcms.org*
Re: Model is not created
On Mon, Jul 2, 2012 at 11:45 PM, Andre Schütz wic...@faustas.de wrote: Hello, I have a problem with the creation of a model in one of my pages. It works as follows: I have a link that uses setResponsePage(new MyPage(parameters)) on the click I'd recommend to use setResponsePage(MyPage.class, parameters) instead in this case. This way you will have a nice looking url and the page may stay stateless if there are no stateful components/behaviors in it. If you know the parameters earlier then you can even use BookmarkablePageLink(id, MyPage.class, parameters) - this will save you a http redirect. with parameters as PageParameters. At the MyPage site, the constructor creates a: IModelMyModel model = new IModelMyModel() { public void setObject .. public MyModel getObject.. } This variable is used to create a CompoundPropertyModel for a Form. The first time when I click on my link to the MyPage site, everything is fine. At the second time, the MyModel variable is not empty. The variable is filled with the selected values from the first time when I clicked on the link to the MyPage site. I do not understand this behavior. Normally, the MyModel variable should be empty and not filled with the last selection. Has someone an idea? Thanks, Andre -- Andre Schütz wic...@faustas.de - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org