[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

JSP

JavaServer Pages (JSP) allow the development of dynamically generated web pages. It uses the Java programming language; JSP pages are translated into servlets at runtime, with each servlet being cached and reused until the JSP is modified. JSP allows Java code to be interleaved with static web markup content, so the resulting page can be compiled and executed on the server to deliver the content.

Share tech news, updates, or what's on your mind.

Sign up to Post

I have a PLSQL procedure that embed with HTML code. How can I use this procedure to print in JSP? Can provide sample code?
0
Fundamentals of JavaScript
LVL 12
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

How to read real-time cancel appointment in the calendar using Exchanged server managed API
Getting below error:
microsoft.exchange.webservices.data.core.exception.service.remote.ServiceResponseException: The specified object was not found in the store.
        at microsoft.exchange.webservices.data.core.response.ServiceResponse.internalThrowIfNecessary(ServiceResponse.java:278)
        at microsoft.exchange.webservices.data.core.response.ServiceResponse.throwIfNecessary(ServiceResponse.java:267)
        at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java:165)
        at microsoft.exchange.webservices.data.core.ExchangeService.internalBindToItems(ExchangeService.java:1343)
        at microsoft.exchange.webservices.data.core.ExchangeService.bindToItem(ExchangeService.java:1378)
        at microsoft.exchange.webservices.data.core.ExchangeService.bindToItem(ExchangeService.java:1395)
        at microsoft.exchange.webservices.data.core.service.item.Appointment.bind(Appointment.java:118)
        at microsoft.exchange.webservices.data.core.service.item.Appointment.bind(Appointment.java:133)
        at com.docasap.ihub.exchangeserverengine.handler.e2d.StreamingAppointmentsHandler.notificationEventDelegate(StreamingAppointmentsHandler.java:96)
        at microsoft.exchange.webservices.data.notification.StreamingSubscriptionConnection.issueNotificationEvents(StreamingSubscriptionConnection.java:524)
    …
0
I tried jsp custom tag example.

custom tag color is not changing even though i changed to blue or some other color it still shows default color as attached.

Index.jsp is

<%--
    Document   : index
    Created on : Nov 6, 2018, 1:41:41 PM
    Author     : saiganesh
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="mytags" uri="/WEB-INF/tlds/my_tags" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <mytags:formattag colour="blue" font_size="50" is_uppercase="false">
            this is ext hello custom tag
            </mytags:formattag>
    </body>
</html>



my_tags.tld is

<?xml version="1.0" encoding="UTF-8"?>
<taglib version="2.1" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd">
  <tlib-version>1.0</tlib-version>
  <short-name>my_tags</short-name>
  <uri>/WEB-INF/tlds/my_tags</uri>
 
  <tag>
      <name>formattag</name>
      <tag-class>tags.FormatTag</tag-class>
      <body-content>scriptless</body-content>
      <attribute>
          <name>colour </name>
          <required>true</required>
      </attribute>
        <attribute>
          <name>font_size </name>
          <required>true</required>
      …
0
Using jsp sessions HOW TO SWITCH / (SWAP) THE LEFT AND RIGHT BUTTON  WHEN THE CLICK BUTTON IS PRESSED.?  refer screenshot. need to swich tthe button on click of the click button.
0
<%@page import="myServletPakage.RanUtilities"%>
<%@page contentType="text/html; charset=ISO-8859-7" language="java" import="java.lang.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%!
int numberToGuess = RanUtilities.randomInt(100);
 %>
 <% boolean win = false;
      int numberOfTries = 0;

 while(win==false && numberOfTries<10){%>
 <form>
EnterNumber:<input type = "text" name = "number">
 </form>
 <%
 String value =request.getParameter("number");

    %>
 <%
 int yourNumber = Integer.parseInt(value ); %>
 <% if(yourNumber == numberToGuess){
            win = true;
            System.out.println("You win this Game");%>
            <P> Your number is <%= yourNumber %>
            <br> You Win This game!!!
            
            <%
      } %>
 <% numberOfTries++; } %>
</body>
</html>
0
Hi,

I have problem to make the progress bar be animated. It shows a static progress bar with the green image only but no animation. I placed the code below for your reference. May I know what is the problem? Please help. Thanks.

