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 web application that is deployed in wildfly 12, and I need to precompile the jsp for production, in the forums I saw that jspc is not longer  supported for jboss, also y tried maven plugin with no success.

i tried using management deployment and later do the explode forn the web console but the jsp isn't compiled
Also i couldn't find a command to do it from the hot-deployment, like glassfish --precompilejsp parameter.

how to do the precompilation of the jsp in wildfly?
Cloud Class® Course: Microsoft Exchange Server
LVL 12
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

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) {
        System.out.println("DBUtil.NamingException" + e);
    } catch(Exception 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"?>

    validationQuery="SELECT 1"

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">
          <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


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?
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 class="form-group">
        <form:input type="text" path="lastName" id="lastName" placeholder="Last Name" class="form-control input-sm" />
    <div class="form-group">
            <c:when test="${edit}">
                <form:input type="text" path="ssoId" id="ssoId" placeholder="SSO ID" 

Open in new window

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 …
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/>";



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

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

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

<button type="submit" class="button button2">Submit</button>


          Connection con=DriverManager.getConnection("jdbc:oracle:thin:@","xe","ex");
       PreparedStatement ps = con.prepareStatement("insert into employee_task values(?,?,?,?,?,?)"); …
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.

<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>
						<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>
												<form action="#" method="post">
													<input type="hidden" name="cmd" value="_cart" />

Open in new window

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.
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?
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!
Cloud Class® Course: SQL Server Core 2016
LVL 12
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

I am using jsp tag library based on com.jenkov.prizetag . how can I make it keyboard accessible
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>

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 …
Tomcat 6 TLS1.2 enabled but still using SSL2 when opening an HTTP connection

Greetings, newbie here, so I might need help formatting the question properly.

I have a application running under Tomcat 6 that needs to run TLSv1.2.
I have install the JAVA runtime edition 6.0.181 which supports TLSv1.2.
I have configured the server.xml file to use TLSv1.2 with connections to clients and wireshark shows TLSv1.2 connections to the client when they are loading pages. But one of the pages makes an API call by opening a HttpURLConnection which also needs to use TLSv1.2 and I am unable to make that work. Wireshark shows that outgoing API call as SSLv2 and the Tomcat log show an "Connection reset" error.

This is the server.xml connector that comes so close.

                                port=”443” maxThreads=”200”
                                scheme=”https” secure=”true” SSLEnabled=”true”
                                SSLVerifyClient=”optional” sslEnabledProtocols=”TLSv1.2”/>

Here is the httpconnection code that needs to use tlsv1.2 to work:

String url = " https://www.tlsv12testsite/process.do ";  

            String agent = "Mozilla/4.0";
            String type = "application/x-www-form-urlencoded";
I'm calculating values (based on input from one JSP) in a method in my Controller class and trying to pass it to another different JSP page using ModelAndView but I'm getting a weird `NumberFormatException` that I think refers to the value at line 249 from error below, ` 249:    <c:out value="${housepricesList.housePrice}"/>`:
    java.lang.NumberFormatException: For input string: "housePrice"

Open in new window

as well as another exception:
    2018-03-19 12:39:14.439 ERROR 2452 --- [nio-8080-exec-9] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [An exception occurred processing JSP page /houseprice.jsp at line 249

    248: <c:forEach items="${housepricesList}" var="HousePrice">     
    249:    <c:out value="${housepricesList.housePrice}"/>
    250:    <c:out value="${housepricesList.number_of_houses}"/>
    251: </c:forEach>

Open in new window

I'm getting a latitude and longitude from one JSP page, passing it to a method in my Controller where I use the lat & long values to query a database to return house prices within a 1km radius of initial latitude and longitude. I want to pass this returned information (`housePrice` and `number_of_houses`) to another JSP page. However the page won't load and the errors above are displayed in the console.

Controller Class
    	@RequestMapping(value = "/parseHousePrice", method = RequestMethod.POST)

Open in new window

i'm trying to reload user privileges dynamically.

i'm trying to achieve custom authorization mechanism via MethodSecurityExpressionOperations or GrantedAuthority to secure the URL and authorize the URL based on the conditions.

i come across two flavours of Spring to handle this one is via MethodSecurityExpressionOperations and the other is via GrantedAuthority - createAuthorityList

i am not sure which one is better and which one to be used in the case of dynamic reloading of user privileges where one user privilege has been updated by another user dynamically while the user is working on...

Difference between Servlet Filter vs Spring Security Filter ?

Some says security filter just authenticates the user, where as servlet filter authorizes the request

Need code snippet to understand the structure of both and the differences.
Spring Boot Version: 2.0
Spring Version: 5.0.4

Facing the following issues on trying to implement AccessDecisionManager

1. When used

public class WebConfig implements WebMvcConfigurer

Issue:  uanble to override protected void configure(HttpSecurity http) throws Exception {

2. When used

public class WebConfig extends WebSecurityConfigurerAdapter {

Issue: unable to override the following

a. public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
b. public void addResourceHandlers(ResourceHandlerRegistry registry) {
c. public void addInterceptors(InterceptorRegistry registry) {

3. Throws error "java.lang.IllegalStateException: No ServletContext set" when used as below

public class WebConfig extends WebSecurityConfigurerAdapter implements WebMvcConfigurer {

URL for reference:  http://www.baeldung.com/spring-security-custom-voter

public AccessDecisionManager accessDecisionManager() {
    List<AccessDecisionVoter<? extends Object>> decisionVoters
      = Arrays.asList(
        new WebExpressionVoter(),
        new RoleVoter(),
        new AuthenticatedVoter(),
        new MinuteBasedVoter());
    return new UnanimousBased(decisionVoters);

protected void configure(HttpSecurity http) throws Exception {
Where i can download a sample or demo application which has the following..Any link would be useful

1. Source code
2. Sample SQL file to populate the data in mysql table or json to populate NoSQL
3. Uses Ajax in the front-end to send and receive responses
I'd like to create a web page (using jsp) with a touch-screen table that can accept graphical input, like a signature or doodle. I'm cluless as to what's needed or where to start. Advice?
Get expert help—faster!
LVL 12
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Are these same in Drools  ?

code -1 :

    $city : City()  
    //Do something

Open in new window

code -2 :

    city : City()  
    //Do something

Open in new window

Note ..they are differed by "$" only.

I have seen two such versions  in Drool like above............sometimes  we use  "$"  and sometimes  without "$"  . Do they mean same thing  ?
I have a function, referenced by numerous other programs, whose parameters are not able to be changed:

static void reportDetail(Statement stmt, BufferedWriter outFile, String detailColumn) throws Exception

However, the body of the function is defined locally in any given program. What I need to do in one particular program is reference a string defined in the main program, e.g.:

String localVar = globalVar;

where globalVar is defined outside the scope of reportDetail().

Is there a way to do this? (this is jsp BTW)
I am struggling with a problem on JSF Primefaces 6.0 where in I have main page which has the list of addresses and main save button. The list of addresses in displayed in data table and the user can click on the edit button to edit any row of the data table. The edit button opens a dialog popup where user can change the address attributes and the click on "OK" button which should updated the list grid data as well as updated the address object in the listgrid of the main bean.
Currently I am facing the problem where my changes in the address popup are not visible in the backing bean method.

Sample code :-

      <addresslistTable> bean:addressList
            <addressline1> value="variable.addressline1" onclick--> bean.getAddressById(variable.id)

      <addressline1> value="bean.otherAddress.addressline1"  --> user can change this value
      <p:commandButton value="#{msg.common_save}" process="@this" action="#{bean.submit}" update=":main:addresslistTable" oncomplete="PF('addressDialog').hide()"/>

class bean {
Address otherAddress;

public getAddressById(addressId){
      otherAddress = getAddressFromDatabaseById(addressId);

public void submit(){
// here I am accesing the otherAddress.addressLine1 which is still showing be the old value


I have hyperlink in a jsp page that calls a javascript (<a href="javascript:somefunction()" > Save </a> )

someFunction() is in same jsp, but the function body contains methods from another.js file.

In Mozilla ESR onblur and onclick event is executing simultaneously.

But, in Chrome and IE it is working fine.

Can someone please help on this ?
how to check domain name availability in javascript using jsp
Hi Team,

Im using jqgrid table in a jsp page. the data is displaying correctly. but the  entire table was not displayed according to the page. it was not expanded.I verified with Developer tools in chrome. I came to know that the table width is set to 1px. If i uncheck this, the table is displaying correctly. The how to overcome this width:1px?


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