How to handle RuntimeException Ajax?

2008-03-14 Thread Gin Yeah
I have a page with AjaxFallbackButton on it.  On RuntimeException, I want to
show some error message in the feedbackpanel on the page.  For testing, I
use this one page and one form and the following code in my WebApplication
to try:

@Override public RequestCycle newRequestCycle(Request request, Response
response) {
return new WebRequestCycle(this, (WebRequest) request, (WebResponse)
response) {
@Override public Page onRuntimeException(Page page,
RuntimeException e) {
Form f = (Form) page.get(form);
f.error(An error (see below) has occured, we cannot go
on.);
f.error(e.getCause() == null ? e.getMessage() : e.getCause
().getMessage());
return page;
}
};
}

First, is this the correct way to handle RuntimeException in general.  How
about Ajax?  How can I Ajax update my page without sending back a new page?

Second, this only works with js disable.  With js enable, the FeedbackPanel
is empty.  What is wrong?


Re: Configuring database connection pool with Jetty in QuickStart

2008-03-14 Thread Gin Yeah
Are you running your app using Quickstart's test.Start?  That one does not
have Jetty-Plus and does not load your jetty-env.xml and you will get the
error you are seeing.  Use 'mvn jetty:run' instead.  It does Jetty-Plus and
loads jetty-env.xml from WEBINF all without any additional config.

If you want to use Quickstart's test.Start, you need to add this to your
jetty-env.xml:

  Array id=plusConfig type=java.lang.String
Itemorg.mortbay.jetty.webapp.WebInfConfiguration/Item
Itemorg.mortbay.jetty.plus.webapp.EnvConfiguration/Item
Itemorg.mortbay.jetty.plus.webapp.Configuration/Item
Itemorg.mortbay.jetty.webapp.JettyWebXmlConfiguration/Item
Itemorg.mortbay.jetty.webapp.TagLibConfiguration/Item
  /Array

  Set name=configurationClassesRef id=plusConfig/Ref/Set

and add a few lines to Start.java:

WebAppContext bb = new WebAppContext();
bb.setServer(server);
bb.setContextPath(/);
bb.setWar(src/main/webapp);
+   File configFile = new File(bb.getWar() + /WEB-INF/jetty-env.xml);
+   if (configFile.exists()) {
+   XmlConfiguration configuration = new XmlConfiguration(
+   new FileInputStream(configFile));
+   configuration.configure(bb);
+   }

I hope this helps.

On Fri, Mar 14, 2008 at 9:45 AM, Kevin Murphy [EMAIL PROTECTED]
wrote:

 I'm having difficulty adding database functionality to my Wicket
 QuickStart app by configuring a JNDI data source in Jetty.

 I've added jetty-naming, jetty-plus, mysql-connector-java, and
 commons-dbcp to the POM.

 I have this in WEB-INF/web.xml:

resource-ref
descriptionMy DataSource Reference/description
res-ref-namejdbc/MySqlPool/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
/resource-ref

 and this in WEB-INF/jetty-env.xml:

New id=MySqlPool class=org.mortbay.jetty.plus.naming.Resource
Argjdbc/MySqlPool/Arg
Arg
New class=org.apache.commons.dbcp.BasicDataSource
Set name=driverClassNamecom.mysql.jdbc.Driver/Set
Set name=urljdbc:mysql://localhost/mysql/Set
Set name=usernamejoe/Set
Set name=passwordcool/Set
/New
/Arg
/New


 I'm now stymied by the following error when my application runs
 '(DataSource) ic.lookup(java:comp/env/jdbc/MySqlPool)':

 javax.naming.NameNotFoundException; remaining name 'env/jdbc/MySqlPool'

 Thanks for any quick tips.

 -Kevin


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Default Focus Behavior?

2008-03-10 Thread Gin Yeah
Can we have a faq in the wiki enumerating all the possible scenarios and
solutions?

On Sun, Mar 9, 2008 at 11:51 PM, Igor Vaynberg [EMAIL PROTECTED]
wrote:

 On Sun, Mar 9, 2008 at 1:37 PM, James Carman [EMAIL PROTECTED]
 wrote:
  On 3/9/08, djo.mos [EMAIL PROTECTED] wrote:
   
   
