How to create wicket form with parameters - forms

default form in wicket looks like
private class TournamentWebForm extends Form<Void> {
private static final long serialVersionUID = 1L;
public TournamentWebForm() {
super("tournamentForm");
// add componets ...
}
and then page looks like (important is number behind ?)
http://localhost:8080/tournament-system-web/home?19
but on the internet I found this page which is written in wicket too:
http://jizdenky.studentagency.cz/?wicket:interface=wicket-0:3:3:::
and when I search for ticket their form looks like:
http://jizdenky.studentagency.cz/Booking/from/BRNO/to/PRAHA/tarif/REGULAR/departure/20121213/retdep/20121213/return/false/ropen/false/credit/false/class/2.5#search-results
how I can create this form ?
UPDATE:
It look like that what page is return depends on last parameter in this case: #search-results how I can implement these feature ?

You don 't.
What you see on the link above is the URL Wicket prior to version 1.5 created for statefull pages.
The secound URL is that of a BookmarkablePage with URL Parameters. See mounting pages
Follow the procedure in the link and pass the page parameters to your form via standard java options.

Have you read about page parameters? You can find out something by visiting Apache Wicket's home page, and then following Reference guide, Wicket reference, Pages.
Enjoy?

Related

How to retrieve the selectors from the page URL when a particular page is activated using the side kick. What is the right approach to achieve this?

I am writing a Preprocessor in AEM. This is a class that runs before a page is activated. When a page is activated I am supposed to activate another page manually using com.day.cq.replication.Replicator Service.
But I am heavily dependent on the page's full path including selectors.
My page is http://localhost:4502/content/xxx/americas/US/en/shop/products.12345678.html
In my Preprocessor when I use
#Override
public void preprocess(ReplicationAction replicationAction, ReplicationOptions replicationOptions) throws ReplicationException {
String payloadPath = replicationAction.getPath();
The variable payload path holds the value /content/xxx/americas/US/en/shop/products
As you can see it does not show the selectors and extension.
How can I get the full path in my Preprocessor. If this were a servlet I would extract the path from SlingHttpRequest. But here the case is different.
I need these selectors and extension as depending on their value my task is to activate other pages.
How do I achieve this in AEM 6.2 ?
I was referring to this questions- Link

Laravel HTML form on multiple pages

How to make a form across multiple pages in Laravel like here
http://www.html-form-guide.com/php-form/php-order-form.html
I have a lot of input fields and i can't find any info on Laravel multiple pages forms. If someone has any good website where to read about it and to see how it is done?
Any help is appreciated.
You can achieve through session of laravel, you can set your values with key and value:
public function step1(Request $request)
{
$request->session()->put('key', 'value');
}
for further information see this link
Other way is make in your client side, with localStorage is cleaner for me, you can use Single Page Aplication and send the data when you're at the final step.
localStorage works seemed to PHP session, check out this link :
you can set the item thought steps, like this:
localStorage.setItem("key", "value");
and retrieve the information like this:
localStorage.getItem("key");
The Single Page application lets you render diferent pages in a route and it's not neccesary to reload the page, you can check out Angular or Ember.js Framework.
If you are looking to do this on server side and not with javascript framework here is what you can approach.
You can make use of Laravel session to store intermediate data between the pages and then pull data out of session to insert into database at the final step.
Detailed Tutorial
https://www.5balloons.info/multi-page-step-form-in-laravel-with-validation/

How to change URL within GWT app

I'm working with a gwt multipage project which I used these code to switch between html pages, for this case switching from index.html to signup.html page:
public static native void fireChangePage(String url)/*-{
$wnd.location.href = url;
}-*/;
public void goToSignUpPage(boolean isDeployed) {
String url = (isDeployed == true ? "signup.html" : "signup.html?gwt.codesvr=127.0.0.1:9997");
fireChangePage(url);
}
I'm getting error 404 when fireChangePage is called from the EntryPoint for the index.html.
Manually changing the url on the browser say: index.html?gwt.codesvr=127.0.0.1:9997 to signup.html?gwt.codesvr=127.0.0.1:9997 works, so I can say that the problem is with the native function fireChangePage.
What could be the problem with the native function? Or is there a better approach than this?
If it's GWT project, you should switch between places (using PlaceController) instead of switching between HTML pages . Anyway, if you have to do so, I'd recommend to use com.google.gwt.user.client.Window.Location class instead (it's provided by framework and works fine).
Try adding slash to the path of the document, i.e. /signup.html.

Create servlet in Wicket to pass input as a parameter on submit to the web page

I'm new to Wicket and have made an application using some tutorials.
How do I create a servlet and pass on the input from that to a web page without database transactions?
I'm assuming you are trying redirect to a Wicket page (parameterized) from outside the Wicket application.
You can do this by using one of the URL encoding strategies (BookmarkablePageRequestTargetUrlCodingStrategy, QueryStringUrlCodingStrategy, ...) which will give that page a clean URL which can be referenced easily. Or you can put a BookmarkablePageLink in your web application somewhere, copy the link that it generates and use it to redirect to.
You can reference that link anywhere you wish passing parameters to it using the normal ?par1=val&par2=val system.
To read these parameters in your page you will need to define your page constructor like so:
...
public MyPage(final PageParameters parameters) {
final String par1 = parameters.getString("par1");
final String par2 = parameters.getString("par2");
}
...

GWT. Set url without submit

Can i change url(set parameter) without submit?
I found this method
http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/com/google/gwt/user/client/Window.Location.html#replace%28java.lang.String%29
but it submit page. All GWT state will be lost.
If you want to change something that is not in the hash, for example you want to change a parameter in the URL, you can do it like this!
private void someMethod() {
String newURL = Window.Location.createUrlBuilder().setParameter("someParam", "someValue").buildString();
updateURLWithoutReloading(newURL);
}
private static native void updateURLWithoutReloading(String newUrl) /*-{
$wnd.history.pushState(newUrl, "", newUrl);
}-*/;
Then you could register a function that handles the user using the back and forward browser buttons as demonstrated here.
Why are you trying to do this? Generally speaking, GWT apps don't change pages - thus they are normally SPAs (single page applications)
When you load a new page from a server, you will lose the state on that page. You can change the hash part of the URL as that won't return to the server, like this:
String newURL = Window.Location.createUrlBuilder().setHash("newhash").buildString();
Window.Location.replace(newURL);
However, if you're going to do this, I would recommend taking a look at GWT's MVP framework, which has built in support for managing locations using hash tokens.
http://code.google.com/webtoolkit/doc/latest/DevGuideMvpActivitiesAndPlaces.html
$wnd.history.pushState(newUrl, "", newUrl);
Works nicely in HTML5-browsers. Not in IE8 or IE9!