Executing java inside java example program

Executing java inside java: MyJava.java class MyJava{ public static void main(String[] args){ Javadomain jd = new Javadomain(); jd.main(null); } } Now we are going to execute this below java program(Javadomain.java) inside the above the java program(MyJava.java), Javadomain.java: class Javadomain{ public static void main(String[] args){ System.out.println("I am executed successfully, Java inside java success"); } } Output: I am executed successfully, Java

113 total views, no views today

» Read more

Displaying Tamil Characters in java console(Eclipse)

Displaying Tamil characters in Java: Program: package in.javadomain; public class DisplayTamilCharactersInConsole { public static void main(String[] args) { String amma = "அம்மா "; System.out.println("Amma in Tamil : " + amma); } } If you save the above program in eclipse it will ask like this, Save it as UTF-8 Now Run the program to see the below output, Output: Amma

466 total views, no views today

» Read more

How to continue program after exception in java

How to continue program after exception in java ? The below program won’t continue the program execution after the exception: package in.javadomain; public class RunAfterException { public static void main(String[] args) { int firstVal = 10; int secondVal = 12; try { String[] mobileCompanies = { "Nokia", "Samsung", "sony" }; String anyOneCompany = mobileCompanies[3]; System.out.println("Total is " +(firstVal + secondVal));

176 total views, no views today

» Read more

Parse div using jsoup in java

Parse h2 tag inside div using Jsoup: package in.javadomain; import java.io.IOException; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.select.Elements; public class DivParseJsoup { /** * Main method to parse h2 tag inside div using jsoup * * @param args */ public static void main(String[] args) { Document doc; try { doc = Jsoup.connect("http://www.javadomain.in").get(); // h2 is inside div so getting div first

204 total views, no views today

» Read more

Parsing Title of the Website using Jsoup

Howdy, You know you can parse any part of the website using the powerful open source tool called “Jsoup”. Jsoup download link: Jsoup Download Link Example Program: package in.javadomain; import java.io.IOException; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; public class TitleParseJsoup { /** * Main Method to parse title of the website using jsoup * * @param args */ public static void main(String[]

140 total views, no views today

» Read more

Session Handling in Jsf Example

JsfSession.java: package com.javadomain.in; import javax.faces.FacesException; import javax.faces.application.Application; import javax.faces.application.ViewHandler; import javax.faces.component.UIViewRoot; import javax.faces.context.ExternalContext; import javax.faces.context.FacesContext; import javax.faces.event.PhaseEvent; import javax.faces.event.PhaseId; import javax.faces.event.PhaseListener; import javax.servlet.http.HttpSession; public class JsfSession implements PhaseListener { @Override public void afterPhase(PhaseEvent event) { //Do anything } @Override public void beforePhase(PhaseEvent event) { FacesContext context = event.getFacesContext(); ExternalContext ext = context.getExternalContext(); HttpSession session = (HttpSession) ext.getSession(false); boolean newSession =

453 total views, no views today

» Read more

clicked value passing from one jsp to another jsp

Create the first jsp named main.jsp and paste the below code,   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <html> <head> <title>agn</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <meta name="GENERATOR" content="Rational Application Developer"> </head> <body> <!–<iframe src="http://www.w3schools.com"> <p>Your browser does not support iframes.</p> </iframe> –> <a href="/ToCapitalLetter?a=javadomain">click me</a> </body> </html> Create a servlet named ToCapitalLetter.java and

198 total views, no views today

» Read more

Iceface datatable column width adjustment

Solution for iceface datatable column width adjustment: You may face the issue while setting the iceface datatable column width adjustments. This can be achieved by the below way,   Use style=”table-layout:fixed;” in the ice:column and ensure you have set the columnwidths already for all the columns. eg: <ice:column style=”table-layout:fixed;” columnwidths=”350px,490px”>   255 total views, no views today

255 total views, no views today

» Read more

Submit Form after Validation jQuery example

Submit Form after validation jquery: function validations(){ if(($("#mobNum").val().length)==10){ $("#rcForm").submit(); }else{ //your content } } In the above example mobNum (#mobNum) is the id of the text box and rcForm(#rcForm) is the id of the Form. So here we are just checking whether the length of the text box is ten. We must put onclick=”validations()” in the button. Recommended Books: 184 total

184 total views, no views today

» Read more

wp-blog-header location

wp-blog-header: If you are creating the custom pages then you may need to include wp-blog-header.php, You have to include this below line as your first line, <?php require(‘./../../../wp-blog-header.php’); ?>   Thanks for reading this post, kindly post if any other ways to include the wp-blog-header in the comments. 131 total views, no views today

131 total views, no views today

» Read more
1 2