This week's book giveaways are in the AI and JavaScript forums.
We're giving away four copies each of GANs in Action and WebAssembly in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

About Wicket's DatePicker

 
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
Well i am trying to use datepicker but i am getting following error-
WicketMessage: Can't instantiate page using constructor public myapp.validateWicket.ValidateWicket()Root cause:java.lang.ClassNotFoundException: org.joda.time.DateTime at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1332)..... and so on..
please help me out. Main code is as follows--

ValidateWicket.java--
package myapp.validateWicket;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.wicket.extensions.yui.calendar.DatePicker;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.Model;
import org.apache.wicket.util.convert.IConverter;
import org.apache.wicket.util.convert.converters.DateConverter;

public class ValidateWicket extends WebPage
{
private Model model;
private Model myDateModel;

public ValidateWicket()
{
FeedbackPanel feedback = new FeedbackPanel("feedyMesaasges");
add(feedback);
Form form = new Form("f")
{
private static final long serialVersionUID = 1L;

protected void onSubmit()
{
String symbol = (String) model.getObject();
Date curDate = (Date)myDateModel.getObject();

int stock_val = symbol.hashCode()%100+ curDate.toString().hashCode();
Result result = new Result(stock_val, symbol, curDate.toString());
setResponsePage(result);
}
};

model = new Model();
List<String> listOfSymbols = new ArrayList<String>();
listOfSymbols.add("HCLT");
listOfSymbols.add("HCLComnet");
DropDownChoice symbol = new DropDownChoice("sym",model,listOfSymbols);
symbol.setRequired(true);
form.add(symbol);

myDateModel = new Model();
TextField dateField = new TextField("mydate", myDateModel, Date.class);
dateField.setRequired(true);
dateField.add(new DatePicker());
form.add(dateField);

add(form);
}
}

ValidateWicket.html--
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:wicket="http://wicket.apache.org">
<head>
<title>Validate</title>
<style type="text/css">
H1 {text-align:center;
color:blue}
</style>
</head>
<body>
<span wicket:id="feedyMesaasges"/>

<form wicket:id="f">
<h1>
Enter the symbol:

<select wicket:id= "sym">
<option>HCLT</option>
<option>HCLComnet</option>
</select>
on <input type="text" wicket:id="mydate" />
<input type="submit" value="OK"/>
</h1>
</form>
</body>
</html>

Result.html--
package myapp.validateWicket;

import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;

public class Result extends WebPage
{
public Result(int stockvalue, String theSymbol, String date)
{
add(new Label("tsym", theSymbol));
add(new Label("v", Integer.toString(stockvalue)));
add(new Label("rDate", date));
}
}


Result.html--
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:wicket="http://wicket.apache.org">
<head>
<title>Validate Result</title>
<style type="text/css">
h2{ color:blue;
text-align:center
}
</style>
</head>
<body>
<h2>Stock Value Of <span wicket:id="tsym"> </span> <br>
On <span wicket:id="rDate"> </span>
is: <span wicket:id="v">100</span></h2>
</body>
</html>
 
kayanaat sidiqui
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help me you people.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

It may be a bit late and hopfully you've solved this already but...

You need the joda libraries. joda-time-1.5.2.jar is the version I use with Wicket 1.4

Download from here: http://sourceforge.net/project/showfiles.php?group_id=97367&package_id=104212

You could use maven to compile and it would get the libraries for you.

Good luck,
Tim
 
Would you turn that thing down? I'm controlling a mind here! Look ... look at the tiny ad ...
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!