How to send raw data to Printer with Java Applet - html

Thanks in Advance.
I am new to Java Applet, i will tell my requirement and hope will get solution.
This is my Html Coding
<html>
<head><title>Test Print Via Applet</title></head>
<body>
<div id="text_to_print">
This is my Office<br />
This is my Office Address<br />
<center>Header of the Receipt</center><br />
1. Product 1 100.00<br />
2. Product 2 200.00<br />
------<br />
TOTAL 300.00<br />
------<br />
Thanks for the Purchase.
</div>
<input type="button" value="Print Directly to the Dot Matrix by using Applet" />
</body>
</html>
Now, if anyone click the Button the contend inside the "text_to_print" div should print in the dot matrix printer directly without printer dialog.
One of my Friend told me that, this is possible if we use Applet. I search regard this on internet, but still I couldn't get the right solution for me need.
Please help me to solve the issue.
Once again thanks in advance.

https://code.google.com/p/jzebra/
Provides a a great interface to talk to the printer through javascript. Eventually the java applet does the job.

Related

Hyperlink doesn't redirect to View from same project

I want to redirect from one view to another view in the same project/solution. There are 3 hyperlinks in here and I am unable to redirect to either of them. Can someone help me with this?
<body>
<div>
<br />
<span style="margin-left:20%"></span>
Forgot Login ID?
<br />
<br /><span style="margin-left:20%"></span>
Forgot Password?
<br />
<br />
<span style="margin-left:20%"></span>
Need to register your Corporation?
Click here
</div>
</body>
When I try to click on the hyperlink, I am getting the following HTTP 404 Not Found error. I tried many approaches, but none seem to work.
I tried different approaches to linking to the controller. But, I failed to get any positive output.
Asp.net does not have phyiscal routing - you do not want to link to physical files. Instead it resolves its routes after a pattern. The default pattern, unless specified otherwise is "{controller}/{action}/{id}".
So assuming your controller is called CorporationController, and your action method is called "ForgotPassword", the hyperlink would be constructed with:
#Html.ActionLink("Forgot Password", "ForgotPassword", "Corporation")
You might want to read some basic documentation about Asp.Net Mvc first.

How to make a link clickable only when a checkbox is checked

I have no formal training in web development and created my website entirely from studying the code from other sites and finding out things from the internet. So my query might be trivial for many of you established web developers.
I've created this website: www.justnoktours.com which is a booking website for bicycle tours in Bangkok. It's very basic...clients read about the tour and then "book the tour"
I now need them to first check a checkbox before the "Book this tour" button becomes clickable.
I've attached a picture (with the code) of where this needs to be and also what needs to happen.
If anyone can help me, I'd really appreciate if you could give me the exact code so that I can just cut and paste. website page
You can use following code:
<label for="chkTermsAndConditions">
<input name="chkTermsAndConditions" id="chkTermsAndConditions" type="checkbox" onchange="document.getElementById('btnBookTour').disabled = !this.checked;" />
I have read and agree to the Booking conditions
</label>
<input type="button" name="btnBookTour" disabled id="btnBookTour" value="Book this tour" />

The correct syntax of new line in html

I have seen so many different ways to break row in html.
I'm using <br /> and it works fine.
What is the correct use of <br /> as for now?
<br> is correct way to implement for line break if you are using for address and paragraph purpose.

Html Page Break not working

Trying to set a page break in the page I'm working on but in the print preview I'm still seeing things on the page that aren't supposed to be there. Can't figure out why this isn't working.
In my css style:
.applicant-break hr {page-break-after:always;}
In my ASP.NET code...partial view of code the start tags are there:
<b>Resume</b>
<br />
<asp:Literal runat="server" ID="litResume"></asp:Literal>
<br />
<br />
<hr class="applicant-break" />
</ItemTemplate>
</asp:Repeater>
</asp:Panel>
Any help would be appreciated.
Your css needs to be
hr.applicant-break {page-break-after:always;}
EDIT:
Doing some reading on the W3Schools website, it seems this css property is meant for table elements
"Set the page-breaking behavior to always break after a table element"
EDIT:
Doing some more reading, it seems browsers do support more than the table element, however some browsers have trouble with it on HR and BR tags (Reading here)
try putting a div after the hr like so
<hr />
<div class="applicant-break"></div>
and changing your CSS to
div.applicant-break {page-break-after:always;}
So apparently I'm silly, I was trying to trust the print preview of Chrome instead of just actually printing it myself, upon printing it I see that the page break does in fact work, thanks for your assistance m.t! :)
So fair warning to anyone else reading this, while it is useful it doesn't always give you an accurate look at your print job all the time.

ZK Grid / Listbox Using List of JSONObject

anybody can help me using zk (zkoss) framework? I am new in this framework. I want to make a grid / listbox using list of jsonobject. I found no examples that can help me using list of jsonobject to create grid / listbox. I want to create simple listbox like this:
<?page title="Table of Users" contentType="text/html;charset=UTF-8"?>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" ?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<zk>
<window id="windowUsers" width="500px" apply="${userController}" viewModel="#id('vm')">
<groupbox mold="3d">
<caption label="Table of Users" />
<listbox model="#load(vm.listUser)" width="400px">
<listhead>
<listheader label="User Id"/>
<listheader label="Name"/>
<listheader label="Address"/>
<listheader label="Phone"/>
</listhead>
<template name="model" var="list">
<listitem>
<listcell label="#load(list.id)" />
<listcell label="#load(list.name)" />
<listcell label="#load(list.address)" />
<listcell label="#load(list.phone)" />
</listitem>
</template>
</listbox>
</groupbox>
</window>
thank's in advance.
ZK is typically used as serverside pages which are evaluated by java on the server. So the example above typically renders a list of java objects on the server which is output as interactive dhtml to the browser. The diagram to explain is here.
With that in mind one would not have a list of json objects on the server; you would parse them as java objects on the server and render the java objects into the page. ZK does have "client side fusion" to be able to interact with their browser side rendering engine. That however is more of an advanced feature; you should be able to write an entire system using ZK without doing any browserside programming. Here is a demo of that but I have never used myself
(warning: shameless plug) Checkout my demo app which has a simple page which renders and edits a list of objects just like your example.
thank you for the answer, it taught me enough about ZK. I've got the way to get list of JSON object shown in listbox like this:
<listitem forEach="${userController.list}">
<listcell label="${each.id}" />
<listcell label="${each.name}" />
<listcell label="${each.address}" />
<listcell label="${each.phone}" />
</listitem>