<html>
<head>
<title>Using Multiple Forms</title>
</head>
<body>
<h1>Using Multiple Forms</h1>
<%
if(request.getParameter("button") != null) {
%>
<% String s = request.getParameter("button");
int no1,no2;
if(request.getParameter("no1").equals("")) { no1 = 0; } else no1 = Integer.valueOf(request.getParameter("no1"));
if(request.getParameter("no2").equals("")) { no2 = 0; } else no2 = Integer.valueOf(request.getParameter("no2"));
if (s.equals("ADD")) {
out.println("Result is " + (no1 + no2));
}
else if (s.equals("SUB")) {
out.println("Result is " + (no1-no2));
}
else if(s.equals("MUL")) {
out.println("Result is " + (no1*no2));
}
else if(s.equals("DIV")) {
out.println("Result is " + (no1/no2));
}
%>
<%
}
%>
<form name="form1" method="get">
<input name="no1">
<input name="no2">
<input type="hidden" name="button" value="ADD">
<input type="submit" value="ADD">
</form>
<form name="form2" method="get">
<input name="no1">
<input name="no2">
<input type="hidden" name="button" value="SUB">
<input type="submit" value="SUB">
</form>
<form name="form3" method="get">
<input name="no1">
<input name="no2">
<input type="hidden" name="button" value="MUL">
<input type="submit" value="MUL">
</form>
<form name="form4" method="get">
<input name="no1">
<input name="no2">
<input type="hidden" name="button" value="DIV">
<input type="submit" value="DIV">
</form>
</body>
</html>
Raj...
You can set the value in the hidden form fields using javascript and access the form fields in JSP
You cannot. You display JSP Pages using the help of Servlets. Servlets are of the background classes and you cannot display them
JSP actions are XML tags that direct the server to use existing components or control the behavior of the JSP engine. JSP Actions consist of a typical (XML-based) prefix of "jsp" followed by a colon, followed by the action name followed by one or more attribute parameters. There are six JSP Actions: < jsp : include / > < jsp : forward / > < jsp : plugin / > < jsp : usebean / > < jsp : setProperty / > < jsp : getProperty / >
jsp means Java Server Pages.
The implicit objects in a JSP page are:requestresponsepageContextsessionapplicationoutconfigpage
Yes, you can.
JSPs are converted to servlets before the container runs them. This is actually cool because you don't need hardcore java programming skills to create a JSP page whereas you'll need them to write a servlet. Moreover, all you'll need to write a JSP is some expertise in creating HTML files and in using JavaScript. You can create front-end JSP pages without having much expertise in Java at all. Although JSP reduces the required skill level, JSP becomes a servlet, with the nice performance and portability benefits.
vbcvbvbvcbc vbcvbvbvcbc
We can do validation by using JavaScript. Here we are using function Validate(). Iam creating one JSP name index.jsp & give a link to another JSP name basic.jsp. In that Jsp iam using Type 1 Jdbc Driver & giving a database connection
You can display data in Tabular format in a JSP page using the HTML <Table> Tag. You can even assign dynamic values to the table using JSP Scriptlets. <% %>
Yes. All sorts of web Applications/websites can be created using JSP and Servlets
you die.
first you have to find out what version of j2ee you are using then from there you can lookup the jsp version for that version of j2ee
You can set the value in the hidden form fields using javascript and access the form fields in JSP
scope of operater
JSP stands for Java Server Page, which is a program that controls how things appear on a webpage. JSP is not considered a language but it is written for programs using the programming language of JavaScript.
Servlet is more faster than JSP, but JSP is more convenient than Servlet and JSP is clearly superior, shorter, simple and easier to use. JSP can be perceived as Java in HTML code. JSP require no explicit compilation as like servlets and can keep in the web application server as HTML file. The web application server in turn compile the java code in JSP and load it in its library for future execution. Servlet can be perceived as HTML in Java code. The servlet is the class file, which would be loaded in the web application server as a program. The program output will be directed to the outstream object which in turn direct to the client as HTML elements.