FAQ Database Discussion Community


How to show columns from different table in TABLE FORM

java,mysql,jsp
I've created List which gets Obiekt from database and i'm showing this List in select form. Here is form code: <select name="obiekt"> <option selected value="default">Wybierz Obiekt</option> <% for (Obiekt obiekt : list) { %> <option value="<%=obiekt.idObiekt %>"><%=obiekt.nazwa%> <%=obiekt.adres %></option> <% } %> </select> In my database i've also Termin database...

Vector : References to generic type Vector should be parameterized

jsp,generics,vector
I have this problem(yellow line) in my jsp file which often caused my eclipse program keep no responding. Although my program can run, but how can i get a rid of this following line of code. Vector vFieldName = (Vector) session.getAttribute("table_vFieldName_"+TABLE_TYPE); Vector vTable = session.getAttribute("table_vTable_"+TABLE_TYPE) == null ? new Vector():...

How to multiply values from different coloumn in jsp servlet

jsp,servlets
I want to multiply resultSet.getInt("price") with resultSet.getInt("quantity") And give the result in my html How can i do it? P.s im a beginner...

Persistent authentication filter logging in; not propagating to JSP

jsp,java-ee,jstl,struts,servlet-filters
I've been working on a "Remember Me?"-style persistent authentication system, but after successfully authenticating and logging in the user, my JSPs do not reflect that the user is logged in until the next page request or refresh is processed. The cookie used for this is being written, and the database...

How to persist form bean object value to retreive it later in Struts 1

