Writing a variable into the JSP request scope doesn't work

I have a problem where I am trying to set a variable in a JSP page that should be available to all other pages serving this request. <c:set value="foo" scope="request" var="bar" /> However, when I try to read the variable from another page (the master JSP that puts everything together) it is empty. Should this ever happen? Is there something I need to look out for in our rendering mechanism? (I already wrote little scriptlets that printed the memory location of the request object, and i

Adding element to a collection in a JSP in Spring MVC

I am displaying values from a set on a bean called AttributeDefinition which has a Set of ValidValues. I am able to display the set and change the values using the JSP below: <c:forEach items="${attributeDefinition.validValues}" var="validValue" varStatus="validValueRow"> <form:hidden path="validValues[${validValueRow.index}].id"/> <tr> <td><form:input path="validValues[${validValueRow.index}].value"/></td> </tr> </c:forEach>

REST API with web application(JSP,Servlets)

I have one normal servlet and one jersey specific REST related servlet i.e.ServletContainer configured in web.xml. Case 1 - Url pattern for normal servlet is "/login" Url pattern for other REST servlet is "/" In this case all request will got REST servlet. Request for login also goes to tht Servlet only. Case 2 - If Url pattern for REST servlet changed to "/rest/ " (which root path of my test resource class) And Url pattern for normal servlet as it was "/login" Only normal request for /login w

select from a dropdown list based on selection from another dropdown list in jsp

I have two dropdown, one with all account ids and one with corresponding email ids. if I select one entry from account id, corresponding email-id should be selected automatically in the other dropdown. (account id and email-ids are one to one relation ship. first accound id corresponds to first email id etc.) how can we do that in JSP ? see my dropdowns here: <td> 1. Member Account Number <span class="bodyCopy"> <font color="#ff0000"> * </font> </spa

Jsp Error while launching Compute Emulator for Azure in eclipse

hi I have been trying to run a simple HelloWorld.jsp in Azure . I have folowed the link http://java.interoperabilitybridges.com/articles/deploying-a-java-application-to-windows-azure-with-eclipse as it is . But when i launch the DisplayEmulatorUI.cmd ,i get an error: "Synchronisation failed .There was no endpoint listening at net.pipe://localhost/dfService/1/DevelopmentFabric that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerEx

Jsp trouble with <div> rendering

I have trouble with while rendering. my jsp code is something like : <h1 class="noBtmPadding"> <spring:message code="${pageHeader}"/> </h1> <c:if test="${not empty validationBean.message}"> <span id="error"> ${validationBean.message}</span> </c:if> <tiles:insertAttribute name="questionContent"/> <div id="buttons" align="right"> <input type="submit" value='<spring:message code="saveAndExit"/>' name="_eventId_saveAndExit"/>

Filling a HTML form with properties from a Java Bean and JSP?

I have webpage with a form like this: <html> <head> ... </head> <body> <form id="form4" name="form4" method="post" action="Receive.jsp"> <input name="inputField1" type="text"/> ... <input type="submit" value="Send"/> </form> </body> </html> Then in my Receive.jsp I use: <jsp:useBean id="form4" class="control.FormBean4" scope="session"/> <jsp:setProperty name="form4" property="*"/> To get all the input

Jsp Invalidating session in Sun one Applications server 7.1

I am facing a problem on sessions using Servlets and JSP when user login/logout in my application displaying last accessed usernames. When the user logged succussfully in application I am putting user information into session like HttpSession ssession=request.getSession(false); session.setattribute(username,"username"); When user clicks on loggout in application. I wrote code HttpSession ssession=request.getSession(false); if(session!=null){ session.invalidate(); } response.setHeader("

Jsp how to modify <s:textfield> to fetch a value from Applicationresources.properties file

I am developing a simple GUI in which i want username value to be fetched from ApplicationResources.properties file. My file contains following two lines : label.username= Username label.password=Password I am using JSP containing struts 2 tag contains following snippet : <s:textfield cssClass="login-inp" name="username" key="label.username" size="20" /> But when i run my project i see label.username that indicates value from properties file is not read.. am i missing something ?

How to Create a JSP Page Table And Record Actions

I am bit green on JSP/JSTL so I need a little bit of help. I have a web page design that looks like ====================================================== = Name SSN Address = = = = = = Add Row = ====================================================== As user clicks on "Add Row", a new row is added to the table. The us

Jsp I hav a java ee application and i want to assign from two drop downs

I hava an assignment in which to create a java ee application with the ability to assign a tutor to an office, i have two entity classes one called Tutors.java and the other Offices.java. The drop downs populate but when i want to assign the two values and hit the submit button it throws a null pointer at the server.allocateTutorOffice in the java bean. I realise the problem is with the server class but I'm unsure how to change it to solve the problem. TutorBean.java public void allocateTu

Jsp Display tag append query parameters to sort URL

I am currently using displaytag with spring MVC like so: <display:table class="displayTag" name="${searchList}" requestURI="" sort="external"> <display:column title="Name" property="name" href="viewInstitution.htm" paramId="institution" paramProperty="dbId" sortable="true"> </display:table> When hovering over the name column I get a link like so: http://localhost:8080/webapp/institutionManagement.htm?sort=name&dir=desc However I want to append some additional

Cannot get Jasper report to work with jsp/servlet

I've been trying to get Jasper reports to work now for weeks. It works fine in Eclipse, the demo from the Jasper website works. It just won't work from my jsp page in JBoss. My jsp page is pretty basic. It calls a method in a class. It definitely gets to that point because I have output diagnostics. When I call any Jasper method it bombs out with this error: java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.engine.xml.JRXmlDigesterFactory I've dumped jar files e

JSP Programming - response.getWriter().flush(); doesn't work

Expected results: "Hello World" is displayed in the browser. 10 seconds later, "Goodbye happiness." is displayed. What happens: The page sits there loading for 10 seconds, and then "Hello World Goodbye Happiness" are displayed at the end. What I want to do is display the status of a long-running operation as different milestones are reached. Is this possible? I'm using Eclipse EE (with Tomcat) on Windows 7.

Jsp Simple Servlet page navigation for multiple actions not working

I am new to Java EE. Working on demo app. Right now have to work with JSP & Servlet with JDBC for learning. UserServlet.java manage navigation to all user related list, edit and delete operations. All 3 JSP pages has links to navigate that it. JSP pages are at /WEB-INF/admin/. See the dispatch method. Someone please tell me what is wrong and how to use the navigation. Fix it. ERROR for all the links: type Status report message /Navigation/user/delete description The requested resourc

How the session is automatically created in my jsp page if I have not created session object manually?

I am beginner to jsp & servlet. I am learning session handling in it. I have done a simple program which have 3 jsp pages in which one jsp page have hyperlink to jsp page 2. jsp page 2 checks that is there any existing session exists if yes then it dispatches control to jsp page 3 using dispatcher. But if the session object is null then it creats the new session and sets attributes to it and then dispatches control to jsp page 3 using dispatcher. Following is code of all 3 jsp pages; test

Bootstrap tooltip in jsp file...again

sorry this again but I couldn't get it work with the existing solutions. This is a .jsp file running in Tomcat 7. <head> ... <link href="bootstrap.css" rel="stylesheet" type="text/css" /> <script src="bootstrap.js" type="text/javascript"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script> <script type='text/javascript'> $(document).ready(function() { $("[rel=toolti

Jsp Not displaying images in Spring MVC

I know this question has been asked many times, but I'm not able to figure out what the problem is. I have the images folder under the src/main/webapp folder (this a maven web project). I have the index.jsp in the src/main/webapp/WEBINF/views folder. I'm trying to access the images and other resources like css and js like this: <img src="/images/left_arrow.png" alt="" /> But the images are not getting displayed. Here is the web.xml file <web-app xmlns="http://java.sun.com/xml/ns/j

Jsp Error with display tag

I have a List of objects which has the following attributes public class ViewTestCasesBean { private String testcaseName; private String subject; private String description; private List<TestCaseDetailsBean> testList = new ArrayList<TestCaseDetailsBean>(); // GETTERS AND SETTERS SECTION......./////// public String getTestcaseName() { return testcaseName; } public void setTestcaseName(String testcaseName) { this.testcaseName = testcaseName; } public String getSubject() {

Jsp logic iterate is not working

I am working on struts web application. In that I have make use .tld files in my .JSP files.I made use of struts-logic.tld. The problem is that, logic iterate is working properly when I run my application at localhost(at my PC on Tomcate(Windows)), and also on our Linux Demo server. But when I deploy this application on client's Demo Linux Server, logic iterate is not working. Here is the code : <%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> <%@taglib uri="/WEB-INF/struts-h

Jsp How to pass parameter from body page to header page in tiles?

My tiles layout page has three section i.e. header, body and footer. The layout is such that the title of page has to be defined in the header. Is there any way I can title from body page to the header page? tiles.xml <definition name="mobile.base.definition" template="/WEB-INF/jsp/mobile/layout/baseLayout.jsp"> <put-attribute name="header" value="/WEB-INF/jsp/mobile/common/header.jsp" /> <put-attribute name="menu" value="/WEB-INF/jsp/mobile/common/menu.jsp" /> <

Jsp Struts2 if tag not evaluating

I have this code that iterates through a certain collection of objects, I want to perform type checking (or instanceof) operator on each element. however on my <s:if>, it seems to be not evaluating. What am I missing? <s:iterator value = "myQuestions" var = "q" status="key"> <s:checkbox name="myQuestions[%{#key.index}].chosen" /> <s:property value = "%{myQuestions[#key.index].question}"/> <s:if test ="%{myQuestions[#key.index].getClass().simple

How to get values of the rows of a table that are filled in the jsp in the Action class in Struts 2?

I have the following jsp in which I have an option of adding and deleting rows of the table and in each row of the table which have the same fields I have to fill in the options and submit the form. In the action class how do I retrieve the values of the row which I have filled in the JSP as there are more than one row that I fill in the table ? This is my JSP: <table id="fragmentTable" style="height: 100%; width: 100%"> <tr class="tableRow" style='height: 5%;'> <td

JSP form value not populating in Struts Action class

I am new to Struts. I am stuck with a problem. I am trying to populate the JSP form values in to Action class, but I am not getting the values in Action class . Can someone tell me whats is the issue? Here is my JSP. addEmployee.jsp <a:form action="addEmployee"> <a:textfield name="eId" size="20" label="EmployeeID"/> <a:textfield name="eName" size="20" label="EmployeeName"/> <a:textfield name="eCity" size="20" label="EmployeeCity"/> <a:submit value="ADD EMPLOYEE" >

Jsp Getting while using displaytag lib java.lang.NoClassDefFoundError: org/apache/commons/lang/UnhandledException

Getting the following exception in using displaytag-1.2 jar. I have all the necessary library in WEB-INF/lib folder. javax.servlet.ServletException:java.lang.NoClassDefFoundError: org/apache commons/lang /UnhandledException org.apache.catalina.core.ApplicationDispatcher invoke SEVERE: Servlet.service() for servlet jsp threw exception java.lang.ClassNotFoundException: org.apache.commons.lang.UnhandledException org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java

JSP cannot parse form input to integer

I have a Vector Magazines where I keep all the titles of the magazines. I created a form so that people can choose the magazines they want. ... <form action="MagForm.jsp"> <table> <% Vector Magazines; //Already populated with titles for(int i = 0; i < Magazines.size(); i++) { %> <tr> <td> <input type="checkbox" name="mags" value="<%=i%>"> <%out.println(Magazines.get(i)); %><br /> </td>

Jsp request.getParameter() continues to return null value

I am having an issue where request.getParameter() continues to return null value. However, instead of this function, if i pass a manual value, that gets updated correctly. Below is my code: <jsp:useBean id="shopper" class="shopping.User" scope="session"/> <h1>Login</h1> <form method="POST" action="Login"> <h3> Use the form below to login to our site </h3> Enter Username:<input type="text" name="uname"/> <br/>

Jsp c:when is not being evaluated

I have the following form snippet: <div class="form-group"> <form:label class="pull-left" path="officeName">Office Name ${isInternational}</form:label> <form:errors path="officeName" class="error pull-left"></form:errors> <c:choose> <c:when test="${isInternational}"> <form:input path="officeName" type="text" class="form-control" id="officeName" placeholder="Enter Office Name"></form:input> </c:when>

Getting on the right track with Tic-Tac-Toe in JSP

I have such a task in my college: Using JSP create a site that allows a client to play Tic Tac Toe. Every "move" shall be controlled by the server. Game status should be remembered in the session and every move shall be realised by calling the same .jsp page (with appropriate parameter), what will cause drawing it again with a properly updated board. (...) Whole task should be delivered in on JSP file, no war, ear or app files. Structures remembered in session may be standard JDK classes, e.g. H

Jsp Display a list of images with iterator

i have a map Map<String, String> flags; the values of this map are the names of flags' images. flags={fr=Flag_fr.jpg, usa=Flag_usa.jpg...}. Now i want to diplay the list of flags in my web page using the values ofmy map. my page jsp looks as below: <s:iterator value="flags" > <tr> <td> <input type="image" src="%{value}"> </td> </tr> </s:iterator> but the button images are not displayed however when i put the picture is well displaye

Jsp Page redirect on session empty doesn't seem to work

I'm tryting to redirect back to index.jsp if Session User is null and it doesn't seem to work. When the session is null I do get the response "request.getSession() is null" JSP code. <% if (null == session.getAttribute("User")) { // User is not logged in. out.println("request.getSession() is null"); String site = new String("http://localhost:8080/myproject/"); response.setStatus(response.SC_MOVED_TEMPORARILY); response.setHeader("Location", sit

Jsp Spring redirect request to get resources to my controller and should not do that

I am trying to use Polymer in my project. I'm using Spring mvc with Spring security. The problem is spring is displaying all resources as my admin view. Structure: -- webapp -- WEB-INF -- spring -- springs*.xml -- views -- all*.jsp -- web_resources -- bower_components -- layouts Log of one resource request: 2014-11-05T13:04:40.360+0100|Info: Checking match of request : '/web_resources/bower_components/core-elements/core-elements.html'; against '/web_resource

What to do with css for JSP fragment?

I'm writing my first dynamic webpage with JSP. Right now I've got a working index.JSP without a header. I wrote a header.jspf which looks like this: <header> <div id="head"> <img src="images/header/logo.png" alt="logo"> <h1>Rewards</h1> </div> </header> I included the header in my index.JSP with this line: <%@ include file="header.jspf" %>, right after the body. But now I'm wondering. Where should I place the css for that header. I can put it i

Jsp JSTL foreach 2 list

I have 2 list coming from a servlet and I am able to print the names now how can i send id to other page? names list has name1 and name2 and id has 1 & 2,i need to send particular id for a name.. <%request.getAttribute("names")%> <%request.getAttribute("id")%> <c:forEach items="${names}" var="Childnames"> <li>< a href="example" /a>${Childnames}</li> </c:forEach>

Jsp Converting null to an empty String in Struts 2

I have a form in struts 2, that I show the value of a cookie like this: <s:set var="name">${cookie["name"].value}</s:set> <s:textfield name="name" value="%{#name}"/> But everytime the cookie is null (when the user first logs in), it isn't blank, but it is showing "javabrains.model.User@17030961". I want that value to be blank in my form. So I tried to use if tag in Struts2, so whenever the name is null, it is set to blank, like this: <s:if test="#name == ''"><s:

Jsp:param not work in Liferay

I'm trying use a tag jsp:include and jsp:param on my portlet, but without success. I add the propertie theme.jsp.override.enabled=true in portal-ext.properties it did not work well. home.jsp <h2>${title}</h2> <jsp:include page="list.jsp" > <jsp:param name="list" value="${productList}" /> </jsp:include> list.jsp <ul> <c:forEach var="product" items="${param.list eq null ? list : param.list }"> <li>${product.name} - ${product.qt}<

Jsp How to get uploaded file in Struts action

This is the jsp page to upload the file: <html:form action="/process.do?method=upload" method="post" enctype="multipart/form-data"> File :<input type="file" name="filename" /><br /> <input type="submit" value="Upload File" style="margin: 40px 0 0 160px"/> </html:form> This the action forward method which processes the uplaoded file: public ActionForward upload(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletRespo

Redirect issue to JSP from servlet

I have a servlet S1 which will get data from my Data Base and store it in a array list "A". This array list A will be sent to a JSP in which I will print all the contents of the array list A. I am able to print all the details. Now in the JSP I have a radio button which I will pass it to other servlet S2 and fetch details from the DB and return back to the JSP which called servlet S2. Now all the process of the servlet S2 are working fine but I am not able to get back to the JSP. I am getting a

Jsp jstl page not found exception in logger

I am including some JSP pages in one JSP page, whose names are in the keys of Map which I am iterating. In case if any of the JSP page is not found in my folder, then it throws exception, which I further handle in <c:catch>. <c:set var="pagePath" value="/WEB-INF/pages/adminModule/"/> <c:set var="jspName" value="${childItems.key}"/> <c:set var="jspVar" value="${pagePath}organizationFilter${jspName}.jsp" /> <c:set var="jspVar" value="${fn:replace(jspVar,' ', '')}"/>

How to display data from servlet obtained using ResultSet in JSP

I don't understand how to pass and display the values to a jsp obtained in the servlet using ResultSet. I saw many examples. I don't understand the foreach loop. Why are there two variables? Does no one use the jsp:useBean anymore? How do I pass and display the data. I tried using the bean class but the data in ResultSet is a table and I don't know how to set and get the values of all rows. Please help. This is the servlet: protected void doGet(HttpServletRequest request, HttpServletResponse

JSTL listen dynamic button(link) using JSP

I want to keep jstl value(dynamic) in the session. How can I do? For example my code segment is : (userid is session attribute that is assigned previous page when student login the system) <sql:setDataSource var="myDS" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/loginuser" user="root" password="root2" /> <sql:query var="listUsers" dataSource="${myDS}"> SELECT name FROM course_student where id = ?; <sql

Jsp jstl c:forEach content flashes in (blocks page render)

My website is flashing in this select element and it looks tacky, it seems that each element that uses a forEach loop is holding up the rest of the site from loading. Is there a way to make this jstl not block page rendering or not flash the content onto the page? <select id="senderSelect" name="sender"> <option value="">Select a Sender from List</option> <!-- Build Sender Options --> <c:forEach items="${SRList}" var="senderList"> <c:choose>

Jsp why we should not use request dispatcher in dopost?

I was working with servlet jsp code. I added one record from jsp to database. To show the inserted record I used requestdispacther. But records keep on adding( like infinite loop). then I replace code with sendredirect and worked fine. insted of this code: response.sendRedirect("AddNewProductOnRent?action=currentOnRentlist"); I was using: RequestDispatcher rs = request.getrequestDispatcher("AddNewProductOnRent?action=currentOnRentlist"); forward(request,response) ......but got error My

Using OGNL inside a JSP scripting delimiters

How can I use the OGNL inside a scripting delimiters? <s:iterator var="arr" value="%{carNames}" status="incr"> <option value="<%=car.getType()["#incr.index"]%>" > <s:property value="arr"/> </option> </s:iterator> This is my Car structure: private String[] carNames = {"A", "B", "C"}; public static Integer[] getType() { return new Integer[]{ new Integer(Global.DISEL), new Integer(Global.TESLA),

Jsp Removing Client Response Url parameter

Question. When having an client URL with following parameters contactVia=email&interestedIn=petRock&terms=on how can one remove the (present) attribute terms=on when the call reaches the servlet? So the response URL becomes contactVia=email&interestedIn=petRock Context. Values in textboxes from the calling form are automatically added to the response URL, i have tried to remove terms by request.removeAttribute(); and editing request.getParameterMap();. But removeAttribute has no e

Jsp JSTL - Decimal format of input type="number"

I have an input field like this: <input type="number" name="myValue" id="myValue" required value="${not empty myValue ? myValue : 1.0}" /> It should be 1.0 until set otherwise. This works fine in Chrome, but when I use Internet Explorer, it says something like This is not a valid date, please change. I guess there's something wrong with 1.0 because Chrome automatically changes it to 1,0 (my local format for decimal places). When I try to set 1,0 manually in IE I get an excep

Getting a 404 when accessing a servlet on JSP page form submit

I am getting a 404 when I submit a form from JSP which calls a servlet. Can someone please point out what's wrong here? I am sure I have missed something here My JSP code <form action="objectServer" method="get"> <select name="choice"> <option value="1" %>1</option> <option value="2" %>2</option> <option value="3" %>3</option> </select> <br /> <input type="submit" value="View the Descrition!" /> My Servlet co

Jsp How to insert values into different tables on selection from drop down list

I want to insert a value into different tables on the basis of a selected drop down list. I have two tables first is AC and second is non-ac and i am inserting a value into a table but my (if) condition is not working, and data is inserting in else condition. plz help me out. <select onChange="onSelect(this)" class="col-Room" name="Sroom"> <option value="ac" >AC-Room</option> <option value="nonac">Non AC-Room</option> </select> St

  1    2   3   4   5   6  ... 下一页 最后一页 共 41 页