This simply looks great ! I think this should make it into the core
 Wicket
 behaviors as the componenet focus is quite useful.
   
 
   Me too!  That's why I submitted:
 
   https://issues.apache.org/jira/browse/WICKET-1404
 
   I was pretty surprised something didn't exist for this already.  I
   don't mean any offense by that at all.  It's just that it seems like
   every time I think to myself there should be a way to do x with
   Wicket, there's already something for that!  This Wicket stuff is
   pretty cool!

 i dont think something like this should go into core. it seems pretty
 clear from this thread that there are very many ways to do this and
 each project will use their own. what you have proposed seems trivial
 to construct, so for projects that want to use it its a nobrainer. i
 think things that go into core should at least satisfy the majority of
 common usecases or be at least of moderate complexity. if we start
 putting every trivial thing like this into core we will end up with a
 huge surface area - at which point you have to start thinking of the
 find/build tradeoff - is it easier to find something that does what i
 want in core or simply roll my own which will only take fifteen
 minutes...

 now, for example, if this behavior was meant to be attached to a form
 and would set focus on the first component that is not valid...

 -igor



 
 
 
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
 
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Markup Rendering issues

2008-03-05 Thread Gin Yeah
-- Wicket tags
This is all time high FAQ :)  Do
getMarkupSettings().setStripWicketTags(true) in the init() of your
application class. (I still wonder why it is not the default.)

Don't explicitly turn off wicket tag, unless you have real good reason to.
This setting is automatically determined by the development/deployment
configuration.  When run in 'deployment' mode, wicket tags are stripped.  In
development mode, they are not to help debugging.

You control the development/deployment mode in web.xml:

init-param
param-nameconfiguration/param-name
param-valuedevelopment or deployment/param-value
init-param




On Wed, Mar 5, 2008 at 8:01 AM, Erik van Oosten [EMAIL PROTECTED]
wrote:

 Hi Jörn,

 -- Ids
 This one of the exceptions in just taking existing HTML. Our designers
 also use jquery and solved the problem by using classes. Something like:
 class=idCommentForm. For jquery it doesn't matter much, and by
 including id in the class name the intend is still clear.

 -- Wicket tags
 This is all time high FAQ :)  Do
 getMarkupSettings().setStripWicketTags(true) in the init() of your
 application class. (I still wonder why it is not the default.)

 -- Url handling
 There is a lot to say on this topic (and a lot has been said). Its best
 to search the lists and ask again with more specific questions. Mounting
 bookmarkable pages could indeed alleviate your problem. Mounting is
 typically done in the init() method of your application.

 Regards,
Erik.

 --
 Erik van Oosten
 http://www.day-to-day-stuff.blogspot.com/



 Jörn Zaefferer wrote:
  Hi,
 
  I've got a few rendering issues with wicket:
 
  I'd like to use IDs to select elements via jQuery on the clientside,
  eg. a form with wicket:id=commentForm should also have
  id=commentForm. Wicket generates id=commentForm4 or
  id=commentForm5 - I've got no idea where that number comes from.
  Specifying an id-attribute doesn't help, it gets overwritten. So far I
  was unable to select elements via jQuery using the wicket:id
  attribute, most likely the namespace and colon kills the attribute
  selector.
 
  In other words: How can I instruct Wicket to render and static
 id-attribute?
 
  Another, similar issue: Wicket renders stuff like wicket:child and
  wicket:panel into the HTML markup. While the browser ignores it, I
  don't know why Wicket doesn't filter out those instructional markups
  instead. Is that configurable?
 
  All in all, I'd like to use Wicket without making it obvious to
  someone reading the markup that Wicket is used to generate it. So not
  tags and attributes with the wicket namespace should appear in the
  markup - I'm not using Wickets Ajax stuff anyway.
  For completeness, the action attribute of my form must be modified,
  too. Currently the contain something like
  ../?wicket:interface=:1:loginForm::IFormSubmitListener::. How can I
  replace that, eg. mount a static URL for that form?
 
  I guess most of this is easy to resolve and I just don't know enough
  about Wicket, yet. Pointers or solutions are both highly appreciated.
 
  Thanks
  Jörn Zaefferer
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Why PopupCloseLink doesn't close my popup?

