Re: container authentication and form action url

2009-12-07 Thread Alfredo Aleandri

Igor Vaynberg wrote:

dont use a wicket form if you dont want it processed by wicket.

-igor

  

Hi Igor,
I want to use wicket to manage that page, I want to process user data to 
fetch user profiles by username/password than I will post all user data 
(name/password/profile) to j_security_check using an hidden plain html 
form and some javascript code.


Thank you for your suggestions...

alf


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



container authentication and form action url

2009-12-07 Thread Alfredo Aleandri

Hi all,
I've setup my container-authentication (form based) using a simple 
SigninPage (mounted on /login) and a dummy protected url "/protected", 
here is the web.xml relevant code:


   
   w
   myapp
   /protected
   GET
   POST
   
   
  
   

   FORM
   
   /login
   /error
   
   

I've extended AbstractPageAuthorizationStrategy to redirect all 
protected pages access to the container-protected url (/protected) and 
activate the container authentication.


When the user  request a protected page, for example "GET /app/protected 
HTTP/1.1" all works good: the configured  is returned 
as response and the requested url will not change as expected.
The login page contains a form with two input (username/password) and a 
combo for user profiles, so I need to post to the sign in page to load 
available user profiles.


The problem is that the form action attribute created by wicket is 
something like 
"?wicket:interface=:0:privateLogin::IFormSubmitListener::" that produce 
a POST to "/app/protected?wicket:interface=:0:privateLogin:ajaxButton::" 
INSTEAD OF "/app/login".
This cause a new sign in page instantiation discarding user input. How 
can I obtain to POST to the sign in page instead of the requested url 
(/app/protected) ?


I don't want to do a redirect to login page (that trick works) because I 
would like to avoid the user bookmark the login page that prevent to 
activate the container-based authentication.


Thank you

alf



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



user input lost on first form submission

2009-05-22 Thread Alfredo Aleandri

Hi all,
I have a simple sign-in page with a form and two fields (username and 
password)


   public LoginPage() {
   super();
   add(new SignInForm("signInForm"));   
   }


   private class SignInForm extends Form {
  
   private String username, password;
  
   public SignInForm(String id) {

   super(id);
   add(new TextField("username", new 
PropertyModel(this, "username")));
   add(new PasswordTextField("password", new 
PropertyModel(this, "password")));

   }
  
   @Override

   protected void onSubmit() {
   // TODO Auto-generated method stub
   super.onSubmit();
   }

   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;
   }
   }

if the user get the page directly, using the mounted url, all work as 
expected.
When the user get this page after a container redirection (I'm using 
form based servlet container authentication), on first form submission, 
the user entered data are not available (the sets are never called) but 
on the next submit all work as normal and models are updated.


The page is mounted using
mountBookmarkablePage("/login", LoginPage.class);

and the relevant part of the web.xml is
/login

Thank you

alf



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Application scope vs Singleton

2009-05-15 Thread Alfredo Aleandri

Hi,
I have a doubt about application-scoped objects.
What's the pro and cons of setting an object instance into my 
WebApplication class or define that class as singleton (using a static 
method to access it) ?


Thank you

alf


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Datatable columns converter

2009-05-12 Thread Alfredo Aleandri

Hi,
I can't figure out the best way to define something like a 
object-to-string converter to add to a DataTable's column (PropertyColumn).
I have an Integer in my model and I want to display a proper String to 
the user by a defined mapping.


Thank you

alf


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



AjaxTabbedPanel custom validation behaviour

2009-05-08 Thread Alfredo Aleandri
I'm using an AjaxTabbedPanel and I would like to obtain the following 
behaviours:


1) user input must be retained when switching tabs

2) tabs link should skip only the "requireness" validation but not all 
other validators so the user can switch from tab to tab if he doesn't 
insert bad input


3) a submit button present in all tabs should execute a full validation 
of the TabbedPanel (all tabs) before execute some logic on the user input



Actually I've solved the point 1 overriding the AjaxTabbedPanel#newLink 
returning an AjaxSubmitLink instead the AjaxFallbackLink.

What is the best way to solve the other two open points?

Thank you

The relevant code of my WebPage follow:

||

public TabbedPanelPage() {

   final Form form = new Form("formy", new CompoundPropertyModel(this));

   form.setOutputMarkupId(true);
   add(form);

   final FeedbackPanel fp = new FeedbackPanel("feedback");
   fp.setOutputMarkupId(true);
   add(fp);

List tabs = new ArrayList();
tabs.add(new AbstractTab(new Model("first tab")) {
public Panel getPanel(String panelId) {
Panel p = new TabPanel1(panelId, form.getModel());
firstNameText = new TextField("text1");
firstNameText.setOutputMarkupId(true);
firstNameText.add(new 
StringValidator.MinimumLengthValidator(2));
p.add(firstNameText);
return p;
}
});
   
tabs.add(new AbstractTab(new Model("second tab")) {

public Panel getPanel(String panelId) {
Panel p = new TabPanel2(panelId, form.getModel());
lastNameText = new TextField("text2");
lastNameText.add(new StringValidator.MinimumLengthValidator(2));
p.add(lastNameText);
return p;
}
});   
 
tabPanel = new AjaxTabbedPanel("tabs", tabs) {

@Override
protected WebMarkupContainer newLink(String linkId, final int 
index) {

return new AjaxSubmitLink(linkId, form) {

private static final long serialVersionUID = 1L;
   
@Override

protected void onSubmit(AjaxRequestTarget target, Form 
form) {
setSelectedTab(index);
if (target != null) {
target.addComponent(form);
}
onAjaxUpdate(target);
}
   
@Override

protected void onError(AjaxRequestTarget target, Form form){
target.addComponent(fp);
}
}.setDefaultFormProcessing(true);
}
};
form.add(tabPanel);
 
Button submit = new Button("submit_button") {

@Override
public void onSubmit() {

   // TODO - validate entire form and process data

}
};
form.add(submit);
   }





-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



datatable columns shuffle

2009-04-23 Thread Alfredo Aleandri

Hi,
I'm a wicket beginner.
I'm trying to shuffle the columns of a datatable using an 
AjaxFallbackLink, this is my code (only relevant part):


my WebPage content:

   private AjaxFallbackDefaultDataTable usersTable;
   private List> userColumns = new ArrayList>();
   private UserProvider userProvider = new UserProvider();

   public QueryPage() {
  
   userColumns.add(new PropertyColumn(new Model("First 
Name"), "FIRSTNAME", "firstName"));
   userColumns.add(new PropertyColumn(new Model("Last 
Name"), "LASTNAME", "lastName"));
   usersTable = new AjaxFallbackDefaultDataTable("users_table", 
userColumns, userProvider, 20);

   usersTable.setOutputMarkupId(true);
   add(usersTable);
  
   add(new AjaxFallbackLink("users_shuffle") {

   @Override
   public void onClick(AjaxRequestTarget target) {
   Collections.shuffle(userColumns);
   usersTable = new 
AjaxFallbackDefaultDataTable("users_table", userColumns, userProvider, 20);

   if (target != null) {
   target.addComponent(usersTable);
   }
   }
   });

   }

my html page content:

   Shuffle!
   [table]


When I click the ajax link the "onClick" is executed, the userColumns 
list is shuffled but the page rendering is always the same as defined in 
the constructor of the WebPage.

I've tryied also using a standard Link (no ajax) getting the same result.
I'm using Wicket 1.4rc2.

Thank you

Alfredo


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org