wood burning stoves*
The moose likes Other Application Frameworks and the fly likes About Wicket's DatePicker Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "About Wicket Watch "About Wicket New topic
Author

About Wicket's DatePicker

kayanaat sidiqui
Ranch Hand

Joined: Sep 04, 2008
Posts: 122
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

Joined: Sep 04, 2008
Posts: 122
Please help me you people.
Tim Squires
Greenhorn

Joined: Dec 22, 2008
Posts: 1
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: About Wicket's DatePicker
 
Similar Threads
Read data to the xml file from the database?
!DOCTYPE and function refreshIt() not working together
!DOCTYPE and function refreshIt() not working together
Head First Servlet and JSP - MVC download JAR example
jsp+javamail. how to get the same session with url connection?