I embedded all the codes below codes in the jsp (the framework is SpringMVC). How to make the progress bar animated? Also, we are using html4 but not the highest (html5).

HTML:
<div id="pwidget">  
<div id="progressbar">
    <div id="indicator"></div>
</div>
<div id="progressnum">0</div>
</div>
<input type="button" name="Submit" value="Start the progression"
    onclick="itv = setInterval(prog, 100)" />
<input type="button" name="Submit" value="Stop"
    onclick="clearInterval(itv)" />


CSS:

#pwidget
{
  background-color:lightgray;
  width:254px;
  padding:2px;
  -moz-border-radius:3px;
  border-radius:3px;
  text-align:left;
  border:1px solid gray;    
}
#progressbar
{
  width:250px;
  padding:1px;
  background-color:white;
  border:1px solid black;
  height:28px;
}
#indicator
{
  width:0px;
  background-image:url("shaded-green.png");
  height:28px;
  margin:0;
}
#progressnum
{
  text-align:center;
  width:250px;
}

Javascript code:

var maxprogress = 250;   // total to reach
var actualprogress = 0;  // current value
var itv = 0;  // id to setinterval
function prog()
{
  if(actualprogress >= maxprogress)
  {
    clearInterval(itv);    
    return;
  }
  var progressnum = …
0
Hi all,

I have problem to display my PDF file in an existing popup window using spring framework. The workflow is when I click a button from the main page, it popups a new window (child) and showing progress status. After the file finished generating, I set the view in controller and return to jsp. However, the PDF file displays (using DefaultResourceLoader and response.flushBuffer) in the main page instead of the popup window. I want to show in popup. Anything wrong? How can I specify which window the PDF should be displayed?

Please help. Thanks.
0
Dynamic Form/Table from BackEnd for every entities which has CRUD operations

I'm developing a Java Web application.

I need to

1st option list the user clicked entity menu on the UI
2nd search page where user enter values for the fields and we need to publish the search results in a table

Note: the number of columns will differ from entity to entity

In either case, i need to know hoe to define a generic entity, pojo, DAO and DAOimpl, service and controller class and view jsp page

What should be the return type Object for #1, #2

How to create a generic jsp page to display the results for any entity

Please advise

Thanks
0
can any one provide an sample application for tomcat 7.x that can trigger OutOfMemory and hung threads?.
0
I am learning spring Boot framework right now, I am trying to apply i18n concept on my simple application. But whenever I run the application, the following error returned: "No message found under code 'label.welcomeMessage' for locale 'en_US'.". I have read about this issue and tried a lot before I getting here to ask but noting have worked with me.

Here is my AppClass configuration:

package com.abed.main.configuration;


import java.util.Locale;

import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
import org.springframework.web.servlet.i18n.SessionLocaleResolver;

@Configuration
public class AppConfig implements WebMvcConfigurer{



    @Bean
    public LocaleResolver localeResolver()
    {
        SessionLocaleResolver slr = new SessionLocaleResolver();
        slr.setDefaultLocale(Locale.US);
        return slr ; 
    }

    @Bean
    public LocaleChangeInterceptor LocaleChangeInterceptor()
    {
        LocaleChangeInterceptor lci = new LocaleChangeInterceptor();
        lci.setParamName("lang");

Open in new window

0
Exploring ASP.NET Core: Fundamentals
LVL 12
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

language: Java

 i have one bank statement  in xls format , which i already convert into csv format in java .  and display in jsp  ,but how user can recognized the amount is debit or credit because it come in one column i.e  amount . and  after edit  form jsp it will save in database , where two different column for debit and credit .....

Problem:  In excel File : there is two column Debit Amt. and credit Amount , but the transaction will be debit or credit , but when i convert into csv file ,  it not write null on blank cell . i

 used missing policy ,
 case Cell.CELL_TYPE_BLANK:
                                                                                               
                                  data.append("***" + ",");
                                    break;

 but it work on total blank column , not a every blank cell .

Kindly guide .Thanks  in advance .
0
Hello There ,
 I am new to Spring framework , i started to learn Spring MVC framework , i am currently trying to use internationalization (i18n)and localization (i10n) and every thin is going as expected

but here is my question in my project i have just 3 JSP and i have apply the (i18n) concept on them but i am wondering what if have 100 JSP , do i have to write a code and labels for all 100 JSP or can i make my all of my JSP app internationalized  just by clicking on a link to change between languages i want ???
0
I am new to Spring MVC and I am trying to build a simple web App I am using Hibernate with Spring MVC. I am trying to implement CRUD operations in this web app, all CRUD operates properly except the update although DAO And Service Layers are working properly the problem here is about the JSP's and controllers. whenever I click update from the table it took me to the desired page to enter new book info but from the Update page when I click on update book submit button it stays on the same page and it does not call the desired controller method to take me where I want. I am talking about the last two methods.

Here is the Controller

package com.abed.controllers;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import com.abed.models.Book;
import com.abed.service.BookService;

@Controller

public class BookController {

    @Autowired
    BookService service;

    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public String 

Open in new window

0
Receiving error as follows. Please do needful.
HTTP Status 500 - Filter execution threw an exception
exception :
javax.servlet.ServletException: Filter execution threw an exception
root cause :
java.lang.Error: Unresolved compilation problems:
      The import com.opensymphony cannot be resolved
      The import com.opensymphony cannot be resolved
      The import com.opensymphony cannot be resolved
      ActionSupport cannot be resolved to a type
      ValueStack cannot be resolved to a type
      ActionContext cannot be resolved

      com.tutorialspoint.struts2.HelloWorldAction.<init>(HelloWorldAction.java:5)
      sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      java.lang.reflect.Constructor.newInstance(Unknown Source)
      java.lang.Class.newInstance(Unknown Source)
      com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:130)
      com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:161)
      com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:150)
      com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:120)
      com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:300)
      com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:400)
      com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:194)
      …
