[Wicket-user] beginners question: wicket and sessions

2006-08-13 Thread Korbinian Bachl



Hi,

i have a small 
problem in understanding the way sessions are used in wicket. Whenever i access 
any new wicket app (even HelloWorld) it gives me a SID, so i know i have a (http 
servlet) session. However, using the http.session is not the wicket way, and the 
wiki just tells: 
Custom Sessions 
The wicket way of storing objects in your session is by extending the 
wicket session. For example if you want to store some kind of user object in 
your session, you would create a getter and setter for it in your custom wicket 
session: public class MySession extends WebSession {
   public MySession(WebApplication application) {
  super(application);
   }
   private String myAttribute;
   // ... getters and setters
}But why do i have to explicitly do the getters and setters for each thing i want to have remembered?? -or did i get sth. wrong here???Best Regards,KorbinianPS: a little bit off-topic, but im also working myself into ejb3 a bit and i wondered, if i have a stateful sessionBean (e.g. a ShoppingCart) and i call the bean in any wicket page and set a product into it,how will be remembered to what session the Cart is attached to? - do i have to keep the connection to the specific bean open all the time or does the beancontainer take care for that ???
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] A problem with BookmarkablePageLink

2006-08-13 Thread Johan Compagner
Hmm when you specify the root AND the wicket servlet mapped to /* then yessomething goes wrong. I fixed this for 1.2.2 but this is not really the recommended approacheYou can run in the root just fine but don't specify the wicket servlet to /* 
That is only the best way for 2.0 where we have a filter.johanOn 8/12/06, itsliang [EMAIL PROTECTED]
 wrote:Hi there,I've got a problem when I using BookmarkablePageLink. I wrote a very simple
example to try out BookmarkablePageLink. In exmaple, you can find three webpages. In each web page, there are two links that can be used to link to theother two pages. And I only mount my second page as a BookmarkablePage.
When I deploy the example to the root of my tomcat 5.5 (by extracting thewar file to $TOMCAT$/webapps/ROOT/), which means I can access my app fromhttp://localhost:8080/
, the link in my second web page didn't work properly.However, if I not deploy the example to the root of my tomcat, let's sayhttp://localhost:8080/TestBookmarkable/
 for example, then everything workswell without any problem.Is this a bug of wicket? or did I implement my example in the wrong way? Thewar file and source code of my example can be found here:
http://www.nabble.com/user-files/280/TestBookmarkable.warTestBookmarkable.warhttp://www.nabble.com/user-files/281/TestBookmarkable.zip
TestBookmarkable.zipBest regards,Chih-liang ChangFor people who don't want to download these files, here is the source code:
TestApplication.javapackage test;import test.page.FirstPage;import test.page.SecondPage;import wicket.protocol.http.WebApplication;public class TestApplication extends WebApplication {
@Overridepublic Class getHomePage() {return FirstPage.class;}@Overrideprotected void init() {super.mountBookmarkablePage
(/second, SecondPage.class);super.getMarkupSettings().setStripWicketTags(true);super.getMarkupSettings().setStripXmlDeclarationFromOutput(true);super.init
();}}FirstPage.javapackage test.page;import wicket.markup.html.WebPage;import wicket.markup.html.link.BookmarkablePageLink
;import wicket.markup.html.link.PageLink;public class FirstPage extends WebPage {private static final long serialVersionUID = 1L;public FirstPage() {super.add
(new BookmarkablePageLink(second, SecondPage.class));super.add(new PageLink(third, ThirdPage.class));}}
SecondPage.javapackage test.page;import wicket.markup.html.WebPage;import wicket.markup.html.link.PageLink;public class SecondPage extends WebPage {private static final long serialVersionUID = 1L;
public SecondPage() {super.add(new PageLink(first, FirstPage.class));super.add(new PageLink(third, ThirdPage.class));}}
ThirdPage.javapackage test.page;import wicket.markup.html.WebPage;import wicket.markup.html.link.BookmarkablePageLink
;import wicket.markup.html.link.PageLink;public class ThirdPage extends WebPage {private static final long serialVersionUID = 1L;public ThirdPage() {super.add
(new PageLink(first, FirstPage.class));super.add(new BookmarkablePageLink(second, SecondPage.class));}}
FirstPage.html?xml version=1.0 encoding=BIG5 ?!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtdhtml xmlns=http://www.w3.org/1999/xhtmlxmlns:wicket=
http://wicket.sourceforge.netheadmeta http-equiv=Content-Type content=text/html; charset=BIG5 /titleInsert title here/title/head
bodypThis is the font size=+3first page/font./pp # second page /pp # third page /p/body/html
SecondPage.html?xml version=1.0 encoding=BIG5 ?!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtdhtml xmlns=http://www.w3.org/1999/xhtmlxmlns:wicket=
http://wicket.sourceforge.netheadmeta http-equiv=Content-Type content=text/html; charset=BIG5 /titleInsert title here/title/head
bodypThis is the font size=+3second page/font./pp # first page /pp # third page /p/body/html
ThirdPage.html?xml version=1.0 encoding=BIG5 ?!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtdhtml xmlns=http://www.w3.org/1999/xhtmlxmlns:wicket=
http://wicket.sourceforge.netheadmeta http-equiv=Content-Type content=text/html; charset=BIG5 /titleInsert title here/title/head
bodypThis is the font size=+3third page/font./pp # first page /pp # second page /p/body/html--
View this message in context: 

Re: [Wicket-user] Form-question

2006-08-13 Thread Mats Norén
What I want the following code to do is to iterate all propertyTypes
and create or lookup the appropriate property on my Person-object and
create a TextField for each one.

I've defined a model for the propertyTypes and a model for a
TeamPerson-object which contains my Person.

Everything works fine except that the setObject(Component c, Object o)
in  PersonPropertyModel is never called.
On screen the form renders and look fine but nothing gets written back.

Would appreciate another pair of eyes on this.


IModel propertyTypes = new LoadableDetachableModel() {
protected Object load() {
return userService.allPropertyTypes();
}
};

ListView dynamicProperties = new
ListView(dynamicProperties, propertyTypes) {

protected void populateItem(ListItem item) {

TextField valueField = new TextField(value);
valueField.setOutputMarkupId(true);
FormComponentFeedbackBorder feedbackBorder = new
FormComponentFeedbackBorder(feedback);
feedbackBorder.setRenderBodyOnly(true);
feedbackBorder.add(valueField);

item.add(feedbackBorder);

Label label = new Label(propertyType.name);
label.add(new AttributeModifier(for, true, new
Model(valueField.getId(;
item.add(label);

}

protected IModel getListItemModel(IModel
listViewModel, int index) {
PropertyType pt = (PropertyType)
super.getListItemModel(listViewModel, index).getObject(null);
return new CompoundPropertyModel(new
PersonPropertyModel(EditTeamPersonPanel.this.getModel(), pt));
}

}.setReuseItems(true);



public class PersonPropertyModel extends AbstractModel {

private final IModel teamPerson;
private final PropertyType propertyType;

public PersonPropertyModel(IModel teamPersonModel,
PropertyType propertyType) {
this.teamPerson = teamPersonModel;
this.propertyType = propertyType;
}

public Object getObject(Component c) {
logger.info(Calling getObject for component:  + c.getId());
TeamPerson tp = (TeamPerson) teamPerson.getObject(c);
Person person = tp.getPerson();
PersonProperty pp = person.getPropertyOfType(propertyType);
if (pp == null) {
logger.info(Adding new property);
pp = new PersonProperty();
pp.setPerson(person);
pp.setPropertyType(propertyType);
}
return pp;
}

public void setObject(Component c, Object o) {
TeamPerson tp = (TeamPerson) teamPerson.getObject(c);
Person person = tp.getPerson();
logger.info(Calling setObject for property:  +
((PersonProperty) o).getPropertyType().getName());
person.setPropertyOfType((PersonProperty) o);
}


public void detach() {
super.detach();
teamPerson.detach();
}
}

/Mats

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] beginners question: wicket and sessions

2006-08-13 Thread Igor Vaynberg
wicket's session object is stored inside http session. the getters and setters there are to make your code cleaner then using http session's map:object-object which is pretty ugly - so instead you use typesafe getters and setters. and as johan pointed out whenever you modify wicket's session object you have to call dirty() on it - this call triggers replication so the session is updated across the cluster if you have one.
-IgorOn 8/13/06, Johan Compagner [EMAIL PROTECTED] wrote:
No you dont have to have getters and setters but that is just a nice approache.How else would you get your data?And it is better to have a setter if the data can be changed because in the set you can call: dirty()
which is for us a trigger to reset our session object in the the http session object so that it knows that the session object is changed.johan
On 8/13/06, 
Korbinian Bachl [EMAIL PROTECTED] wrote:






Hi,

i have a small 
problem in understanding the way sessions are used in wicket. Whenever i access 
any new wicket app (even HelloWorld) it gives me a SID, so i know i have a (http 
servlet) session. However, using the http.session is not the wicket way, and the 
wiki just tells: 
Custom Sessions 
The wicket way of storing objects in your session is by extending the 
wicket session. For example if you want to store some kind of user object in 
your session, you would create a getter and setter for it in your custom wicket 
session: public class MySession extends WebSession {   public MySession(WebApplication application) {  super(application);   }   private String myAttribute;   // ... getters and setters
}But why do i have to explicitly do the getters and setters for each thing i want to have remembered?? -or did i get sth. wrong here???

Best Regards,KorbinianPS: a little bit off-topic, but im also working myself into ejb3 a bit and i wondered, if i have a stateful sessionBean (e.g. a ShoppingCart) and i call the bean in any wicket page and set a product into it,
how will be remembered to what session the Cart is attached to? - do i have to keep the connection to the specific bean open all the time or does the beancontainer take care for that ???



-Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo

http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list

Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user


-Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list
Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Two feedback panels on one page

2006-08-13 Thread Igor Vaynberg
final Form form=.new FeedbackPanel(foo, new IFeedbackMessageFilter() { boolean accept(FeedbackMessage message) { // messages reported on the session have a null reporter if (
message.getreporter()!=null) { // only accept messages coming from the children of the form return form.contains(message.getreporter(), true); } return false;
 }}-IgorOn 8/13/06, Predrag Spasojevic [EMAIL PROTECTED] wrote:
Hi,

I have a page with 2 panels. Each panel has its own form and feedback panel. When any validator fails the same messages are displayed on both feedback panels.

I have looked into wicket source code and in the class FeedbackMessageModel there is a method for getting feedback messages:

public final Object onGetObject(final Component component){if (messages == null){// Get filtered messages from page where component livesList pageMessages = component.getPage().getFeedbackMessages()
.messages(filter);


It looks like when validator fails it adds feedback message to a page. And when feedback panel is displayed it calls page to get messages. I suppose that is the reason why both feedback panels shows the same messages.


Is there any wayto havetwo feedback panels on one page that are not showing the same messages?-- Regards,Predrag Spasojevic 

-Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list
Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Two feedback panels on one page

2006-08-13 Thread Predrag Spasojevic
Why it isn't FeedbackPanel's default behavior?

I think thatthe common useis one FeedbackPanel per form,not per page
On 8/13/06, Igor Vaynberg [EMAIL PROTECTED] wrote:

final Form form=.new FeedbackPanel(foo, new IFeedbackMessageFilter() { boolean accept(FeedbackMessage message) { // messages reported on the session have a null reporter
 if ( message.getreporter()!=null) { // only accept messages coming from the children of the form return form.contains(message.getreporter(), true); }
 return false;  }}-Igor

On 8/13/06, Predrag Spasojevic 
[EMAIL PROTECTED] wrote: 




Hi,

I have a page with 2 panels. Each panel has its own form and feedback panel. When any validator fails the same messages are displayed on both feedback panels.

I have looked into wicket source code and in the class FeedbackMessageModel there is a method for getting feedback messages:

public final Object onGetObject(final Component component){if (messages == null){// Get filtered messages from page where component livesList pageMessages = component.getPage().getFeedbackMessages() 
.messages(filter);


It looks like when validator fails it adds feedback message to a page. And when feedback panel is displayed it calls page to get messages. I suppose that is the reason why both feedback panels shows the same messages. 


Is there any wayto havetwo feedback panels on one page that are not showing the same messages?-- Regards,Predrag Spasojevic 
-Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier 
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list
Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user 
-Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list
Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user
-- Pozdrav,Predrag Spasojevic 
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] open link in new window...

2006-08-13 Thread Erik Brakkee
Hi,


I am using wicket 1.2.1 and it is not detecting the opening of a new
browser window. Here is the situation. On my home page I have two links.
The two links forward the user to the same page but with different
information to display.

Here is what I do:
1. open the home page
2. right-click on one link and open the link in a new window
3. click on another link
4. refresh the window opened by step 2

After step 3, the two windows show different content. After step 4, the
window opened in step 2 shows the same content as the main window.

What am I doing wrong? What are the conditions for this to work?

Cheers
  Erik

PS. An example can be found on http://gpstracks.wamblee.org. Use the
links to the examples to reproduce the problem.

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] 优惠代开各类发票!

2006-08-13 Thread szgw1717sz
 贵公司负责人(经理/财务)您好: 
 我是深圳市中信实业有限公司;每月有增值税电脑发票、海关缴款书和普通商品销售税发票
 (电脑运输、其它服务,广告,租赁业)优惠向外代开或合作,点数较低.更希望能够有机会与
 贵公司合作!如贵司在发票的真伪方面有任何疑虑或担心,可上网查证或我司直接与贵司去税务
 局抵扣核对.彼此合作一次,必成永久朋友!多谢合作!如有打扰,敬请原谅。 
 此信息长期有效,如须进一步洽商: 
 详情请电(24小时业务热线):013424331717
 [EMAIL PROTECTED]
 联系人:陈志荣

 顺祝商祺! 
  深圳市中信实业有限公司

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] open link in new window...

2006-08-13 Thread Johan Compagner
works fine for me as far as i can seethe right click on the first show tracks on map opens: http://gpstracks.wamblee.org/gpstracks/app?wicket:bookmarkablePage=wicket-0:wicket.quickstart.TrackMapPage
and that is with a redirect. So that is fine.But how do you get the state (which track to display) to that TrackMapPage?Because if i do a refresh of that above url.. What do you show?johan
On 8/13/06, Erik Brakkee [EMAIL PROTECTED] wrote:
Hi,I am using wicket 1.2.1 and it is not detecting the opening of a newbrowser window. Here is the situation. On my home page I have two links.The two links forward the user to the same page but with different
information to display.Here is what I do:1. open the home page2. right-click on one link and open the link in a new window3. click on another link4. refresh the window opened by step 2After step 3, the two windows show different content. After step 4, the
window opened in step 2 shows the same content as the main window.What am I doing wrong? What are the conditions for this to work?CheersErikPS. An example can be found on 
http://gpstracks.wamblee.org. Use thelinks to the examples to reproduce the problem.-Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list
Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Two feedback panels on one page

2006-08-13 Thread Igor Vaynberg
well, its not the default because this is a tiny subset of what wicket's feedback system is capable of.now if it is a common usecase in your app you can craete a BoundedFeedbackPanel given the code i gave you previously. its a 10 line component that you can then reuse in your app - this is the power of wicket. we give you the tools that make it easy to adapt the functionality to many situations. if we started to provide impls for all common usecases the api would be too big and you would have a hard time finding what you needed anyways.
-IgorOn 8/13/06, Predrag Spasojevic [EMAIL PROTECTED] wrote:
Why it isn't FeedbackPanel's default behavior?

I think thatthe common useis one FeedbackPanel per form,not per page
On 8/13/06, Igor Vaynberg [EMAIL PROTECTED]
 wrote:

final Form form=.new FeedbackPanel(foo, new IFeedbackMessageFilter() { boolean accept(FeedbackMessage message) { // messages reported on the session have a null reporter

 if ( message.getreporter()!=null) { // only accept messages coming from the children of the form return form.contains(message.getreporter(), true); }
 return false;  }}-Igor

On 8/13/06, Predrag Spasojevic 

[EMAIL PROTECTED] wrote: 




Hi,

I have a page with 2 panels. Each panel has its own form and feedback panel. When any validator fails the same messages are displayed on both feedback panels.

I have looked into wicket source code and in the class FeedbackMessageModel there is a method for getting feedback messages:

public final Object onGetObject(final Component component){if (messages == null){// Get filtered messages from page where component livesList pageMessages = component.getPage().getFeedbackMessages() 
.messages(filter);


It looks like when validator fails it adds feedback message to a page. And when feedback panel is displayed it calls page to get messages. I suppose that is the reason why both feedback panels shows the same messages. 


Is there any wayto havetwo feedback panels on one page that are not showing the same messages?-- Regards,Predrag Spasojevic 
-Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier 
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo

http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list

Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user 
-Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo

http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list

Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user
-- Pozdrav,Predrag Spasojevic 

-Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list
Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] DatePicker with SimpleDateFormat

2006-08-13 Thread kurt heston
Johan,

Thanks for the help.  Settled on this:

  final DateConverter conv = new DateConverter();
  final SimpleDateFormat sdf = new SimpleDateFormat(MM/yy);
  conv.setDateFormat(Locale.getDefault(), sdf);
  TextField exp = new RequiredTextField(expiration) {
public IConverter getConverter() {
  return new SimpleConverterAdapter() {
public String toString(Object value) {
  return value != null ? sdf.format(value) : null;
}

public Object toObject(String value) {
  try {
return sdf.parse(value.toString());
  } catch (Exception e) {
throw new ConversionException(' + value
+ ' is not a valid Date);
  }
}
  };
}
  };
  DatePicker picker = new DatePicker(expirationDatePicker, exp);
  picker.setDateConverter(conv);
  add(exp);
  add(picker);



Johan Compagner wrote:
 That way it is only used to format the string to the screen.
 The dateformatter is used to get the format out and javascript 
 dateformat is generated based on that

 That dateformatter should also be used by the textfield itself to 
 handle the formatting both ways.
 So override the getConverter() of the exp textfield and return als 
 your converter (that has to work 2 ways then!)

 johan


 On 8/11/06, *kurt heston * [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED] wrote:

 I'm trying to create a field that allows filling in of a credit card
 expiration date using 1.2.  What did I miss?

 Code:

   TextField exp = new RequiredTextField(expiration);
   DatePicker picker = new DatePicker(expirationDatePicker,
 exp);
   DateConverter conv = new DateConverter();
   conv.setDateFormat(Locale.getDefault(),new
 SimpleDateFormat(MM/));
   picker.setDateConverter(conv);
   add(exp);
   add(picker);

 Exception:

 wicket.util.convert.ConversionException: Cannot parse '03/2006'
 using format [EMAIL PROTECTED]
  at
 wicket.util.convert.converters.AbstractConverter.newConversionException
 (AbstractConverter.java:72)
  ...

 -
 Using Tomcat but need to do more? Need to support web services,
 security?
 Get stuff done quickly with pre-integrated technology to make your
 job easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache
 Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 mailto:Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user


 

 -
 Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 

 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user
   

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user