Tomcat default port is 8080 but many times other Java application also uses 8080 like any other web-server Resin or Jetty and starting tomcat may result in java.net.BindException:Address already in use: JVM_Bind 8080. In order to avoid this exception you can change default port of tomcat from 8080 to some other port e.g. 8081 or 8082. Though don't change to tomcat port which is likely to be used by tomcat itself e.g. 8443 is used by tomcat https port. Use port which is most likely to be free. In this tomcat tutorial we will see how to change default port 8080 for http protocol in tomcat and port 8443 port for https protocol in tomcat.
Tuesday, July 27, 2021
Monday, July 26, 2021
How to define Error page in Java Web Application - Servlet JSP Example
There are two ways to define the Error page in Java web application written using Servlet and JSP. The first way is page wise error page which is defined on each jsp page and if there is any unhandled exception thrown from that page, the corresponding error page will be displayed. The second approach is an application-wide general or default error page which is shown if any Exception is thrown from any Servlet or JSP and there is no page-specific error page defined.
Labels:
jsp-servlet
,
servlet interview questions
How to Disable submit button in HTML JavaScript? Multiple Form Submission Solution Example
Avoiding multiple submissions of HTML form or POST data is a common requirement in Java web applications. Thankfully, You can prevent multiple
submissions by disabling the submit button in HTML and JavaScript itself, rather
than handling it on the server-side. This is a very common requirement while developing a web application using Servlet and JSP or any other web
technology. At the same time, there is a lot of information and noise available in
web, and its very hard to find a simple approach to the disable submit button. When I
search for a simple way to disable the submit button in HTML and JavaScript, I was
overwhelmed by responses on forums and various online communities.
Labels:
coding
,
HTML and JavaScript
,
jsp-servlet
,
programming
,
servlet interview questions
JSTL foreach tag example in JSP - looping ArrayList
JSTL foreach loop in
JSP
JSTL foreach tag is pretty useful
while writing Java free JSP code. JSTL
foreach tag allows you to iterate or loop
Array List, HashSet
or any other collection without using Java code. After the introduction of JSTL and
expression language(EL) it is possible to write dynamic JSP code without using
scriptlet which clutters jsp pages. JSTL
foreach tag is a replacement of for loop and behaves similarly like foreach
loop of Java 5 but still has some elements and attribute which makes it hard
for first-timers to grasp it. JSTL foreach loop can iterate over arrays,
collections like List,
Set
and print values just like for loop.
Labels:
JSP
,
jsp-servlet
,
JSTL
JSP - How to check if ArrayList is Empty using JSTL Example
There are multiple ways to check if an ArrayList is empty in JSP or not. For example, you can use the empty operator and the length function of JSTL to check if a list is empty or not. You can also use scriptlet, which allows you to insert Java code into JSP but that is not advisable because it makes it harder to maintain a JSP page. You can also write a custom tag but that is not required because JSTL provides you the necessary support. In this article, I'll show you two ways to check if a given list or ArrayList is empty or not on the JSP page without using the scriptlet. You guessed it right, we will use JSTL, the Java standard tag library to solve this problem.
Labels:
JSP
,
jsp-servlet
,
JSTL
Difference between Servlet and JSP? Example
Servlet and JSP are two of the most popular Java web technologies to generate dynamic content in Java web applications there is some key difference between them. For example, Servlet is designed for Java developers as most of the coding is done in Java, while JSP was designed and developed for web GUI developers e.g. guys who write HTML and JavaScript and that's why you see the coding in JSP is tag-based. Even though you can use HTML tags as String inside Servlet and Java code as Scriptlet inside JSP, both are considered as bad practices and should be avoided at all costs because they are very hard to maintain.
Labels:
JSP
,
jsp-servlet
How to get ServletContext in Servlet, JSP, Action class and Controller? Example
How to get ServletContext in Servlet, jsp, spring controller or struts action class is common to need of any Java web developer. As ServletContext is an application-wide object and used to store variables in the global scope, getting a reference of ServletContext is pretty important. Every web application can have only one ServletContext though they can have multiple ServletConfig objects. In this article we will see :
How to get Servlet Context inside Spring MVC Controller?
How to find Servlet Context inside Struts Action class?
How to get Servlet Context inside JSP File?
How to find Servlet Context inside HttpServlet Class?
Labels:
jsp-servlet
,
servlet interview questions
How to loop over HashMap in JSP using JSTL? Example
Though there are a number of ways to loop over a HashMap in JSP, or any other Map implementation e.g. Hashtable, I personally prefer the JSTL foreach tag for iteration over HashMap in JSP. As a Java programmer, you will often have a strong urge to use Java code directly in JSP using scriptlet, but that's a bad coding practice and one should always avoid that. In fact, by smart use of expression language and JSTL core tag library, you can reduce a lot of Java code from your JSP page. In our last post, we have seen an example of JSTL foreach tag to loop over List, but not a HashMap, and that creates a doubt in one of my readers mind that foreach tag doesn't support Map implementation like HashMap or Hashtable as they are not Collection, but that's not true.
Labels:
JSP
,
jsp-servlet
,
JSTL
Difference Between ON HOLD and ON ICE Jobs in Autosys - Interview Question
Autosys is a job management and scheduling tool and widely used in Investment banks on UNIX or Linux based environments. Autosys is used to start Java process, takes backup of log files, stop Java process, cleaning and purging database, and will all sort of housekeeping jobs in Linux environment. Autosys system is made of Autosys server and Autosys clients, each server or box, which has services scheduled by autosys, requires autosys client to be installed on that. One of the key advantages of Autosys is that one job can depend upon another job, and can execute, depending upon, success and failure of parent job. Though Java developers are not asked a lot of interview questions, you might expect a few of them during your interview with Wall Street banks, Brokers or Financial institutions, which uses autosys.
Labels:
Autosys
,
interview questions
,
linux
,
unix
How to find file and directory size in Unix with Example - Linux tutorial
How to find the size of a directory in UNIX
Finding file size or directory size in Unix and Linux is not very difficult but if you came from windows background than it may sound difficult to you because you need to remember UNIX commands for file and directory size. This is a common complaint from windows users when they exposed to Unix operating system be it Linux or Solaris. but In my opinion, having commands for doing things is more powerful because you can write powerful scripts for removing large files or taking backup of directories in UNIX which is not possible with GUI based operating systems like Windows.
Top 10 basic networking commands in linux/unix - Examples
Networking is an essential part of Unix and it offers lots of tools and commands to diagnose any networking problem. When I was working on FIX Protocol we get a lot of support queries to see whether FIX Sessions are connected or not. Since FIX Protocol uses sockets you can use the netstat, telnet, and other networking commands available in Linux for finding a problem and solve that. In this article, I will show you basic networking commands in Unix and for what purpose they are used. with the combination of grep and find command on them, you can troubleshoot most of the networking problems.
10 Examples of CUT command in UNIX and Linux
The cut command in UNIX is a nice utility program that allows you to cut data from a text file. The Linux cut command allows you to cut data by character, by field, or by column. if used correctly along with sed, find, or grep in UNIX, the cut can do lots of reporting stuff. For example, you can extract columns from a comma-separated file or a pipe or colon-delimited file using cut command. For example, if you are only interested in the first two columns you can show them using this command. In this Linux cut command tutorial we will see different options of cut command, different examples of Linux cut command, and some important points about cut in UNIX.
Linux and UNIX Command Tutorial, Tips and Examples for Beginners
UNIX and Linux command tutorials and tips for beginners.
Hi, this is a kind of revision post where I would like to share some of my earlier posted UNIX commands tutorial. The purpose of this post is to put together all UNIX commands tutorial in one place for easy access to anyone. These are a collection of my favorite UNIX commands which you guys may find interesting. I have been working in UNIX for almost 4 years and I have learned many UNIX commands during these years which has helped me a lot during my day 2 days working on Unix shell.
Hi, this is a kind of revision post where I would like to share some of my earlier posted UNIX commands tutorial. The purpose of this post is to put together all UNIX commands tutorial in one place for easy access to anyone. These are a collection of my favorite UNIX commands which you guys may find interesting. I have been working in UNIX for almost 4 years and I have learned many UNIX commands during these years which has helped me a lot during my day 2 days working on Unix shell.
10 xargs command example in Linux - Unix tutorial
xargs command in UNIX or Linux is a powerful command used in conjunction with find and grep command in UNIX to divide a big list of arguments into small list received from standard input. find and grep command produces a long list of file names and we often want to either remove them or do some operation on them but many UNIX operating system doesn't accept such a long list of argument. UNIX xargs command divide that list into sub-list with acceptable length and made it work. This Unix tutorial is in continuation of my earlier post on Unix like 10 examples of chmod command in Unix and How to update soft link in Linux. If you haven’t read those unit tutorials than check them out.
10 Examples of Date Command in Linux and UNIX
Date command in UNIX or Linux is one of the important commands to learn and master because we always need date information. no matter you want to know the current date in UNIX or your bash script needs a current date in UNIX for archiving purposes you need to use date command. In its simplest format date command shows the current date and time in UNIX while with a sophisticated option we can extract much useful information from UNIX date command. In this Unix command tutorial, we will see some useful tips on using date command in UNIX and learn more around the date in UNIX and Linux.
Subscribe to:
Posts
(
Atom
)