0
I have a Tomcat app. Recently, I've updated the connection pool, in order to use Tomcat's jdbc-connection pool. In my Windows developing machine, everything works fine, but now that I'm trying to implement this on my Linux Server, I get this exception (see title) when ever my app tries to connect to MySQL.

I'm using "Easy Tomcat 7" which is supposed to be the same as the regular version of Tomcat, only it comes with the CPanel software.

I just need this database to be available for this app (not multiple app's).

This is my java DB class:

public class DBUtil {

static DataSource ds;
static {
    try {
        Context context = new InitialContext();
        ds = (DataSource)context.lookup("java:comp/env/jdbc/rhwebDB");
    } catch (NamingException e) {
        e.printStackTrace();
        System.out.println("DBUtil.NamingException" + e);
    } catch(Exception e) {
        System.out.println(e);
    }
}

public static Connection getConnection() throws SQLException {
    return ds.getConnection();
}

Open in new window


This is my context.xml file, which is located on myAppDirectory/META-INF folder

<?xml version="1.0" encoding="UTF-8"?>

<Context>
<Resource
    name="jdbc/rhwebDB"
    auth="Container"
    type="javax.sql.DataSource"
    factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
    testWhileIdle="true"
    testOnBorrow="true"
    testOnReturn="false"
    validationQuery="SELECT 1"
    validationInterval="30000"
    timeBetweenEvictionRunsMillis="30000"
    maxActive="20"
    minIdle="3"
    maxIdle="15"
    maxWait="10000"
    initialSize="3"
    removeAbandonedTimeout="60"
    removeAbandoned="true"
    logAbandoned="true"
    minEvictableIdleTimeMillis="30000"
    username="dbuser"
    password="dbpassword"
    driverClassName="com.mysql.jdbc.Driver"
        url="jdbc:mysql://127.0.0.1:3306/rhmexweb_rhweb"/>
</Context>

Open in new window


I don't use WAR files. I just upload files to my server and re-start tomcat when needed, which normally works just fine.

In case this is relevant too, Tomcat's server.xml file has this settings for this website. I've also tried adding parameter copyXML="true", with no luck so far:

<Host name="rhweb.mx" appBase="webapps">
          <Alias>www.rhweb.mx</Alias>
          <Context path="" reloadable="false" docBase="/home/rhmexweb/public_html" debug="1" />

Open in new window


Here's the full stacktrace I get when my app tries to establish a connection with MySQL:


Open in new window

0
Greetings,

I am  working on servlet  project and I  had made a jsp form in my project.  I have fetch the data in my dropdownlist using jsp code.  But the error is that when I select dropdownlist
I  want  to fetch the data in my multiple textbox according to my sql database column.

Please can you help me?
0
I downloaded a working demo but when I integrated it with the registration page made by me I am getting an error on adding a new user:

[Field error in object 'user' on field 'userProfiles': rejected value [3]; codes [typeMismatch.user.userProfiles,typeMismatch.userProfiles,typeMismatch.java.util.Set,typeMismatch]; arguments
[org.springframework.context.support.DefaultMessageSourceResolvable: codes [user.userProfiles,userProfiles]; arguments []; default message [userProfiles]]; default message
[Failed to convert property value of type 'java.lang.String' to required type 'java.util.Set' for property 'userProfiles'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type
[com.idev.tpt.model.UserProfile] for property 'userProfiles[0]': no matching editors or conversion strategy found]]

JSP File:

<form:form id="userForm" action="newuser" modelAttribute="user">
    <form:input type="hidden" path="id" id="id" />
    <div class="form-group">
        <form:input type="text" path="firstName" id="firstName" placeholder="First Name" class="form-control input-sm" />
    </div>
    <div class="form-group">
        <form:input type="text" path="lastName" id="lastName" placeholder="Last Name" class="form-control input-sm" />
    </div>
    <div class="form-group">
        <c:choose>
            <c:when test="${edit}">
                <form:input type="text" path="ssoId" id="ssoId" placeholder="SSO ID" 

Open in new window

0
I created one application in netbeans 8.2 now i want to deploy this application in weblogic for that i created weblogic.xml but when i validate its giving me following error at the same time when i deployed as it is then in weblogic it is showing me Unable to access the selected application.,Exception in AppMerge flows' progression,Unmarshaller failed when i validate weblogic.xml its showing me below error,im using apache tom cat in server side weblogic java version is java version "1.7.0_71" where in my windows it is 1.8.0_161

Checking file:/D:/GODBFILES/NETBEANS%20PROJECTS/NetBeansProjects/EmployeeRegistration/web/WEB-INF/weblogic.xml...
schema_reference.4: Failed to read schema document 'file:/C:/Program%20Files/glassfish-4.1.1/glassfish/lib/schemas/weblogic-web-app.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>. [2]
cvc-elt.1: Cannot find the declaration of element 'weblogic-web-app'. [2]
schema_reference.4: Failed to read schema document 'file:/C:/Program%20Files/glassfish-4.1.1/glassfish/lib/schemas/weblogic-web-app.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>. [3]
schema_reference.4: Failed to read schema document 'file:/C:/Program%20Files/glassfish-4.1.1/glassfish/lib/schemas/weblogic-web-app.xsd', because 1) could not find the document; 2) the document could not be read; 3) the …
0
Here is my html code where i creating dynamic textbox for insert using jsp
function getinput()
{
index ++;
var singleRecord = "";
singleRecord += " Employee_id : <input type='text' READONLY name='txt_Employee_id"+index+"'value='<%=request.getParameter("employee_id")%>'>";
singleRecord += " Project_name : <input type='text' name='txt_project_name"+index+"'>";
singleRecord += "Project/Task : <input type='text' name='txt_Header"+index+"'>";
singleRecord += "Department : <input type='text' name='txt_Department"+index+"'>";
singleRecord += "Description : <input type='text' name='txt_description"+index+"'>";
<!--singleRecord+="Date : <input type='date'  name='datainsertdate"+index+"'>"; --->
singleRecord += "<hr/>";
$("#inputs").append(singleRecord);
$("#count").val(index);
}