2008-03-05 Thread Gin Yeah
There is no Javascript generated at the browser end at all:

a href=?wicket:interface=Salumonunu:0:closeLink::ILinkListener::
wicket:id=closeLinkClose/a

The popup is open with this:

Java:

PopupSettings ps = new PopupSettings()
.setHeight(200)
.setWidth(100)
.setTop(50)
.setLeft(200)
.setWindowName(Salumonunu);

add(new PageLink(popupPageLink, AnotherPage.class
).setPopupSettings(ps));

html:

lia wicket:id=popupPageLinkPopup another page/a/li


AnotherPage.java:

public class AnotherPage extends ExtendFromBasePage {
private static final long serialVersionUID = 1L;
public AnotherPage() {
add(new PopupCloseLink(closeLink) {
private static final long serialVersionUID = 1L;
@Override public void onClick() {
System.out.println(HERE HERE HERE);
}
});
}



AnotherPage.html:

html
a wicket:id=closeLinkClose/a
/html



The generated code in the browser:

a href=?wicket:interface=Salumonunu:0:closeLink::ILinkListener::
wicket:id=closeLinkClose/a





On Wed, Mar 5, 2008 at 5:37 PM, Igor Vaynberg [EMAIL PROTECTED]
wrote:

 any javascript errors in your browser? is the popupcloselink inside
 the popup window - which is another window that is NOT a modal
 window...?

 -igor


 On Wed, Mar 5, 2008 at 4:28 PM, MYoung [EMAIL PROTECTED] wrote:
 
   I must be doing it wrong.  I have this in my  popup template:
 
   lt;a wicket:id=closeMegt;Closelt;/agt;
 
 
   In java:
 
   add(new PopupCloseLink(closeMe) {
   @Override public void onClick() {
 // HERE HERE
  }
   });
 
   onClick() is called but the popup window stays.
 
   Another question, how to get notify  when the popup is close by
 clicking on
   the close box on the browser window's title bar?
   --
   View this message in context:
 http://www.nabble.com/Why-PopupCloseLink-doesn%27t-close-my-popup--tp15863742p15863742.html
   Sent from the Wicket - User mailing list archive at Nabble.com.
 
 
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
 
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Why PopupCloseLink doesn't close my popup?

2008-03-05 Thread Gin Yeah
How to see Javascript error?  Something to turn on in the browser?

On Wed, Mar 5, 2008 at 10:22 PM, Igor Vaynberg [EMAIL PROTECTED]
wrote:

 ok, but do you see javascript errors after you press the link? because
 that outputs a window.close() javascript to close the window...

 -igor


 On Wed, Mar 5, 2008 at 9:03 PM, Gin Yeah [EMAIL PROTECTED] wrote:
  There is no Javascript generated at the browser end at all:
 
   a href=?wicket:interface=Salumonunu:0:closeLink::ILinkListener::
   wicket:id=closeLinkClose/a
 
   The popup is open with this:
 
   Java:
 
  PopupSettings ps = new PopupSettings()
  .setHeight(200)
  .setWidth(100)
  .setTop(50)
  .setLeft(200)
  .setWindowName(Salumonunu);
 
  add(new PageLink(popupPageLink, AnotherPage.class
   ).setPopupSettings(ps));
 
   html:
 
  lia wicket:id=popupPageLinkPopup another page/a/li
 
 
   AnotherPage.java:
 
   public class AnotherPage extends ExtendFromBasePage {
  private static final long serialVersionUID = 1L;
  public AnotherPage() {
  add(new PopupCloseLink(closeLink) {
  private static final long serialVersionUID = 1L;
  @Override public void onClick() {
  System.out.println(HERE HERE HERE);
  }
  });
  }
 
 
 
   AnotherPage.html:
 
   html
  a wicket:id=closeLinkClose/a
   /html
 
 
 
   The generated code in the browser:
 
