Exception when detaching/serializing a page
We have been successfully running a Wicket-driven Web application for about 6 month now. Since a few days the application keeps giving me errors of the following kind: May 01 09:04:56 <https://papertrailapp.com/searches/22745?time=1335888296> domU-12-31-39-0A-59-A1 ERROR: [Live]: org.apache.wicket.Session.requestDetached.1454: Exception when detaching/serializing page May 01 09:05:14 <https://papertrailapp.com/searches/22745?time=1335888314> domU-12-31-39-0A-59-A1 ERROR: [Live]: org.apache.wicket.Session.requestDetached.1454: Exception when detaching/serializing page May 01 09:05:15 <https://papertrailapp.com/searches/22745?time=1335888315> domU-12-31-39-0A-59-A1 ERROR: [Live]: org.apache.wicket.Session.requestDetached.1454: Exception when detaching/serializing page May 01 09:10:15 <https://papertrailapp.com/searches/22745?time=1335888615> domU-12-31-39-0A-59-A1 ERROR: [Live]: org.apache.wicket.Session.requestDetached.1454: Exception when detaching/serializing page The website itself is still being shown, however, modal windows for example do not work any more. I have been googling around for that error for quite a while, but did not find any helpful result. Anybody else already experienced some error like that and can point me into a direction where I can further investigate the issue? Philipp
Why everything is stored in Session?
Hi, I'm PHP-Programmer and now switching to java (and wicket ;) ). But one thing confuses me: Why everything is stored in Session? In PHP the session is empty except you put something in. And there's no "Back-button-problem" in PHP, when you go back then the site with the previous URL will be loaded. So why you need to store so much in the session? Philipp Oppermann - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Bug in wicket tiny mce 1.4.18
Dear Folks, I think I found a bug in the Wicket Tiny MCE implementation version 1.4.18. In class TinyMCESettings.java there's the following method: public static void lazyLoadTinyMCEResource(IHeaderResponse response) { String url = RequestCycle.get().urlFor(TinyMCESettings.javaScriptReference()).toString(); String base = url.substring(0, url.lastIndexOf(File.separatorChar)); response.renderJavascript("window.tinyMCEPreInit = {base : '" + base + "', suffix : '', query : ''};", "tinyMceHackPreload"); response.renderJavascriptReference(TinyMCESettings.javaScriptReference()); response.renderJavascript("window.tinymce.dom.Event.domLoaded = true;", "tinyMceHackPostload"); } The first line returns a URL. In the second line an attempt is made to extract a substring using the index of File.separatorChar. However, File.separatorChar on a Windows systems is "\\". This is a character never found in a URL (there are usually only "/" characters). Thus, always -1 is returned and the substring operation fails with an index ouf of bounds: java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(String.java:1937) ~[na:1.6.0_27] at wicket.contrib.tinymce.settings.TinyMCESettings.lazyLoadTinyMCEResource(TinyMCESettings.java:971) ~[tinymce-1.4.18.jar:1.4.18 null -mike] at wicket.contrib.tinymce.TinyMceBehavior.renderHead(TinyMceBehavior.java:60) ~[tinymce-1.4.18.jar:1.4.18 null -mike] at org.apache.wicket.Component.renderHead(Component.java:2806) ~[wicket-1.4.18.jar:1.4.18] Shall I file a bug report on this? Philipp - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: DropdownChoice with ChoiceRenderer does not use idValue for setting Model
Ok. Now im holding a map, using its keys as choices and a choicerenderer gives the values for rendering.. its working... nice Thanks! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DropdownChoice-with-ChoiceRenderer-does-not-use-idValue-for-setting-Model-tp4115836p4116029.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: add resources to javascript
So.. ok nevermind... just mounted the resources as PackageResourceReference and used it in JS -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/add-resources-to-javascript-tp4101004p4103562.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
GMap2 in a Wiquery Dialog
I am trying to open a Google Map using GMap2 in a WiQuery Dialog modal window. The goal is to use the modal window in order to show a large map (800 x 500 px). However, when I open the modal window only the small part of the map is shown, whereas the rest is only a grey area. If I open the exact same map in a regular panel, and not in a Wiquery Dialog the map is correctly shown. The following screenshot further illustrates this issue: https://picasaweb.google.com/lh/photo/9iXCzDiZ9R9zGhN56N-mDy7NU3UNAKRLuGErIKOgVvA?feat=directlink Here is the modal window implementation: import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.markup.html.AjaxLink; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.model.ResourceModel; import org.odlabs.wiquery.ui.dialog.Dialog; import at.schuzalipo.w7.data.persistence.model.Address; import at.schuzalipo.w7.web.W7BasePanel; import at.schuzalipo.w7.web.common.GoogleMapsPanel; public class ShowLargeMapPanel extends W7BasePanel { // Modal window private Dialog modalWindow; public ShowLargeMapPanel(String id, Address address) { super(id); //Add the link for opening the modal window AjaxLink openLink = new AjaxLink("openLargeLink") { @Override public void onClick(AjaxRequestTarget target) { modalWindow.open(target); } }; add(openLink); // Add the modal window modalWindow = new Dialog("modal"); modalWindow.setWidth(860); modalWindow.setHeight(630); modalWindow.setTitle(new ResourceModel("winery.contactdetails.change").getObject()); modalWindow.setModal(true); add(modalWindow); //Add the large google panel to the modal window WebMarkupContainer mapContainer = new WebMarkupContainer("mapContainer"); mapContainer.add(new GoogleMapsPanel("largeGoogleMap",address, 800, 500)); modalWindow.add(mapContainer); } } And the HTML of the modal window: key="map.openLarge" /> As you can see, I add the GoogleMapsPanel in the last few lines. Here is the code for the GoogleMapsPanel itself: import java.io.IOException; import java.util.Locale; import org.apache.wicket.behavior.SimpleAttributeModifier; import org.apache.wicket.markup.html.panel.Panel; import wicket.contrib.gmap.GMap2; import wicket.contrib.gmap.api.GControl; import wicket.contrib.gmap.api.GLatLng; import wicket.contrib.gmap.api.GMarker; import at.schuzalipo.w7.component.countryselector.Country; import at.schuzalipo.w7.component.countryselector.CountryList; import at.schuzalipo.w7.data.persistence.model.Address; import at.schuzalipo.w7.util.Constants; import at.schuzalipo.w7.util.ServerGeocoder; /** * GoogleMapsPanel class. * * @author marco * @version $Id: $ */ public class GoogleMapsPanel extends Panel { private static final long serialVersionUID = 1L; private static final ServerGeocoder geocoder = new ServerGeocoder( Constants.GMAP_API_KEY); private GMap2 googleMap; /** * Constructor for GoogleMapsPanel. * * @param id a {@link java.lang.String} object. * @param address a {@link at.schuzalipo.w7.data.persistence.model.Address} object. */ public GoogleMapsPanel(String id, Address address, int width, int height) { super(id); this.setOutputMarkupId(true); // specify the google map googleMap = new GMap2("googleMap", Constants.GMAP_API_KEY); //Set the size of the map googleMap.add(new SimpleAttributeModifier("style", "width: "+width+"px; height: "+height+"px;")); googleMap.setDoubleClickZoomEnabled(false); googleMap.setZoom(10); googleMap.addControl(GControl.GLargeMapControl); googleMap.addControl(GControl.GMapTypeControl); googleMap.addControl(GControl.GScaleControl); GLatLng latLng = null; String location; if (address != null) { //Get the Englisch name of the country CountryList countrylist = new CountryList(Locale.ENGLISH); Country c = countrylist.getCountryFromCode(address.getCountry()); location = address.getStreet() + ", " + address.getZip() + ", " + address.getCity() + ", " + c.getName(); } else { location = "USA"; } //Try to get the location - as backup we take USA try { latLng = geocoder.findAddress(location); } catch (IOException e) { try { latLng = geocoder.findAddress("USA"); googleMap.setZoom(6); } catch (IOException ex) { } } googleMap.setCenter(latLng); googleMap.addOverlay(new GMarker(latLng)); googleMap.setScrollWheelZoomEnabled(true); googleMap.setVisible(true); google
Re: facebook like iframe in wicket
As far as I can guess your iframe has nothing to do with the velocity issue. The velocity error occurs, if the global library cannot be found. Nevertheless, that error is not crucial and should rather considered as a warning. See https://issues.apache.org/jira/browse/VELOCITY-86 for more information. I tried something like that but faced "Error using VM library : VM_global_library.vm" and got stuck. I am new to velocity but I feel it can provide the answer to my problem. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/facebook-like-iframe-in-wicket-tp3540423p3544934.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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
How to access SwitchProtocolRequestTarget
I am currently working on an integration of SSL into our wicket application. If pages are accessed, which are annotated with @RequireHttps wicket correctly switches to SSL. This is achieved by adding: /** * Returns a HTTPS request cycle processor, if necessary */ @Override protected IRequestCycleProcessor newRequestCycleProcessor() { return new HttpsRequestCycleProcessor(getHttpsConfig()) { @Override protected IRequestTarget checkSecureIncoming(IRequestTarget target) { return super.checkSecureIncoming(target); } @Override protected IRequestTarget checkSecureOutgoing(IRequestTarget target) { return super.checkSecureOutgoing(target); } }; } to the application class (as also indicated by the wicket wiki). Ok - everything fine so far. Now the next requirement is to always stay in SSL mode, if the user is logged in. I thought about extending the methods above and add logic such as @Override protected IRequestTarget checkSecureIncoming(IRequestTarget target) { if (userisLoggedIn) { return SwitchProtocolRequestTarget.requireProtocol(Protocol.HTTPS); } return super.checkSecureIncoming(target); } However, I cannot access the SwitchProtocolRequestTarget class, because it is not defined as public. What would you suggest in this case? Make a local copy of the class (which would work). However, that does not seem to be nice Java coding to me. I was wondering what the other members of the mailing list think about it. Kind regards Philipp - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: CheckboxMultipleChoice in Ajax style
Mathias, I changed a bit of code and now it works without problems. I even can't reproduce what was the problem. Thank's a lot for your help Philipp When I try this code it works. Can you please post some code for us -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: CheckboxMultipleChoice in Ajax style
Hi Mathias, hi all, thanks for your help, I didn't know the AjaxFormChoiceComponentUpdatingBehavior so far. I now have the problem, that it jumps into the onUpdate method just once (when I click on a checkbox for the first time). If I click again on the same or any other checkbox, nothing happens. Does anyone have an explanation for that? Thank you Philipp This may confuse the web user quite a bit. It's preferred to send the request each time or cache it maybe. Form form = new Form( "form" ); List SITES = Arrays.asList(new String[] { "The Server Side", "Java Lobby", "Java.Net" }); final List values = new LinkedList(); final CheckBoxMultipleChoice c = new CheckBoxMultipleChoice("site", new Model(), SITES ); c.add( new AjaxFormChoiceComponentUpdatingBehavior(){ @Override protected void onUpdate(AjaxRequestTarget target) { System.out.println( c.getModelObject() ); } }); form.add( c ); add( form ); In this onUpdate you could send to server, cache or whatever. -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
CheckboxMultipleChoice in Ajax style
Hi all, I wonder how I can create a CheckboxMultipleChoice that performs an action "onUpdate". Ideally, the action is delayed by one second, so that a user has the chance to change more than one checkbox before the change is sent to the server (without a submit button). As I'm quite new to wicket, any code fragment would be greatly appreciated. All the best Philipp -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Servlet container authentication in Wicket
Hi, I had a look at that specification but it doesn't give any more hints how to use it. Does somebody have any more working examples? Or is there a tutorial how to connect wicket to the local LDAP? Thanks for your help. Philipp j_security_check is part of the Servlet Specification section "SRV.12.5.3.1 Login Form Notes" (at least for version 2.5). It did exist in earlier versions but I've only quoted the latest. On Sun, Feb 1, 2009 at 5:03 PM, Philipp Daumke wrote: Hi all, I followed the Servlet Container authentication as described in http://cwiki.apache.org/WICKET/servlet-container-authentication.html, but I do not get it working. At the moment I get an error in firefox when invoking the redirectToSecurityCheck() method: http://localhost:5080/j_security_check?j_username=test&j_password=test _The requested resource () is not available. _I don't even know exactly what "j_security_check" is and don't find too much on the web. Do I have to configure Tomcat properly? Below is my full src. MyApp.java and web.xml look like in the example (see link aboe). Thank you for your help! Philipp public final class LoginPage extends WebPage { private String username; private String password; public LoginPage() { redirectToSecurityCheck(); /*if( ( ( MySession )getSession() ).isUserLoggedIn()) { // redirect to hide username and password from URL after user is logged in setRedirect( true ); setResponsePage( Index.class ); } else { redirectToSecurityCheck(); }*/ } /** * Common servlet login workaround */ private void redirectToSecurityCheck() { final Map parametersMap = ( ( WebRequestCycle )RequestCycle.get() ).getWebRequest().getHttpServletRequest().getParameterMap(); if( parametersMap.containsKey( "username" ) && parametersMap.containsKey( "password" ) ) { // getting parameters from POST request final String userName = ( ( String[] )parametersMap.get( "username" ) )[ 0 ]; final String userPassword = ( ( String[] )parametersMap.get( "password" ) )[ 0 ]; // if POST parameters are ok, redirect them to j_security_check if( ( userName != null ) && ( userPassword != null ) ) { getRequestCycle().setRedirect( false ); getRequestCycle().setRequestTarget( EmptyRequestTarget.getInstance() ); getResponse().redirect( "/j_security_check?j_username=" + userName + "&j_password=" + userPassword ); } } } 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; } } -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - 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 -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Servlet container authentication in Wicket
Hi all, just as a last reminder (before the article is archived;-), is there anybody who yould provide me with an example how to user Servlect container authentication in Wicket? I followed the example in http://cwiki.apache.org/WICKET/servlet-container-authentication.html but I get the error mentioned below. Maybe some more configuration in tomcat? Thank you for your help Philipp Hi Timm, I also tried to add my application name in it (like you proposed), but no difference, still doesn't work. Philipp http://localhost:5080/j_security_check?j_username=test&j_password=test Shouldn't there be an application named? http://localhost:5080/MYAPP/j_security_check?j_username=test&j_password=test Regards, Timm Am Sonntag, 1. Februar 2009 23:03:50 schrieb Philipp Daumke: Hi all, I followed the Servlet Container authentication as described in http://cwiki.apache.org/WICKET/servlet-container-authentication.html, but I do not get it working. At the moment I get an error in firefox when invoking the redirectToSecurityCheck() method: http://localhost:5080/j_security_check?j_username=test&j_password=test _The requested resource () is not available. _I don't even know exactly what "j_security_check" is and don't find too much on the web. Do I have to configure Tomcat properly? Below is my full src. MyApp.java and web.xml look like in the example (see link aboe). Thank you for your help! Philipp public final class LoginPage extends WebPage { private String username; private String password; public LoginPage() { redirectToSecurityCheck(); /*if( ( ( MySession )getSession() ).isUserLoggedIn()) { // redirect to hide username and password from URL after user is logged in setRedirect( true ); setResponsePage( Index.class ); } else { redirectToSecurityCheck(); }*/ } /** * Common servlet login workaround */ private void redirectToSecurityCheck() { final Map parametersMap = ( ( WebRequestCycle )RequestCycle.get() ).getWebRequest().getHttpServletRequest().getParameterMap(); if( parametersMap.containsKey( "username" ) && parametersMap.containsKey( "password" ) ) { // getting parameters from POST request final String userName = ( ( String[] )parametersMap.get( "username" ) )[ 0 ]; final String userPassword = ( ( String[] )parametersMap.get( "password" ) )[ 0 ]; // if POST parameters are ok, redirect them to j_security_check if( ( userName != null ) && ( userPassword != null ) ) { getRequestCycle().setRedirect( false ); getRequestCycle().setRequestTarget( EmptyRequestTarget.getInstance() ); getResponse().redirect( "/j_security_check?j_username=" + userName + "&j_password=" + userPassword ); } } } 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; } } - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Budy indicator next to a checkbox
Thanks Igor, that was the point. Philipp ajaxcheckbox does not have a method public String getAjaxIndicatorMarkupId() so what are you trying to override? instead let your panel implement see IAjaxIndicatorAware -igor On Sun, Feb 1, 2009 at 3:49 PM, Philipp Daumke wrote: Hi all, I try to get a busy indicator next to a checkboxm, but it doesn't work. I tried to use the standard AjaxIndicatorAppender as shown in wicket-extensions. Does this class only work with extension-classes startign with "Indicating.."? Do you have an example how to show an indicator next to a checkbox? All the best Philipp public class CriticalCheckboxActionPanel extends Panel { Index index; private final AjaxIndicatorAppender indicatorAppender = new AjaxIndicatorAppender(); public MyCheckboxActionPanel(String id, final IModel model, final Item item, Index index) { ... AjaxCheckBox chb = new AjaxCheckBox("too_critical",new PropertyModel(to, "too_critical")) { @Override protected void onUpdate(AjaxRequestTarget target) { try { Thread.sleep(5000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public String getAjaxIndicatorMarkupId() { return indicatorAppender.getMarkupId(); } }; chb.add(indicatorAppender); add(chb); } } -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - 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 -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Budy indicator next to a checkbox
Hi all, I try to get a busy indicator next to a checkboxm, but it doesn't work. I tried to use the standard AjaxIndicatorAppender as shown in wicket-extensions. Does this class only work with extension-classes startign with "Indicating.."? Do you have an example how to show an indicator next to a checkbox? All the best Philipp public class CriticalCheckboxActionPanel extends Panel { Index index; private final AjaxIndicatorAppender indicatorAppender = new AjaxIndicatorAppender(); public MyCheckboxActionPanel(String id, final IModel model, final Item item, Index index) { ... AjaxCheckBox chb = new AjaxCheckBox("too_critical",new PropertyModel(to, "too_critical")) { @Override protected void onUpdate(AjaxRequestTarget target) { try { Thread.sleep(5000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public String getAjaxIndicatorMarkupId() { return indicatorAppender.getMarkupId(); } }; chb.add(indicatorAppender); add(chb); } } -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Servlet container authentication in Wicket
Hi Timm, I also tried to add my application name in it (like you proposed), but no difference, still doesn't work. Philipp http://localhost:5080/j_security_check?j_username=test&j_password=test Shouldn't there be an application named? http://localhost:5080/MYAPP/j_security_check?j_username=test&j_password=test Regards, Timm Am Sonntag, 1. Februar 2009 23:03:50 schrieb Philipp Daumke: Hi all, I followed the Servlet Container authentication as described in http://cwiki.apache.org/WICKET/servlet-container-authentication.html, but I do not get it working. At the moment I get an error in firefox when invoking the redirectToSecurityCheck() method: http://localhost:5080/j_security_check?j_username=test&j_password=test _The requested resource () is not available. _I don't even know exactly what "j_security_check" is and don't find too much on the web. Do I have to configure Tomcat properly? Below is my full src. MyApp.java and web.xml look like in the example (see link aboe). Thank you for your help! Philipp public final class LoginPage extends WebPage { private String username; private String password; public LoginPage() { redirectToSecurityCheck(); /*if( ( ( MySession )getSession() ).isUserLoggedIn()) { // redirect to hide username and password from URL after user is logged in setRedirect( true ); setResponsePage( Index.class ); } else { redirectToSecurityCheck(); }*/ } /** * Common servlet login workaround */ private void redirectToSecurityCheck() { final Map parametersMap = ( ( WebRequestCycle )RequestCycle.get() ).getWebRequest().getHttpServletRequest().getParameterMap(); if( parametersMap.containsKey( "username" ) && parametersMap.containsKey( "password" ) ) { // getting parameters from POST request final String userName = ( ( String[] )parametersMap.get( "username" ) )[ 0 ]; final String userPassword = ( ( String[] )parametersMap.get( "password" ) )[ 0 ]; // if POST parameters are ok, redirect them to j_security_check if( ( userName != null ) && ( userPassword != null ) ) { getRequestCycle().setRedirect( false ); getRequestCycle().setRequestTarget( EmptyRequestTarget.getInstance() ); getResponse().redirect( "/j_security_check?j_username=" + userName + "&j_password=" + userPassword ); } } } 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; } } - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Servlet container authentication in Wicket
Hi all, I followed the Servlet Container authentication as described in http://cwiki.apache.org/WICKET/servlet-container-authentication.html, but I do not get it working. At the moment I get an error in firefox when invoking the redirectToSecurityCheck() method: http://localhost:5080/j_security_check?j_username=test&j_password=test _The requested resource () is not available. _I don't even know exactly what "j_security_check" is and don't find too much on the web. Do I have to configure Tomcat properly? Below is my full src. MyApp.java and web.xml look like in the example (see link aboe). Thank you for your help! Philipp public final class LoginPage extends WebPage { private String username; private String password; public LoginPage() { redirectToSecurityCheck(); /*if( ( ( MySession )getSession() ).isUserLoggedIn()) { // redirect to hide username and password from URL after user is logged in setRedirect( true ); setResponsePage( Index.class ); } else { redirectToSecurityCheck(); }*/ } /** * Common servlet login workaround */ private void redirectToSecurityCheck() { final Map parametersMap = ( ( WebRequestCycle )RequestCycle.get() ).getWebRequest().getHttpServletRequest().getParameterMap(); if( parametersMap.containsKey( "username" ) && parametersMap.containsKey( "password" ) ) { // getting parameters from POST request final String userName = ( ( String[] )parametersMap.get( "username" ) )[ 0 ]; final String userPassword = ( ( String[] )parametersMap.get( "password" ) )[ 0 ]; // if POST parameters are ok, redirect them to j_security_check if( ( userName != null ) && ( userPassword != null ) ) { getRequestCycle().setRedirect( false ); getRequestCycle().setRequestTarget( EmptyRequestTarget.getInstance() ); getResponse().redirect( "/j_security_check?j_username=" + userName + "&j_password=" + userPassword ); } } } 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; } } -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Focus on component
Hi Matthew, this solution works perfectly well, thanks a lot. Philipp You can write a behaviour for it so it will be more reusable. The following is based on http://cwiki.apache.org/WICKET/request-focus-on-a-specific-form-component.html and works for both regular and ajax requests. private final class MyLink extends AjaxFallbackLink { public void onClick(AjaxRequestTarget target) { onShowForm(target); myField.add(new FocusBehavior()); } } public class FocusBehavior extends AbstractBehavior { /** * */ private static final long serialVersionUID = 1L; @Override public void bind(Component component) { super.bind(component); component.setOutputMarkupId(true); final Response response = component.getResponse(); if (response instanceof WebResponse && !((WebResponse)response).isAjax()) { component.setComponentBorder(new IComponentBorder() { /** * */ private static final long serialVersionUID = 1L; public void renderBefore(Component component) { } public void renderAfter(Component component) { final Response response = component.getResponse(); response.write( "document.getElementById(\"" + component.getMarkupId() + "\").focus()"); } }); } this.component = component; } private Component component; @Override public void renderHead(IHeaderResponse response) { if (response.getResponse() instanceof WebResponse && ((WebResponse)response.getResponse()).isAjax()) { response.renderOnLoadJavascript("document.getElementById('" + component.getMarkupId() + "').focus()"); } } @Override public boolean isTemporary() { return true; } } On Thu, Jan 29, 2009 at 4:07 PM, Philipp Daumke wrote: Hi Michael, thanks for your help, but it doesn't work yet. My code: TextField myField = new TextField("text"); myField.setOutputMarkupId(true); myField.setOutputMarkupPlaceholderTag(true); add(myField); private final class MyLink extends AjaxFallbackLink { public void onClick(AjaxRequestTarget target) { onShowForm(target); target.appendJavascript("getElementById('"+myField.getMarkupId()+ "').focus()"); } } Is there something obviously wrong? Correct Javascript syntax and semantic? Is there an alternative "wicket" approach so that I don't have to use Javascript myself? Thanks for help Philipp use target.(pre|append)Javascript if you want additional JS executed before/after doing the wicket-ajax stuff if you only want to set the focus (without any ajax involved), don't use ajaxlink, use e.g. a simple WebmarkupContainer hth, michael Philipp Daumke-2 wrote: Dear all, I try to show and focus on a text field when clicking on a link. The focus however doesn't work. I tried to follow an example in cwiki ( http://cwiki.apache.org/WICKET/calling-javascript-function-on-wicket-components-onclick.html) but I somehow do something wrong. I tried to add some javascript attribute via AttributeAppender, but then I get a null pointer exception in onClick ("target is null"). When I comment that line out (so don't add the Attribute), everything works fine except that focus doesn't work. Any help appreciated. Thanks a lot Philipp Here's my code: in a WebMarkupContainer: link.add(new AttributeAppender("onClick", new Model("getElementById('"+textfield.getMarkupId()+ "').onFocus();"), ";")); in my custom Link Class: public void onClick(AjaxRequestTarget target) { showFormThatContainsTextField(target); } void showFormThatContainsTextField(AjaxRequestTarget target) { // toggle the visibility ... // redraw the add container. target.addComponent(this); } -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - Michael Sparer http://techblog.molindo.at -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Averbis GmbH c/o Kli
Re: UTF-8 bug in wicket? Or in Tomcat?
Hi Jonas, hi Johann, grrh, I forgot to set URIEncoding="UTF-8". Now it works, thank you for your help. All the best Philipp Hi Philipp, yes, thats correct. We had similar problems and fixed it that way, but maybe something else is still not set to UTF-8. I assume you have configured your tomcat connector using URIEncoding="UTF-8" (I think that is what Johan is referring to?). Have you tried adding a meta tag to your markup? Something like [meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /] cheers, Jonas On Fri, Jan 30, 2009 at 9:11 AM, Philipp Daumke wrote: Hi Jonas, thanks for your help, but I think it doesn't help. Just to make sure that I understood the Application#init correctly, you meant to do it like this, right(?): public class MyApp extends WebApplication { public void init() { getRequestCycleSettings().setResponseRequestEncoding("UTF-8"); getMarkupSettings().setDefaultMarkupEncoding("UTF-8"); } public Class getHomePage() { return Index.class; } } Still, it seems to convert my code from latin1 to utf8, even though I enter utf8-text. Thanks for further help Philipp Hi, have you tried setting getRequestCycleSettings().setResponseRequestEncoding("UTF-8"); getMarkupSettings().setDefaultMarkupEncoding("UTF-8"); in your Application#init If you don't set the default markup encoding explicitly, the default for it is the 'os provided encoding' (see: IMarkupSettings#getDefaultMarkupEncoding) cheers, Jonas On Fri, Jan 30, 2009 at 1:02 AM, Philipp Daumke wrote: Hi Mathias, 'äöü' is actually already converted to 'äöü' when I add a breakpoint at the onSubmit method of my form (so right when I get the input of the text field from my model). My whole eclipse is in UTF-8, Wicket writes UTF-8 to each HTML-Page, my firefox says UTF-8. What I think is that Wicket or Tomcat treats my UTF8-String äöü as an ISO-8859-1 String and converts it from iso to utf8, so into 'äöü'. When I copy 'äöü' into a tmp.txt file in unix-shell which is in UTF-8 and do an "iconv -futf8 -tlatin1 tmp.txt" on it, the output is 'äöü' again. Any idea what to do? All the best Philipp Do you save it to a database and then display the text? How do you present it? -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - 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 -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - 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 -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: UTF-8 bug in wicket? Or in Tomcat?
Hi Jonas, thanks for your help, but I think it doesn't help. Just to make sure that I understood the Application#init correctly, you meant to do it like this, right(?): public class MyApp extends WebApplication { public void init() { getRequestCycleSettings().setResponseRequestEncoding("UTF-8"); getMarkupSettings().setDefaultMarkupEncoding("UTF-8"); } public Class getHomePage() { return Index.class; } } Still, it seems to convert my code from latin1 to utf8, even though I enter utf8-text. Thanks for further help Philipp Hi, have you tried setting getRequestCycleSettings().setResponseRequestEncoding("UTF-8"); getMarkupSettings().setDefaultMarkupEncoding("UTF-8"); in your Application#init If you don't set the default markup encoding explicitly, the default for it is the 'os provided encoding' (see: IMarkupSettings#getDefaultMarkupEncoding) cheers, Jonas On Fri, Jan 30, 2009 at 1:02 AM, Philipp Daumke wrote: Hi Mathias, 'äöü' is actually already converted to 'äöü' when I add a breakpoint at the onSubmit method of my form (so right when I get the input of the text field from my model). My whole eclipse is in UTF-8, Wicket writes UTF-8 to each HTML-Page, my firefox says UTF-8. What I think is that Wicket or Tomcat treats my UTF8-String äöü as an ISO-8859-1 String and converts it from iso to utf8, so into 'äöü'. When I copy 'äöü' into a tmp.txt file in unix-shell which is in UTF-8 and do an "iconv -futf8 -tlatin1 tmp.txt" on it, the output is 'äöü' again. Any idea what to do? All the best Philipp Do you save it to a database and then display the text? How do you present it? -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - 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 -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: UTF-8 bug in wicket? Or in Tomcat?
Hi Mathias, 'äöü' is actually already converted to 'äöü' when I add a breakpoint at the onSubmit method of my form (so right when I get the input of the text field from my model). My whole eclipse is in UTF-8, Wicket writes UTF-8 to each HTML-Page, my firefox says UTF-8. What I think is that Wicket or Tomcat treats my UTF8-String äöü as an ISO-8859-1 String and converts it from iso to utf8, so into 'äöü'. When I copy 'äöü' into a tmp.txt file in unix-shell which is in UTF-8 and do an "iconv -futf8 -tlatin1 tmp.txt" on it, the output is 'äöü' again. Any idea what to do? All the best Philipp Do you save it to a database and then display the text? How do you present it? -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
UTF-8 bug in wicket? Or in Tomcat?
Hi all, when I enter German umlauts (e.g. "äöü") in a wicket text field it's converted to "äöü". Everything seems to be in "UTF-8". I already tried to apply a filter as described in http://wiki.apache.org/tomcat/Tomcat/UTF-8 without success. Any ideas? Thanks for your help Philipp -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Focus on component
Hi Michael, thanks for your help, but it doesn't work yet. My code: TextField myField = new TextField("text"); myField.setOutputMarkupId(true); myField.setOutputMarkupPlaceholderTag(true); add(myField); private final class MyLink extends AjaxFallbackLink { public void onClick(AjaxRequestTarget target) { onShowForm(target); target.appendJavascript("getElementById('"+myField.getMarkupId()+ "').focus()"); } } Is there something obviously wrong? Correct Javascript syntax and semantic? Is there an alternative "wicket" approach so that I don't have to use Javascript myself? Thanks for help Philipp use target.(pre|append)Javascript if you want additional JS executed before/after doing the wicket-ajax stuff if you only want to set the focus (without any ajax involved), don't use ajaxlink, use e.g. a simple WebmarkupContainer hth, michael Philipp Daumke-2 wrote: Dear all, I try to show and focus on a text field when clicking on a link. The focus however doesn't work. I tried to follow an example in cwiki (http://cwiki.apache.org/WICKET/calling-javascript-function-on-wicket-components-onclick.html) but I somehow do something wrong. I tried to add some javascript attribute via AttributeAppender, but then I get a null pointer exception in onClick ("target is null"). When I comment that line out (so don't add the Attribute), everything works fine except that focus doesn't work. Any help appreciated. Thanks a lot Philipp Here's my code: in a WebMarkupContainer: link.add(new AttributeAppender("onClick", new Model("getElementById('"+textfield.getMarkupId()+ "').onFocus();"), ";")); in my custom Link Class: public void onClick(AjaxRequestTarget target) { showFormThatContainsTextField(target); } void showFormThatContainsTextField(AjaxRequestTarget target) { // toggle the visibility ... // redraw the add container. target.addComponent(this); } -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - Michael Sparer http://techblog.molindo.at -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: textfield to take only numnbers
Hi Miro, can't you use a PatternValidator such as: add(new TextField("textfieldname").add(new PatternValidator("^\\d+$"))); Cheers Philipp I s there any textfield which takes only numbers, I dont want user to enter letters only numbers so I want a textfield which takes only numbers is there any such textfield ? -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Focus on component
Dear all, I try to show and focus on a text field when clicking on a link. The focus however doesn't work. I tried to follow an example in cwiki (http://cwiki.apache.org/WICKET/calling-javascript-function-on-wicket-components-onclick.html) but I somehow do something wrong. I tried to add some javascript attribute via AttributeAppender, but then I get a null pointer exception in onClick ("target is null"). When I comment that line out (so don't add the Attribute), everything works fine except that focus doesn't work. Any help appreciated. Thanks a lot Philipp Here's my code: in a WebMarkupContainer: link.add(new AttributeAppender("onClick", new Model("getElementById('"+textfield.getMarkupId()+ "').onFocus();"), ";")); in my custom Link Class: public void onClick(AjaxRequestTarget target) { showFormThatContainsTextField(target); } void showFormThatContainsTextField(AjaxRequestTarget target) { // toggle the visibility ... // redraw the add container. target.addComponent(this); } -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
How can FeedbackPanel show error message of AjaxEditablePanel ?
Hi all, I try to show the error message of an AjaxEditablePanel in a FeedbackPanel, but it doesn't work. On the web I only find examples where FormComponents are validated. My AjaxEditablePanel is not part of a form? Any idea or example? Thank you Philipp -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Render other components
Hi Jonas, hi Cemal, I think both of you mean similar things. So I need to attributes in my custom panel, one for the referring instance (in my case an instance of Class Index) and one for the component that I want to render (in my case AjaxFallbackDefaultDataTable). So my new custom panel looks like the one below. Agree? Thank you for your help Philipp public class TermIDLinkPanel extends Panel { Index indexInstance; Component componentInstance; public TermIDLinkPanel(Index indexInstance, Component component, String id, final IModel model, final Item item) { super(id, model); this.indexInstance = indexInstance; this.componentInstance = component; ... AjaxLink link = new AjaxLink("link_termID", new PropertyModel(obj, "id")) { public void onClick(AjaxRequestTarget target) { target.addComponent(componentInstance); Page page = target.getPage(); //API to change the result list that shall be newly rendered TermIDLinkPanel.this.indexInstance.updateRelationResultList(); target.addComponent(componentInstance); } }; add(link); } } Philipp, I expect your page's constructor creates and adds your custom panel. So, either make the whole panel invisible, or, if the panel hosts other widgets that need to be shown before your AjaxLink is clicked, you can provide an API on your panel to make the ADDT invisble/visible. This would be better than accessing the ADDT directly (encapsulation). Is that what you meant? If not, create the simplest possible http://wicket.apache.org/quickstart.html QuickStart (remember to delete the target folder), zip it up and attach the zip file to your post so we can take a look. Regards- Cemal http://www.jWeekend.co.uk jWeekend Hi, I somehow doubt this is considered good practice to let one component know where in the component tree another component is situated. The code you propose breaks very easily e.g. if you introduce another container around the ADDT. Why don't you just pass the ADDT instance into the AjaxLink? something like: final AjaxFallbackDefaultDataTable myADDT = ... AjaxLink link = new AjaxLink("link", new PropertyModel(obj, "id")) { public void onClick(AjaxRequestTarget target) { target.addComponent(myADDT); } } ...but I'm not sure if that's a better practice. At least this doesn't break as easily if you change the position of the ADDT in the component tree. Maybe a core-dev could shed some light on this issue? cheers, Jonas On Tue, Jan 27, 2009 at 2:21 PM, Philipp Daumke wrote: Hi all, I finally my error and post the working solution. I need to use a colon ":" to find children. AjaxLink link = new AjaxLink("link", new PropertyModel(obj, "id")) { public void onClick(AjaxRequestTarget target) { Page page = target.getPage(); AjaxFallbackDefaultDataTable myADDT= (AjaxFallbackDefaultDataTable) page.get("tabs:panel:relTable"); target.addComponent(myADDT); } } For "tabs", "panel" and "relTable" I put setOutputMarkupId(true); (don't know whether this was necessary). Philipp Dear Cemal, thanks for your fast help. You understood what I meant but I still have the problem, that I don't know how to get the instance myADDT. I tried Page page = target.getPage(); AjaxFallbackDefaultDataTable myADDT= (AjaxFallbackDefaultDataTable) page.get("relTable"); but get "myADDT=null". Probably because "relTable" is something like the 2nd or 3rd ancestor on that page (see below)? Thanks for your help again Philipp My Main HTML-Page Index.html: ... ... Includes this subpage Index$TabPanel1.html [table] <(wicket:panel> Philipp, I'm not sure I have fully understood what you are after but it may be that something as straight forward as making the component to be added (ADDT) invisible - setVisible(false) - when first added to its parent (eg the page) and making it visible in your AjaxLink (AL) onClick implementation. Don't forget to setOutputMarkupPlaceholderTag(true) as well as setOutputMarkupId(true) on your ADDT and to add the ADDT to the AjaxRequestTarget - target.addComponent(myADDT) - in that onClick method. Regards - Cemal http://www.jWeekend.co.uk jWeekend Philipp Daumke-2 wrote: Dear all, I look for an example how to render Wicket-Components (in my case an AjaxDefaultDataTable) triggered by other Components (in my case AjaxLink). In my case the two components are defined in different Java-Classes. I looked for a while in the examples and in the wiki, but coudln't find anything. I appreciate your help or just a few links to some examples! All the best Philipp
Re: Render other components
Hi all, I finally my error and post the working solution. I need to use a colon ":" to find children. AjaxLink link = new AjaxLink("link", new PropertyModel(obj, "id")) { public void onClick(AjaxRequestTarget target) { Page page = target.getPage(); AjaxFallbackDefaultDataTable myADDT= (AjaxFallbackDefaultDataTable) page.get("tabs:panel:relTable"); target.addComponent(myADDT); } } For "tabs", "panel" and "relTable" I put setOutputMarkupId(true); (don't know whether this was necessary). Philipp Dear Cemal, thanks for your fast help. You understood what I meant but I still have the problem, that I don't know how to get the instance myADDT. I tried Page page = target.getPage(); AjaxFallbackDefaultDataTable myADDT= (AjaxFallbackDefaultDataTable) page.get("relTable"); but get "myADDT=null". Probably because "relTable" is something like the 2nd or 3rd ancestor on that page (see below)? Thanks for your help again Philipp My Main HTML-Page Index.html: ... ... Includes this subpage Index$TabPanel1.html wicket:id="relTable">[table] <(wicket:panel> Philipp, I'm not sure I have fully understood what you are after but it may be that something as straight forward as making the component to be added (ADDT) invisible - setVisible(false) - when first added to its parent (eg the page) and making it visible in your AjaxLink (AL) onClick implementation. Don't forget to setOutputMarkupPlaceholderTag(true) as well as setOutputMarkupId(true) on your ADDT and to add the ADDT to the AjaxRequestTarget - target.addComponent(myADDT) - in that onClick method. Regards - Cemal http://www.jWeekend.co.uk jWeekend Philipp Daumke-2 wrote: Dear all, I look for an example how to render Wicket-Components (in my case an AjaxDefaultDataTable) triggered by other Components (in my case AjaxLink). In my case the two components are defined in different Java-Classes. I looked for a while in the examples and in the wiki, but coudln't find anything. I appreciate your help or just a few links to some examples! All the best Philipp To make a silly example, I look for something like: class1 AjaxLink link = new AjaxLink("link", new PropertyModel(obj, "id")) { public void onClick(AjaxRequestTarget target) { getComponent("myAjaxDefaultDataTable").render(); } }; ... class2 ... add(new AjaxFallbackDefaultDataTable("myAjaxDefaultDataTable", columns, relationProvider, 20) { { setOutputMarkupId(true); } }); -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Render other components
Dear Cemal, thanks for your fast help. You understood what I meant but I still have the problem, that I don't know how to get the instance myADDT. I tried Page page = target.getPage(); AjaxFallbackDefaultDataTable myADDT= (AjaxFallbackDefaultDataTable) page.get("relTable"); but get "myADDT=null". Probably because "relTable" is something like the 2nd or 3rd ancestor on that page (see below)? Thanks for your help again Philipp My Main HTML-Page Index.html: ... ... Includes this subpage Index$TabPanel1.html [table] <(wicket:panel> Philipp, I'm not sure I have fully understood what you are after but it may be that something as straight forward as making the component to be added (ADDT) invisible - setVisible(false) - when first added to its parent (eg the page) and making it visible in your AjaxLink (AL) onClick implementation. Don't forget to setOutputMarkupPlaceholderTag(true) as well as setOutputMarkupId(true) on your ADDT and to add the ADDT to the AjaxRequestTarget - target.addComponent(myADDT) - in that onClick method. Regards - Cemal http://www.jWeekend.co.uk jWeekend Philipp Daumke-2 wrote: Dear all, I look for an example how to render Wicket-Components (in my case an AjaxDefaultDataTable) triggered by other Components (in my case AjaxLink). In my case the two components are defined in different Java-Classes. I looked for a while in the examples and in the wiki, but coudln't find anything. I appreciate your help or just a few links to some examples! All the best Philipp To make a silly example, I look for something like: class1 AjaxLink link = new AjaxLink("link", new PropertyModel(obj, "id")) { public void onClick(AjaxRequestTarget target) { getComponent("myAjaxDefaultDataTable").render(); } }; ... class2 ... add(new AjaxFallbackDefaultDataTable("myAjaxDefaultDataTable", columns, relationProvider, 20) { { setOutputMarkupId(true); } }); -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Render other components
Dear all, I look for an example how to render Wicket-Components (in my case an AjaxDefaultDataTable) triggered by other Components (in my case AjaxLink). In my case the two components are defined in different Java-Classes. I looked for a while in the examples and in the wiki, but coudln't find anything. I appreciate your help or just a few links to some examples! All the best Philipp To make a silly example, I look for something like: class1 AjaxLink link = new AjaxLink("link", new PropertyModel(obj, "id")) { public void onClick(AjaxRequestTarget target) { getComponent("myAjaxDefaultDataTable").render(); } }; ... class2 ... add(new AjaxFallbackDefaultDataTable("myAjaxDefaultDataTable", columns, relationProvider, 20) { { setOutputMarkupId(true); } }); -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: DefaultDataTable and AjaxEditableLabel
Hi Uwe, thanks for the link. I agree that my model passing is weird. Your link to the example explains an editable TreeTable but I look for a DataTable example. In that tree table example I cannot use the tree.table.PropertyEditableColumn as as the DefaultDataTable I want to use requires data.table.IColumns (not tree.table.IColumns) , or am I wrong? Or can I just cast them? Another ideas? Not to be mentioned I'm a wicket newbie and there's maybe a very simple solution for that Thanks, Philipp Philipp Daumke schrieb: I try to create an editable column using DefaultDataTable and AjaxEditableLabel. My current version is posted below but it's quite a hack and I wonder whether there's an official good solution for that before I go on with my work. i think the passing of your models is a little weird. anyhow, you might want to take a look at this example: http://wicketstuff.org/wicket13/nested/?wicket:bookmarkablePage=%3Aorg.apache.wicket.examples.ajax.builtin.tree.EditableTreeTablePage cu uwe -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
DefaultDataTable and AjaxEditableLabel
Dear all, I try to create an editable column using DefaultDataTable and AjaxEditableLabel. My current version is posted below but it's quite a hack and I wonder whether there's an official good solution for that before I go on with my work. Thanks al lot for your help Philipp HTML:wicket:id="termTable">[table] Java: columns = new ArrayList(); columns.add(new AbstractColumn(new Model("ColumnName")) { public void populateItem(Item cellItem, String componentId, final IModel model) { cellItem.setModel(model); ObjectToDisplay to = (ObjectToDisplay )cellItem.getModelObject(); String attribute1= to.getAttribute1(); cellItem.add(new AjaxEditableLabel(componentId, new Model(attribute1)) { @Override protected void onSubmit(AjaxRequestTarget target) { super.onSubmit(target); String newAttribute1 = (String) getModelObject(); ObjectToDisplay obj = (ObjectToDisplay ) getParent().getModelObject(); obj.setAttribute1(newAttribute1); System.out.println("New Attribute for " + obj .getId() + ": " + obj .getAttribute1(); } }); } add(new DefaultDataTable("tablename", columns, provider, 20)); SortableDataProvider provider = new SortableDataProvider() { public int size() { return resultList.getEntries().size(); } public IModel model(Object object) { TableObject entry = (TableObject) object; return new Model((Serializable) entry); } /*public Iterator iterator(int first, int count) { return resultList.selectEntries(first, count).iterator(); }*/ public Iterator iterator(int first, int count) { SortParam sp = getSort(); return resultList.selectEntries(first, count, sp).iterator(); } }; -- Averbis GmbH c/o Klinikum der Albert-Ludwigs-Universität Stefan-Meier-Strasse 26 D-79104 Freiburg Fon: +49 (0) 761 - 203 6707 Fax: +49 (0) 761 - 203 6800 E-Mail: dau...@averbis.de Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó Sitz der Gesellschaft: Freiburg i. Br. AG Freiburg i. Br., HRB 701080 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org