2018-10-19         Ben

Singleton is applicable in servlet/jsp project?

This question already has an answer here: Is it safe to use a static java.sql.Connection instance in a multithreaded system? 2 answers Your connection manager is not thread safe. So while one user is trying to read data using the single instance, another user's thread may end up closing the in-use connection.Instead use something like Apache DBCP that will also give you a connection pool.If you still want to use the code above, change it your connection manager as a regular object and n...

 jsp                     2 answers                     103 view
 2018-10-19         Colbert

JSP dropdownlist onChange

Can i use a .jsp file as a parameter for onChange in a dropdownlist? Like this : <td><select name="transporter" onchange="debusTransporter.jsp"> Answer is No. Explanationonchange The onchange property sets and returns the event handler for the change event. The term event handler may refer to:any function or object registered to be notified of events,or, more specifically, to the mechanism of registering event listeners via on... attributes or properties in HTML and other web APIs, such as <button onclick="alert(this)"> or window.onload = function() { /...

 jsp                     1 answers                     14 view
 2018-10-19         Nicole

How do I deploy a JSP file in the Jetty webserver?

I have created a simple JSP file that I want to deploy in Jetty 7.2. Jetty is running and I can see the default web page at http://localhost:8080/. I started Jetty with the java -jar start.jar command.I saved my simple JSP file jsp_test.jsp at <my_jetty_directory>/webapps/jsp_test.jsp and then I tried to access that file on http://localhost:8080/jsp_test.jsp and http://localhost:8080/webapps/jsp_test.jsp but none of them works.Is there something more I have to do? Where in the Jetty file structure should I place my JSP file?If you know a helpful tutorial I would be th...

 jsp                     1 answers                     93 view
 2018-10-20         Kitty

A palette display in InteliJ Ultimate 2016.2.3

Am using jsp to develop my project in IntelliJ Ultimate version 2016.2.3 , but how can i be able to use the palette , to allow drag and drop. Like that of Netbeans. IntelliJ IDEA does not include a visual designer for JSP pages. [XXX]

 jsp                     1 answers                     97 view
 2018-10-20         Chester

Kendo UI Combobox sample code is not working in jsp

I working on Kendo UI first time in my project, I am trying to create combobox using their sample code here. Same code is working in html but if add same code in jsp its not working, result in jsp I am not able to see list values.I have one more question, can I import kendo ui library and bootstrap library together? will it cause any conflicts?Many thanks in advance!<%@ page language="java" contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO-8859-1"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">&l...

 jsp                     1 answers                     100 view
 2018-10-20         Mignon

Adding external resources (CSS/JavaScript/images etc) in JSP

I added an external CSS stylesheet to my project and placed in the WEB-CONTENTS folder of my project in Eclipse. When I deployed it on the Tomcat, the stylesheet was not applied. When I debugged it in Chrome and opened it, it gave me 404 file not found error. Why is that and how to fix it?Here is the code:<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%><%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose...

 jsp                     2 answers                     97 view
 2018-10-21         Carter

Unable to call servlet file from jsp - 404 error found

This question already has an answer here: Servlet returns “HTTP Status 404 The requested resource (/servlet) is not available” 3 answers You need to give Servlet Name in the action do not need to specify anything;<body><h1>Guru Register Form</h1><form action="Guru_register" method="post">//Servlet with annotation @WebServlet("/Guru_register")public class Guru_register extends HttpServlet { private static final long serialVersionUID = 1L; [XXX]Tr...

 jsp                     2 answers                     100 view
 2018-10-21         Justin

JSP servlet JSTL

When I send attribute 'saved' from servlet to jsp, if it equals to true I show alert msg otherwise I want to assign it to false in the second refresh.Servlet: saved = true; request.setAttribute("saved", saved); response.sendRedirect("temp/pr_home.jsp");JSP:<c:choose> <c:when test="${saved==true}"> <c:out value="${saved}"> </c:out> <div class="alert-box success" role="alert" > Project Review has been saved! <a href="pr_home.jsp" > click here to see details </a> </div&...

 jsp                     1 answers                     99 view
 2018-10-21         Ben

Using Jsp variable in servlet

servlet1request.getSession().setAttribute("user", user.getUid());request.getRequestDispatcher("home.jsp").forward(request,response);home.Jsp code <h5>Servlet communicated message to JSP: ${user} Please Select an image to upload</h5> <form action = "SaveInDBServlet" method = "GET" enctype = "multipart/form-data"> <input type = "file" name = "filepath" size = "50" accept="image/*" /> <br /> <input type = "submit" value = "Submit" /> </form>user value is sent from servlet1 to JSPand now I need...

 jsp                     2 answers                     9 view
 2018-10-21         Mamie

Struts2 action setter method not thread safe?

I am having a really weird issue.I have a web app built with Struts2, two action file and one jsp file.The function is to submit a form and get the csId from UI.However, i found that if I open two windows to click on the form to submit different csId, i can see the csId get changed in the loop in the action.I think action is thread safe but how can the other user's action change the csId in my action?Please help.There are two Action file:public abstract class CustomerSegmentCrudBaseAction extends BaseAction { protected String csId; public String execute() throws Promo...

 jsp                     2 answers                     10 view
 2018-10-21         Odelette

jsp lang parameter is automatically stored in cookie in struts 1.1

My application is running struts 1.1 on tomcat 7.0.47. Whenever I request a jsp like this :http://localhost:8080/myTestPage.jsp?lang=frThe value lang=fr is automatically stored in cookies . Even if the jsp is not related to an action in the config, and contains only "eclipse jsp's template code".This is a security issue as there is no controle over this parameter ( you can inject JS ).How or why this parameter is stored ? This behavior applies only for the lang parameter . Sounds to me like your cookie interceptor is active in (your / one of your) config file, something ...

 jsp                     2 answers                     25 view
 2018-10-21         Osborn

Difference between JSP1.2 and JSP2.0

Difference between JSP1.2 and JSP2.0 See JSP 2.0 - The New DealTo clarify, this article itemises in the first section the enhancements added to JSP 2.0. [XXX]Apart from the things mentioned in JSP 2.0 - The New Deal, an often overlooked new JSP 2.0 feature is JSP tag files which can be a pretty cool way to create reusable components with JSP. That can be small tags just doing one thing used in many different JSP pages (like e.g. formatting a currency styled in a special way) or it can be used for general template composition. [XXX]

 jsp                     2 answers                     28 view
 2018-10-21         Montague

Difference between Custom Tag and Java Bean?

Difference between Custom Tag and Java Bean? A custom JSP tag has to be interpreted and run inside a JSP; a Java Bean does not.A custom JSP tag has to extend the javax.servlet.jsp.tagext.Tag interface; a Java Bean does not.A custom JSP tag might use other Java Beans to do its work, but the reverse is not true. [XXX]Custom tags have access of implicit objects like request, response, session, etc. JavaBeans are normal java classes and don't know anything about JSP.Javabeans are normally used to maintain the data and custom tags for functionality or implementing a logic ...

 jsp                     4 answers                     27 view
 2018-10-21         Eden

<c:foreach> doesn't seem to work

I've seen all similar questions but I didn't find any working answer to my issue.Simple jsp file: <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <% String[] names = {"Jhn", "Kate", "Larry"}; pageContext.setAttribute("myNames", names); %> <html> <body> <c:forEach var="tempName" items="${myNames}"> <p>${tempName}</p> </c:forEach> </body> </html>Maven dependencies: <dependency> <groupId>javax.servlet</groupId> <artifactId&g...

 jsp                     1 answers                     40 view
 2018-10-21         Beryl

How do I show items on my website according to the location of the user?

I made a website in Java and Google App Engine about tuitions. I want to show only the tuitions near that user. So how can I do this?Link to the website: http://tut-points.appspot.comIf you can see, it is showing all the courses which were added, but I want to show only the courses which are near to the user. Are you on App Engine Standard? If so you should be receiving these headers giving you the user's general location:https://cloud.google.com/appengine/docs/standard/python/reference/request-response-headers#app_engine-specific_headers X-AppEngine-Country Country...

 jsp                     1 answers                     28 view
 2018-10-21         Francis

pass java variable in jsp:param

<%! String str = "prerna"; %> <jsp:include page="index.html"> <jsp:param name="type1" value=<%=str%> > </jsp:param> </jsp:include>I want to pass a java variable in the param tag,but i am not sure how to do it. I also want to access it in index.html.Can anyone suggest me the way to do it ? Just put it in value directly.<jsp:include page="index.html"> <jsp:param name="type1" value="prerna" /></jsp:include>Or use JSTL <c:set> to set it and EL ${} to get it.<%@taglib prefix="c" uri="http...

 jsp                     5 answers                     54 view

Page 1 of 80  |  Show More Pages:  Top Prev Next Last