</script>

</head>

<body background="123-slideshow\blue_background.jpg">
<form action="EmployeeVendorValidation.jsp" method="post">

   
     <br><br><br><br>    
<input type="hidden" name="count" id="count"/>



<div id="inputs">
</div>
<button type="button" onclick="getinput()" class="button button5">Add</button>

&nbsp;
<button type="submit" class="button button2">Submit</button>

jsp:

 Class.forName("oracle.jdbc.driver.OracleDriver");
          Connection con=DriverManager.getConnection("jdbc:oracle:thin:@172.18.114.213:1821:godb","xe","ex");
       PreparedStatement ps = con.prepareStatement("insert into employee_task values(?,?,?,?,?,?)"); …
0
Introduction to Web Design
LVL 12
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

How to delete products from shopping cart when user session ends (or Logout in ) in jsp web application.When you then add a product to your cart (not logged in) and then decide to login and go to the checkout, I now have 2 products in the basket. Is there a way to not store products in the basket when you logout?

I know that this is a cookies issue, but is there a way to remove products from the cart when logging out?

Following is code what i have tried.




product.jsp
<link href="style.css" rel="stylesheet" type="text/css" media="all" /> 
<div class="cart"> 
						<form action="#" method="post" class="last"> 
							<input type="hidden" name="cmd" value="_cart" />
							<input type="hidden" name="display" value="0" />
							<button class="w3view-cart" type="submit" name="submit" value=""><i class="fa fa-cart-arrow-down" aria-hidden="true">cart</i></button>
						</form>  
					</div>
					
						<div class="item" style="width: 30%">
										<div class="glry-w3agile-grids agileits"> 
											<div class="new-tag"><h6>20% <br>Off</h6></div>
											<a href="products4.jsp"><img src="s3.jpg" alt="img"></a>
											<div class="view-caption agileits-w3layouts">           
												<h4><a href="products4.jsp">Nylon Shuttle</a></h4>
												<p>Lorem ipsum dolor sit amet consectetur</p>
												<h5>$56</h5>
												<form action="#" method="post">
													<input type="hidden" name="cmd" value="_cart" />
													<input 