java,jsp,struts,struts-1
Using Struts 1.3 I have a login form with username, password and a drop-down with some values like English,Deutsh and so on. When a form is submitted, the last value need to be persisted from the drop-down. Following the code sample. Form Bean : public class LoginForm extends ActionForm {...

Ajax url parameter issue

jquery,ajax,jsp,spring-mvc
When i do a Ajax request , for the url mentioned below , it is concatenating the url value which i have mentioned along with the pathname of the URL of the page. JSP: <form:form modelAttribute="createtask" id="create-task-form" name="create-task-form"> <div class="task"> <form:input path="taskName" placeholder="enter task"/> <c:url value="/createtask/${todo.todoId }" var="createtaskUrl" /> <a...

[Ljava.lang.Object; cannot be cast to List from a request SQL

java,jsp,java-ee
I have a problem for the view of a List with a ForEach in a jsp: I have this error for the timelineservlet: Etat HTTP 500 - [Ljava.lang.Object; cannot be cast to fr.gabbler.models.Gabs type Rapport d''exception message [Ljava.lang.Object; cannot be cast to fr.gabbler.models.Gabs description Le serveur a rencontré une erreur...

How to bypass signle quote error in javascript?

javascript,jsp,jstl
I need to have an array as following but the single quote before (s) causes error. JavaScript does not accept them. Is there any way to bypass the error or replace the single quotes with other characters like space? I tried to use replace function but not sure how to...

Java Struts2 (Action class not found)

java,xml,jsp,struts2
The error which I am getting. It was running all fine a day before but when open it today I get the following errors. Action class [com.tutorialspoint.struts2.HelloWorldAction] not found - action - file:/C:/Users/sai/Struts2/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/HelloWorldStruts2/WEB-INF/classes/struts.xml:10:30 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:374) at...

Login page filter problems

jsp,servlets,servlet-filters
I'm trying to apply a filter to my login page. I'm just not sure how it works, since I'm not too familiar with filters. I'm trying to redirect a user that logs in to different pages based on their user type. A user has either the user type 'Customer', 'Owner'...

PropertyNotFoundException in jsp

java,jsp
Am getting this error in my application javax.el.PropertyNotFoundException: Property 'survey_id' not found on type com.moh.forms.MOH731 javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:229) javax.el.BeanELResolver$BeanProperties.access$400(BeanELResolver.java:206) javax.el.BeanELResolver.property(BeanELResolver.java:317) javax.el.BeanELResolver.getValue(BeanELResolver.java:85) This is my MOH731.java @Id @GeneratedValue(strategy = GenerationType.AUTO) private int survey_id; public MOH731 (int survey_id, String uname)...

MySQLSyntaxErrorException in SQL syntax

java,mysql,jsp,mysql-connector
I am trying to select data from a table using prepared statement. But it seems like I am getting syntax error which I cannot solve alone. try { Class.forName("com.mysql.jdbc.Driver"); String url = "jdbc:mysql://localhost:3306/mydb"; String dbusername = "root"; String dbpassword = ""; // Change it to your Password // Setup the...

Struts2 / jQuery: resume link href redirect after e.preventDefault();

jquery,jsp,struts2,preventdefault
On my Struts2 application, I have some buttons that will delete items from a table. So far, so good. Now, I'm trying to use jQuery to present the users with an alert to confirm if they really want to delete the chosen item. To do this, what I have in...

Getting checkboxes check state

java,jsp
I am trying to get the check boxes' check state with the code below but ended up with the following error if the any of the checkboxes are not checked. My goal is to update the database table with the checkbox state. if checked then 1 else 0. Error: Severe:...

JSP EL not working - javax.el.PropertyNotFoundException: Property 'name' not found on type java.lang.String

jsp,el
I have a problem with JSP EL that i figure it out. In my Servlet doGet() method i'm using this code to retrieve data from data base : UserServices us = new UserServices(); List<User> users= us.allUsers(); request.setAttribute("users", users); request.getRequestDispatcher("/list_users.jsp").forward(request, response); The Problem is when i use JSP Scriplets & Expressions...

Form submit portlet with Spring MVC

java,jsp,spring-mvc,liferay,portlet
I'm trying to achieve a Liferay portlet of submit form using spring MVC. The model: package com.model; public class Person { String firstName; String middleName; public String getFirstName() { return this.firstName; } public String getMiddleName() { return this.middleName; } public void setFirstName(String firstName) { this.firstName=firstName; } public void setMiddleName(String middleName)...

Open a properties file from a class in a Dynamic Web Project

java,eclipse,jsp,properties-file
I'm using Eclipse for EE Developer. I need to access to a properties file (db.properties) from a class's method (DBQuery.java). The class is located inside a package inside the src folder. For the properties file i tried almost everything that i could find over the net to make it work,...

when is servlet response committed or flushed?

java,jsp,servlets,forward,requestdispatcher
According to javadoc: in-request.getRequestDispatcher("/Test").forward(request,response); forward should be called before the response has been committed to the client (before response body output has been flushed).Uncommitted output in the response buffer is automatically cleared before the forward. I am getting confused when this response is committed or been flushed? is this writing...

struts dialog box not taking jsp scriplet

java,jquery,jsp,struts2,ognl
I am using struts dialog box in a jsp page. I want that id of each dialog box should be dynamic. For that I am doing this code - <% int counter = 0; %> <s:iterator var="RP" value="campaignList" status="currRow"> <% counter++; %> <sj:dialog id="DivQuestionAnswer<%=counter%>" autoOpen="false" modal="true" width="750" cssStyle="font-size: 15px;" title="Question...

Remove prefix and suffix of page url in spring MVC

java,spring,jsp,spring-mvc
I created controller using spring mvc: @Controller public class MyController { @RequestMapping("/") public String showHome() { return “/WEB-INF/pages/home.jsp"; } @RequestMapping(“/users") public String showUser() { return "/WEB-INF/pages/users.jsp"; } } I want to avoid writing this /WEB-INF/pages in each method and controller, is there any way to write only the name of...

How to exclude one textbox from the others that are using isNumeric validation with jQuery?

jquery,jsp
I'm using jQuery 1.11x in a jsp page with textboxes. I'm working with five text boxes and I need to make sure they all have numeric entries, however, I want to exclude the first one as it has a string representation of a date in it and I validate that...

Servlet path is not included in

jsp,url,servlets,jstl
I have a simple Java Webapp (eg. test) containing two different SpringMVC application. My web.xml maps them as: <servlet-mapping> <servlet-name>web</servlet-name> <url-pattern>/web/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>restful</servlet-name> <url-pattern>/restful/*</url-pattern> </servlet-mapping> Inside the web part I'm using "classic" libraries, such as JSTL core. I don't understand how to avoid JSTL c:url tag ignoring the URL...

Why paging query does not work

java,jsp,java-ee,servlets,jdbc
The main function of this program is to write a page displays the contents of the database and can achieve Pagination When you first visit the page can display the contents of the database,But when you click on the link below when the page is not able to properly display...

how to link external js file in jsp

javascript,jsp
Went through other similar question on SO, but unable to fix my issue. I have written src path inside script tag. Below is the program: function validate() { var fname = document.myForm.fname.value; var lname = document.myForm.lname.value; if(fname=="" && lname=="") { alert("First and last name cannot be emtpy"); return false; }...

html form action not working when using eclipse

java,eclipse,jsp,servlets
I am new to JSP and Java Servlet. I was going through this tutorial by Java Brains. In this tutorial get and post method is handled. I wrote my html code under web-content. </head> <body> <form action="http://localhost:8080/SimpleServletProject/hello" method="post"> <input name="userName" /> <input type="submit" /> </form> </body> Following is the hello.java...

How to trigger a doGet before displaying a jsp page

jsp,java-ee,web.xml
I have a webpage which is named export.jsp, when the user acces domain/export.jsp, I want him to automatically download a csv file via the doGet method of a servlet. Afterwards I want to display the actual jsp file, which is export.jsp My doGet method is as follows: protected void doGet(HttpServletRequest...

Can't refresh page and hold selected value on jsp page

javascript,jquery,jsp
Here is my jsp page code: <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page import="java.sql.*"%> <%@ page import="java.io.*"%> <%@ page import="java.util.*"%> <%@ page import="test.Obiekt"%> <%@ page import="test.ListaObiektow"%> <%@ page import="test.Termin"%> <%@ page import="test.ListaTerminow"%> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>menu główne</title> <meta name="viewport"...

How to open a link given on jsp in browser

java,jsp
I have given a link on the jsp , which is a dynamic value and I am printing it on the jsp by using - "s:property value="link" /". When the user is clicking on it, the link value gets appended with the url of my project , and hence is...

JSP form sending data including files in servlet

java,jsp,servlets,post,get
I am tryig to send some data from jsp form to a servlet. All my data are type="text" except from one that is type="file". I know that if i want to send the data to my servlet, i have to use request.getParameter(...). (My data) In order not to be null...

Why Spring doesn't load index.html as welcome file

java,jsp
My Spring project doesn't load with index.html as welcome file but if I rename it to index.jsp then it works fine. Why? My web.xml <servlet> <servlet-name>springmvc</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>springmvc</servlet-name> <url-pattern>*.html</url-pattern> </servlet-mapping> <welcome-file-list>...

viewResolver with more folders inside of WEB-INF/jsp is not working in spring

java,spring,jsp,spring-mvc
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /> <!-- avoid '???' --> <property name="prefix" value="/WEB-INF/jsp/" /> <property name="suffix" value=".jsp"/> </bean> if i create other subfolders under jsp , for instance /WEB-INF/jsp/reports , /WEB-INF/jsp/insertions how should i configure now the viewResolver to can resolve these new sub folders??...

Can you make JSP to crash on undeclared variables?

java,jsp
We've noticed that undeclared variables in JSP can cause really bad performance. Look at the following sample code: <c:if test="..."> <c:set var="isSaleCategory" value="true"/> </c:if> <c:forEach items="${ARTICLES}" var="article" varStatus="status"> <c:if test="${not empty articlePrice && (!isSaleCategory)}"> The code took 5-6 seconds to process and return a result. If we initialize the variable...

Username and password validation from database to jsp view page

java,javascript,jsp,servlets
If the username and password retrieved from database are incorrect then I would like to show error on jsp page itself instead of re-directing to another page. Right now I am showing a message from the validation servlet if the username and passwords are invalid. How do I show a...

Looping Arraylist of Arrays java

java,arrays,jsp,arraylist,javabeans
I have a method in the model that creates an ArrayList array me from a resultset, I need is cross it from jsp, I could not do, any help? This is the code of the arraylist public ArrayList listar(){ String sql="select * from eventos"; ArrayList lista=new ArrayList(); try { st=con.createStatement();...

HTTP Status 500 - java.lang.LinkageError - Servlets

java,jsp,maven,servlets,web.xml
I'm trying to configure a simple page with JSP and getting an error. My web.xml is: <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> <display-name>ERPWep-calendar</display-name> <servlet> <servlet-name>calendar</servlet-name>...

How to get attribute from this request?

java,jsp
Servlet Code: protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String action = request.getParameter("action"); Connection conn = null; try { conn = ds.getConnection(); } catch (SQLException e) { throw new ServletException(); } UserOperations uo = new UserOperations(conn); if (action.equals("mainbutton")) { String name = request.getParameter("name"); String surname = request.getParameter("surname");...

Initialize class with constructor in

jsp,servlets,usebean
I am trying to initialize a class by passing a parameter to the constructor. I need the scope to be "page". I know I have one argument in my constructor, but how do I have one that accepts parameter using <jsp:useBean>, and can be called from a JSP page? public...

How to get current jsp file path in war?

java,jsp
Due to lot of forward request, it is hard to identify the current showing jsp file. Is it possible to get the current jsp file path in war? How to achieve? For an example: URL: http://localhost:8080/controller/action File Path: /view/dev/test.jsp <%= getServletContext().getRealPath("/") %> The above statement doesn't work, it show C:\Projects\test\build\web\...

How to set div's id with jQuery function?

javascript,jquery,function,jsp,expander
I receive list of feed items from Servlets <c:forEach items="${feedItemsList}" var="feedItem"> <table class="contentItem"> <tr> <td> <div id="block"> <a id="" href="javascript:showFeedItem(${feedItem.id});"><c:out value="${feedItem.title}" /></a> </div> <div class="feedItemExpander" id="${feedItem.id}">...My info...</div> </td> </tr> </table> </c:forEach> I want to expand and collapse div with id=${feedItem.id}. Clicking on <a id=""...

adding parts of a javabean together

java,jsp,javabeans
How do I take the return values of some methods that I wrote in a bean and add them together for an return? For instance: public double getPart1Average() { String[] average = new String[]{Part01, Part02, Part03}; int sum = 0; for (String input : average) { sum += Integer.parseInt(input); }...

Struts 2 could not find a result for success returned from an action

java,osx,jsp,netbeans,struts2
I'm not a native English speaker, so my apologizes if I made some idiomatic mistake. I'm completely new on Struts2. I developed a web project that contains 3 JSP pages, a deployment descriptor (web.xml), a struts configuration file (struts.xml) with 2 actions configured inside (an action named index and an...

How to display text in browsers tab bar in a javaserver page [closed]

html,jsp,browser,text,tabs
I have heard of being able to display images in a browsers tab bar here: http://stackoverflow.com/questions/120420/image-icon-beside-the-site-url But I was wondering if there might be an easier way to do this for just some simple text? I am trying to display just two lines, last login and IP address in this...

Javax JCR Node getProperties and Titles

java,swing,jsp,nodes,jcr
I am given a Node and I then request form it another Node. Node nn = node.getNode("jcr:content"); From here I can do the following to get the value of nn.getProperty("cq:lastModified") What I am trying to do is get all the properties without asking for each one by name. Node nn...

Need to add elements of an array to a variable of JavaScript in JSP

javascript,arrays,jsp,jstl
I am creating an array for a list of markers of google map. The code works for one forEach loop but I need to add elements of a new array to the list as well. My current code shows following error message on var of result2. Syntax error on token...

Jsp list output [email protected]?

jsp,spring-mvc,spring-boot
I have a list of tweets inside a user and when I iterate through them all I get is the object but not the actual text <c:forEach items = "${tweets}" var="user" ></c:forEach> <h1><c:out value="${user.tweets}" /></h1> </div> how do I get the value of the tweets, they all save as text...

How to get specific values from select menu and use her in mysql query?

java,mysql,jsp
In my jsp page i have select menu which shows parts of List: <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page import="java.sql.*"%> <%@ page import="java.io.*"%> <%@ page import="java.util.*"%> <%@ page import="test.Obiekt"%> <%@ page import="test.ListaObiektow"%> <%@ page import="test.Termin"%> <%@ page import="test.ListaTerminow"%> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>menu...

Print and println aren't executed in the same time

java,jsp,servlets,printing,println
I have a method in my servlet where I have some prints to the console.. private void collectingWorkPositions(HttpSession session, HttpServletRequest request) { System.out.println("Collecting1.."); //code... System.out.println("Collecting2.."); //code... System.out.print("printing p: "); for(Integer i:p) System.out.print(i + " "); } When this method iscalled, only Collecting1.. Collecting2.. are printed in the console. When I...

Chinese characters in properties files are not properly decoded [duplicate]

java,spring,jsp,encoding
This question already has an answer here: Internationalization using resource bundle properties in JSP, non-Latin text becomes Mojibake 1 answer I have used localisation for my application in Chinese and English. It is a Spring MVC application and I am getting the values from a properties file. I have...

Onchange in Struts2 textfield

java,javascript,jquery,jsp,struts2
I want to get all records from DB to JSP based on a string what I enters in S2 textfiled. While typing in textfiled only I want to get those all records as a table in JSP. Ex: In textfiled, while I typing 'a' then I want to display all...

reset value of all dropdowns in the page

java,javascript,ajax,jsp
Here is how my page looks like: When the page is loaded, the Subtype will have some values generated. The list Coverage Name is dependent on the value of Subtype, and will be generated based on what is selected on Subtype. Similarly, the list Table Name is dependent on the...

Get JSP output within Servlet in AEM

java,jsp,servlets,cq5,aem
In CQ, we need to process jsp within servlet then combine the result with other results we get from server before writing back to browser. The following code is almost what we need, except that it writes the result back to browser after processing jsp. RequestDispatcher dispatcher = request.getRequestDispatcher(resource); dispatcher.forward(request,...

need a javascript function that reads dynamic check box id on jsp

java,javascript,jsp
i have included a dynamic checkbox using rs.getstring. i need to know which checkbox is checked. <th> <input type="checkbox" name="chkSingle_<%=counter %>" id ="chkSingle_<%= counter%>" value="<%=rs.getInt(11)%>"> </th> ...

Struts2 - passing data from jsp form fields with same name to action class

jsp,struts2,struts-action
In my struts form I have couple of fields (textfields) with the same name. They all carry the same information (through js change event). However, in the action class, they are imported as comma separated values instead of the value once. Here is a snippet from item.jsp: <s:select label="Part of...

How to pass data from page to Portlet class through AJAX call?

ajax,jsp,liferay,portlet
I'm trying to pass a value in an AJAX 'GET' request to my Portlet class, but I can't quite figure out a way to access such variable's value in the class. My AJAX code is: function loadXMLDoc() { var nocache = new Date().getTime(); var xmlhttp=new XMLHttpRequest(); var url = "${mURL}";...

Spring MVC link with .jsp/.jsp suffix returns 404

java,spring,jsp,spring-mvc
I have a simple page called headers.jsp in my Spring-MVC (4.1.5.RELEASE) web-app which i would like to call up from my index page like this: <body> <c:url value="/headers" var="headersUrl1"/> <c:url value="/headers.jsp" var="headersUrl2"/> <c:url value="/headers.jspx" var="headersUrl3"/> <ul> <li><a href="${headersUrl1}">Works!</a></li> <li><a href="${headersUrl2}">Does not work!</a></li> <li><a href="${headersUrl3}">Does not...

AJAX call to Servlet Google App Engine (GAE)

java,ajax,jsp,google-app-engine,servlets
I am trying to make an AJAX call to my servlet but it doesn't work. I can't redirect to a JSP. This is my AJAX call: $.ajax({ url: '/register', type: 'GET' }); This is my Servlet: public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { getServletContext().getRequestDispatcher("/prueba.jsp").forward(req, resp); } If...

Can't insert or update record to database jsp

java,jsp,jdbc
I am creating a form that is used to insert, update and delete data in a database, managed to do everything right but update and insert are not functioning. Delete works fine. Any help with solution will be highly appreciated FirstController package com.firstmohform.controller; import com.firstmohform.dao.FirstDAO; import java.io.IOException; import java.io.PrintWriter; import...

Struts2 jqGrid DatePicker in Column Filter

jquery,jsp,struts2,jqgrid,datepicker
I have a jsp running Struts2 jqGrid plugin. I have enabled the filter row at the top of the grid, one of the columns is a date column and I want to be able to change the textbox at the top of the column into a DatePicker. The id of...

Bad request 400

java,spring,hibernate,jsp,model-view-controller
I have Spring/Hibernate/MVC/Maven application. I want to send an ID of my object through request URI. This is my controller: @RequestMapping(value = "/editCase", method = RequestMethod.GET) public String getEditCase(@PathVariable("id") Long id, ModelMap model) { System.out.println("reached!"); .... return "editCase"; } But when I try to retrieve this page, I get 400...

HTTP Status 500 - Servlet execution threw an exception (java.lang.ClassNotFoundException)

java,jsp,servlets,twitter
I have been getting this resource not found error and I'm not able to figure out whats wrong with my code. Here is my code. TwitterServlet.java: package com.dhruvil.jsw; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import twitter4j.Status;...

property nth-child seems not working in JSP CSS

css,css3,jsp
I created a program that fill in a table with data of a table called usuarios but the property nth-child seems not working All the rows have the same color, which is greenyellow; . I am using Netbeans and Glassfish <%-- Document : basededatos Created on : 14/06/2015, 01:23:57 Author...

Radio button group name

java,jsp
I have a radio button group in a jsp page populated from database as follows; <c:forEach var="attCat" items="${attCat}"> <input type="radio" name="rdCat_${iter.index}" value="${attCat.catId}"><span style="font-size: x-small;">${attCat.category}</span> </c:forEach> when I retrieve the values I get null point exception String[] cat = request.getParameterValues("rdCat_${iter.index}"); the radio button names appear in the html as rdCat_1, rdCat_2...

`null` result from request in servlets

java,jsp,servlets
I am new in servlets- I am filling text in form but value in request is null- In login page- <body> <form action=""> <input type="text" name="uname"> <input type="text" name="pwd"> <a href="display.jsp">link</a> </form> </body> In DisplayPage- <body> Display: <% String uname=(String)request.getParameter("uname"); String upass=(String)request.getParameter("pwd"); out.println(uname+" - "+upass); Enumeration<String> enumeration = request.getParameterNames(); boolean...

JSP - issue with custom Taglib

java,jsp
I just tried to add a custom taglib to my project, such that the testtaglib.tld file contains: <taglib> <tlibversion>1.0</tlibversion> <jspversion>1.1</jspversion> <shortname>name</shortname> <tag> <name>test</name> <tagclass>taglib.TestTaglib</tagclass> <bodycontent>empty</bodycontent> <attribute> <name>testCode</name> <required>true</required> <rtexprvalue>true</rtexprvalue>...

Error while including jsp with angular inside non angular jsp

javascript,angularjs,jsp
I included a jsp with angular directives (A.jsp) inside a non-angular jsp(B.jsp). If I access A.jsp directly those models "{{X}} {{Y}}" are resolving correctly to Xvalue Yvalue But if I access A.jsp through B.jsp I am seeing unresolved ng-model s. {{X}} {{Y}} What could be the reason? My code: Inside...

Unable to include servlet response by using requestDispathser

java,jsp,servlets,requestdispatcher
Index.jsp <form method="post" action="serv"> Enter Latest Reading <input type="text" name="t1"> <br> Enter Previous Reading <input type="text" name="t2"> <br> <input type="submit" value="SEND"> </form> LoginServlet.java @WebServlet("/serv") public class LoginServlet extends HttpServlet { protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { PrintWriter out = res.getWriter(); out.println("<u>Following are your Bill...

After redirect code still executing from previos page

java,jsp,servlets
How System.out.println("") is executed after response has been redirected to other resource. In my code: res.sendRedirect("/more_value_in_param/display.jsp"); System.out.println("to avoid penalty and disconnection"); Why in console to avoid penalty and disconnection is being displayed since response has been already redirected to display.jsp?...

set focus to next input element after jsf's change value listener

javascript,jsp,jsf
in one of our front-end screens we have the following layout as follows <h:outputLabel for="firstName" value="first name" /> <h:inputText styleClass="required" id="firstName" size="30" maxlength="30" value="#{ownershipStoreInfoController.form.ownerFirstName}" onchange="submit()" valueChangeListener="#{ownershipStoreInfoController.useOwnerInfo}"> <e:validateRegExpr pattern="([A-Z,a-z,0-9,%@()#&amp;,.;:_\$\/\-\{\}\[\]\'\\s*]{1,30})?" /> </h:inputText> <h:outputLabel for="lastName" value="last name"...

call bpel process from jsp

web-services,jsp,bpel
I've created a BPEL process and tested it with soapUI, it works and gives the right results. Now I need to call it from a J2EE web application, I've googled how this could be done but I'm totally confused, I don't know if I need to use SOAP or JAX-WS...

Intellij web application on tomcat server shows http://localhost:8080/index.jsp instead of http://localhost:8080/myapp/index.jsp

java,jsp,tomcat,servlets,intellij-idea
I'm following a tutorial on udemy. In the tutorial he is using eclipse. But i'm following the course with intellij. Every thing works fine but one thing i keep noticing is that when he runs the servlets or jsp pages it is always shows the project name before the servlet(http://localhost:8080/myapp/index.jsp)....

How to style div with jQuery?

javascript,jquery,css,jsp
<c:forEach items="${list}" var="item"> <div class="block" id="${item.id}" style="background: black"></div> </c:forEach> Is it possible style div depends on current item.id avoiding jsp <c:choose> <c:when test="${ item.num == 0}"> inside div when first load the page? item.num can be 1 or 0. Need something like this: if(item.num==0){ style="background: black" }else{ style="background: transparant"...

How to open a new page when button is clicked on

java,html,jsp,servlets,web-applications
The question is vague so allow me to clarify. I am developing a web app locally on eclipse and using Servlets, JSP, and an html document to design a web page. I have a home page which has two buttons, signup and login. I have one file, called index.jsp, which...

Dynamic attributes in a jsp tag

java,jsp
I want to have a tag with dynamic attributes, like simple html tags, e.g. something like this: <tags:superTag dynamicAttribute1="value" someOtherAttribute="valueOfSomeOther"/> And in my implementation of tag I want to have something like this: public class DynamicAttributesTag { private Map<String,String> dynamicAttributes; public Map<String, String> getDynamicAttributes() { return dynamicAttributes; } public void...

Ajax response doesn't display in JSP page

java,jquery,ajax,jsp,servlets
I'm Trying to Save small record using JSP ajax in technology. The project working procedure is like this. 01. index.jsp : Send data to SaveStudent servlet 02. SaveStudent : Get request form jsp and send it to validation java class 03. Validation : Validate data and Send to DaoImpl java...

I want to call a Servlet as a very first file

java,jsp,servlets
I want to call a Servlet as a very first file to execute like welcome file. In this servlet I am retrieving data from database and rendering it to display page at a very first page. what I need is when I run program either url should be-http://localhost:8083/projectName/servletUrl not http://localhost:8083/projectName/...

Using Hibernate on JSP

java,hibernate,jsp
So i went to the website and downloaded hibernate release 4 and i extracted and i created a library in my eclipse and i added all the needed jars but it shows that my hibernate import is not working well.. am i importing them wrongly? any help would do. This...

Why is my Set variable throwing error when doing a many-many query?

java,spring,hibernate,jsp,spring-mvc
I am new to spring and hibernate. I have created a spring-mvc app with hibernate integration and when I run the code I get the below error. My requirement is to pick the relevant path from the advertisement given the customer category. This involves two tables respectively along with the...

Restriction on number of opened tabs

javascript,jsp,web,struts2,browser-tab
There are some links on web-page. On right click there is option of 'open link in new tab'(browser option). I want to restrict user for not opening more that two tabs? How can i do this? <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">...

Show and hide select input which is created dynamically

jquery,jsp,show-hide
I want to show a select form (which is hidden), when a checkbox is checked. I have coded this bootply which is working right. However, in my JSP page depending what an object contains, many checkboxes are printed, which all of them contain the .action-do class so, what is happening...

unable to validate username and password from DB in jsp login form

java,jsp
After registration, user will see this form where all the details from registration form are captured into database <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <h3>Email confirmation has been sent to your email address</h3> <a href="http://localhost:6060/JSP_RegistrationAndLoginForm/LoginForm.jsp">click here to login</a> </body> </html> Login Form: <%@page contentType="text/html"...

Is it not possible to directly invoke session.getAttribute() with EL?

jsp,el,session-scope
The value for 'email' is set within session scope using session.setAttribute("email", "[email protected]"). To display the value later, the following code was used <c:out value='${session.getAttribute("email")}'> </c:out> This yielded no output on the screen. Note that the necessary packages were imported and that there is no error produced. However, if I re-write...

loop thru divs in jsp

jquery,html,css,jsp
I tried searching on how to do this but was not able to get the thing that I need. I have a database and I would like a div display its content. I was able to show it through a table and have it on for each like this. <c:forEach...

How to use button instead input, style input?

css,forms,jsp,servlets,post
My form: <form method="POST" action="AController"> <div class="userInput"> <table class="userInput"> <tr> <td><input type="text" id="username" name="login"></td> </tr> <tr> <td><input type="submit" id="submitRegInput" name="reg" value="Submit"></td> </tr> </table> </div> </form> I'm trying to style <input type="submit" id="submitRegInput" name="reg" value="Submit"> like this: #submitRegInput { background: no-repeat...

Set default value for struts 2 autocompleter

jquery,jsp,struts2,struts2-jquery,struts2-jquery-plugin
I have implemented a struts 2 autocompleter in which i have used a list of String like this - <sj:autocompleter id="cityId" cssClass="txtfield8" name="outlet.cityName" list="cityList" autoComplete="true" forceValidOption="false" /> How can I set a default value for this, so that every time it loads, a default value will be shown ?...

Requested Resource is not available error

java,jsp,servlets,twitter4j
I'm trying to build a twitter search using jsp, servlet, Tomcat-6.0.43 and eclipse and getting HTTP Status 404 error. Can anyone please check where am I going wrong. My Code: first.jsp: <%@ 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"> <html> <head> <meta http-equiv="Content-Type" content="text/html;...

unable to pass two lits to the jsp using apachi tiles

hibernate,jsp,spring-mvc,tiles
i am using spring mvc with Apache tile and hibernate.i pass tow lists to the jsp page.but it is print by but there's no any thing prints. my controller class as follows : if(userExists!=0){ model.addAttribute("Maintabs",new Maintab()); model.addAttribute("MaintabsList",loginService.listMaintabs()); model.addAttribute("Subtabs",new Subtab()); model.addAttribute("SubtabsList",loginService.listSubtab(userExists)); return "redirect:/Loginsucess"; }else{ model.addAttribute("error", "ERROR : invaliduser !,Please Try Again!");...

Problems with select form population in JSP

java,jsp,servlets,jstl
I want to pass List object to html select. The problem is, nothing appends to html select. Here is a Obiekt class: package test; public class Obiekt { private String nazwa; private String adres; private String dyscyplina; private int idObiekt; private int idTermin; public String getNazwa() { return nazwa; }...

java.sql.SQLException: ORA-01830: date format picture ends before converting entire input string

java,oracle,jsp
I am tring to select all values from the database between two different timestamp <form action="index.jsp" METHOD="POST" > <table border="2" style="border-collapse: collapse;"> <tr> <td>SELECT THE TO DATE</td><td><input name="dt" type="text" id="datepicker" readonly="readonly" size="20"/></td> <td >SELECT FROM DATE </td><td><input name="dt1" type="text" id="datepicker2" readonly="readonly" size="20"/></td> </tr> <tr><td colspan="4"><input...

Spring passing ModelMap model attributes to JSP

java,spring,jsp
I am having problems with passing ModelMap attribute to tsp page. The Intelij IDEA recognizes the variable passing well, but when I deploy an application on tomcat, and the actual page is loaded, I can see only variable names, instead of variable values. Trying to print some data to .jsp...

How to compile and run a JSP Beans project using Eclipse

java,html,eclipse,jsp
I am a noob trying to learn what I can about JSPs. I am using Eclipse as my ide and have run into a small problem that I hope someone can help me out with. I have a dynamic web project with the following files: index.html <!DOCTYPE html> <html> <head>...

How to access application data in a session .jsp file

java,html,jsp,session,user
I am new to the javaservice page session environment, and I am executing the following loop to view all my session attributes: <% for (Enumeration e = session.getAttributeNames(); e.hasMoreElements(); ) { String attribName = (String) e.nextElement(); Object attribValue = session.getAttribute(attribName); %> <BR> <%= attribName %> - <%= attribValue %> Which...

session.update not updating in db

java,spring,hibernate,jsp,spring-mvc
I have a jsp page i which i am sending a model attribute from controller and after that making some changes in the properties of model attribute. it is reflecting the model attribute but not updating in database. My code is - spring-servlet.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"...

Servlet to jsp on button click - whats the error?

java,jsp,servlets
I have a simple form on a jsp page, as given below. On clicking the button, it should take us to a servlet by the name of LoginValidation. But it doesn't work. <form name="login_form" action="LoginValidation" method="get" onsubmit="return func()" > <input type="text" placeholder="Username" id="username" class="style-4" /> <input type="password" placeholder="Password" id="pass" class="style-4"...

how to return two lists from controller class in spring mvc

java,hibernate,jsp,spring-mvc,tiles
I have two tables call maintab,subtab for generate menubar. maintab has maitabId ,main_tab_name subtab has: sub_tb_ID ,main_tb_id,subtab_name ,Url I want to get two list containig list1=maintabid & maintabname list2=subtabname,maintabID & url I want to return the two list using spring mvc. And retrieve in jsp page to populate a menu.Please...

on clicking pass value of anchor tag to another file

java,html,jsp
I am trying to print the data from my database as anchor tags and pass the value(in rs.getString(1)) to next jsp file(demo.jsp) on clicking it. I tried to make a session and retrieve the values from it, in file demo.jsp but it is always printing the last values in database....

Session attribute is null at first load

java,jsp,servlets
I have the following servlet: @WebServlet(name = "Placeholder",urlPatterns = {"/foo"}) public class Placeholder extends HttpServlet { public static int numbers=5; HttpSession session; public void doGet (HttpServletRequest _req, HttpServletResponse _res) throws ServletException, IOException { /* Refresh session attributes */ session = _req.getSession(); session.setAttribute("wee","ok"); } } With the following JSP: <%@page language="java"...

Sending text file to client through Spring MVC web application

java,spring,jsp,spring-mvc,servlets
After doing some research online on the subject I currently managed to get things working with this code: @RequestMapping(value = "/report040Generated", method = RequestMethod.GET) public String index(Model model, HttpServletResponse response, HttpServletRequest request) throws IOException { String myString = "Hello"; response.setContentType("text/plain"); response.setHeader("Content-Disposition","attachment;filename=myFile.txt"); ServletOutputStream out = response.getOutputStream(); out.println(myString); out.flush(); out.close(); return...

How to keep a variable in the URL when using Spring LocaleChangeInterceptor

java,spring,jsp,spring-mvc,internationalization
I have a page at this URL http://localhost:8080/SpringExercises/admin/manageMenuDetail?id=1. I use Spring LocaleChangeInterceptor to handle languages. When I try to change the language by clicking on a link like "?lang=it" I get an error, because id is null. I suppose Spring turns .../SpringExercises/admin/manageMenuDetail?id=1 into .../SpringExercises/admin/manageMenuDetail?lang=it forgetting to write ?id=1 Can Spring...

Why ${!blabla.blibli} returns true in JSTL even if blabla doesn't exist?

java,jsp,jstl
As mentionned in the title, I don't understand why when the variable blabla does not exist I have: ${blabla.blabla} which returns nothing and ${!blabla.blabla} which returns true I guess that there is an implicit exception catch in the jstl evaluation but I can't understand the inner process and why it...

How to make a youtube link as embed?

java,jsp,substring
<% String song = request.getParameter("songname"); String band = request.getParameter("band"); String url = request.getParameter("url"); %> <div align="center"> <br><br> <% out.print(band + " - " + song); %><br><br> <iframe width="560" height="315" src="<%out.print(url);%>" frameborder="0" allowfullscreen></iframe> </div> <% %> Let's say url i get is like this https://www.youtube.com/watch?v=kXYiU_JCYtU i want to make it look...