   a href=?wicket:interface=Salumonunu:0:closeLink::ILinkListener::
   wicket:id=closeLinkClose/a
 
 
 
 
 
   On Wed, Mar 5, 2008 at 5:37 PM, Igor Vaynberg [EMAIL PROTECTED]
   wrote:
 
 
 
any javascript errors in your browser? is the popupcloselink inside
the popup window - which is another window that is NOT a modal
window...?
   
-igor
   
   
On Wed, Mar 5, 2008 at 4:28 PM, MYoung [EMAIL PROTECTED] wrote:

  I must be doing it wrong.  I have this in my  popup template:

  lt;a wicket:id=closeMegt;Closelt;/agt;


  In java:

  add(new PopupCloseLink(closeMe) {
  @Override public void onClick() {
// HERE HERE
 }
  });

  onClick() is called but the popup window stays.

  Another question, how to get notify  when the popup is close by
clicking on
  the close box on the browser window's title bar?
  --
  View this message in context:
   
 http://www.nabble.com/Why-PopupCloseLink-doesn%27t-close-my-popup--tp15863742p15863742.html
  Sent from the Wicket - User mailing list archive at Nabble.com.



  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]


   
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
   
   
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Why PopupCloseLink doesn't close my popup?

2008-03-05 Thread Gin Yeah
Ok, I got it.  I need to call super.onClick().  Thanks!

On Wed, Mar 5, 2008 at 10:22 PM, Igor Vaynberg [EMAIL PROTECTED]
wrote:

 ok, but do you see javascript errors after you press the link? because
 that outputs a window.close() javascript to close the window...

 -igor


 On Wed, Mar 5, 2008 at 9:03 PM, Gin Yeah [EMAIL PROTECTED] wrote:
  There is no Javascript generated at the browser end at all:
 
   a href=?wicket:interface=Salumonunu:0:closeLink::ILinkListener::
   wicket:id=closeLinkClose/a
 
   The popup is open with this:
 
   Java:
 
  PopupSettings ps = new PopupSettings()
  .setHeight(200)
  .setWidth(100)
  .setTop(50)
  .setLeft(200)
  .setWindowName(Salumonunu);
 
  add(new PageLink(popupPageLink, AnotherPage.class
   ).setPopupSettings(ps));
 
   html:
 
  lia wicket:id=popupPageLinkPopup another page/a/li
 
 
   AnotherPage.java:
 
   public class AnotherPage extends ExtendFromBasePage {
  private static final long serialVersionUID = 1L;
  public AnotherPage() {
  add(new PopupCloseLink(closeLink) {
  private static final long serialVersionUID = 1L;
  @Override public void onClick() {
  System.out.println(HERE HERE HERE);
  }
  });
  }
 
 
 
   AnotherPage.html:
 
   html
  a wicket:id=closeLinkClose/a
   /html
 
 
 
   The generated code in the browser:
 
   a href=?wicket:interface=Salumonunu:0:closeLink::ILinkListener::
   wicket:id=closeLinkClose/a
 
 
 
 
 
   On Wed, Mar 5, 2008 at 5:37 PM, Igor Vaynberg [EMAIL PROTECTED]
   wrote:
 
 
 
any javascript errors in your browser? is the popupcloselink inside
the popup window - which is another window that is NOT a modal
window...?
   
-igor
   
   
On Wed, Mar 5, 2008 at 4:28 PM, MYoung [EMAIL PROTECTED] wrote:

  I must be doing it wrong.  I have this in my  popup template:

  lt;a wicket:id=closeMegt;Closelt;/agt;


  In java:

  add(new PopupCloseLink(closeMe) {
  @Override public void onClick() {
// HERE HERE
 }
  });

  onClick() is called but the popup window stays.

  Another question, how to get notify  when the popup is close by
clicking on
  the close box on the browser window's title bar?
  --
  View this message in context:
   
 http://www.nabble.com/Why-PopupCloseLink-doesn%27t-close-my-popup--tp15863742p15863742.html
  Sent from the Wicket - User mailing list archive at Nabble.com.



  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]


   
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
   
   
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]