Open in new window

0
I am dealing with datasource in a jsp page and getting

 javax.servlet.jsp.JspException: 'dataSource' is null

what to do in case I am not having exposure to Datasource. I can't attach the code as it is confidential.
0
I am trying to convert some coldfusion code to jsp and there are some tags like cfargument,cf:loop,cf:return,cf:location.. can anybody tell me what to use in place of these tags in jsp?
0
Hi, I've a Struts 1.x web Application and we have new enhancement we need to redirect to some other application for authenticating and  authorization. In detail, we need to remove our app login page and need to redirect to some other website for login page. I'm using response.sendRedirect(https://xxx.com) and its redirecting to other website but before we display our home page we need to validate their response by calling two times their website. My question is how can I get their website response paramers to validate. Please help us. Thanks!
0
I am using jsp tag library based on com.jenkov.prizetag . how can I make it keyboard accessible
0
I have a jsp page which contain drop downs and two buttons. One button for Upload and other is Run button. I want to retain the value of drop downs even after the Upload is clicked and submitted the form so that the same values should pass for Run button . I used the below code.

<select name="riskType" class="filter_smalltext" onchange="regAuthChange();">
                                          <!-- <option value=0>Select...</option>
                                          <option value="CR">CR</option>
                                          <option value="MR">MR</option>
                                          <option value="BOTH">Both</option> -->
                                          <option value="" selected="selected">Choose One</option>
                                          <option value="<%if(request.getParameter("riskType").equals("CR")) {out.println('selected="selected"'); } %>">CR</option>
                                          <option value="<%if(request.getParameter("riskType").equals("MR")) {out.println('selected="selected"'); } %>">MR</option>
                                          <option value="<%if(request.getParameter("riskType").equals("BOTH")) {out.println('selected="selected"'); } %>">BOTH</option>
                              </select></td>



But i am getting this error :
jv_allocation_process.jsp:16:18: Error in "jv_allocation_process.jsp" at line 401: Invalid character constant
<%@ include file="templates/jv_allocation_process.jsp" %>
                 ^-----------------------------------^

        at weblogic.servlet.jsp.JavelinxJSPStub.reportCompilationErrorIfNeccessary(JavelinxJSPStub.java:247)
        at weblogic.servlet.jsp.JavelinxJSPStub.compilePage0(JavelinxJSPStub.java:183)
        at …
0

JSP

JavaServer Pages (JSP) allow the development of dynamically generated web pages. It uses the Java programming language; JSP pages are translated into servlets at runtime, with each servlet being cached and reused until the JSP is modified. JSP allows Java code to be interleaved with static web markup content, so the resulting page can be compiled and executed on the server to deliver the content.

Top Experts In
JSP
<
Monthly
>