Search Results

Search found 1850 results on 74 pages for 'jsp'.

Page 15/74 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • How to call JS function within .js file into .jsp file?

    - by Simple-Solution
    I am trying to call a javaScript function that's in .../js/index.js file to .../index.jsp file. Any suggestion would be helpful. Here is code within both file: index.js function testing() { if ("c" + "a" + "t" === "cat") { document.writeln("Same"); } else { document.writeln("Not same"); }; }; index.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; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body> <script type="text/javascript" src="js/index.js"> <!-- I want to call testing(); function here --> </script> </body> </html>

    Read the article

  • How can I close the output stream after a jsp has been included.

    - by stu
    I have a webpage that makes an ajax call to get some data. That data takes a long time to calculate, so what I did was the first ajax server call returns "loading..." and then the thread goes on to calculate the data and store it in a cache. meanwhile the client javascript checks back every few seconds with another ajax call to see if the cache has been loaded yet. Here's my problem, and it might not be a problem. After the initial ajax to the server call, I do a ...getServletContext().getRequestDispatcher(jsppath).include(request, response); then I use that thread to do the calculations. I don't mind tying up the webserver thread with this, but I want the browser to get the response and not wait for the server to close the socket. I can't tell if the server is closing the socket after the include, but I'm guessing it's not. So how can I forcibly close the stream after I've written out my response, before starting my long calculations? I tried o = response.getOutputStream(); o.close(); but I get an illegal state exception saying that the output stream has already been gotten (presumably by the jsp I'm including) So my qestions: 1) is the webserver closing the socket (I'm guessing not, because you could always include another jsp) 2) if it is as I assume not closing the socket, how do I do that?

    Read the article

  • Appengine not liking my .jspx files

    - by Hans Westerbeek
    I have a little app that runs fine on local dev appengine, but appengine itself is not processing my .jspx files. The jspx files are in WEB-INF so they should not be excluded by appengine (as a static resource) I am using Apache Tiles to define my views. So the html produced looks like this: <html xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:tiles="http://tiles.apache.org/tags-tiles" > <jsp:output omit-xml-declaration="yes"/> <jsp:directive.page contentType="text/html;charset=UTF-8" /> <jsp:directive.page isELIgnored="false"/> (etc etc) How can I solve this problem?

    Read the article

  • Why does Tomcat try to use the cache when compilation failed?

    - by etheros
    For some reason, it appears Tomcat is trying to hit its compilation cache when compilation failed. For example, if I create a JSP containing nothing but Hello, <%=world%>!, predictably, I get an error: org.apache.jasper.JasperException: Unable to compile class for JSP. Subsequent requests however alternate between this and org.apache.jasper.JasperException: org.apache.jasper.JasperException: Unable to load class for JSP. Further, if I create a JSP containing Hello!, it of course works just fine. If I modify it contain Hello, <%=name%>!, the response alternates between the previously-mentioned compilation error, and the cached Hello!. What's going on?

    Read the article

  • how find out the form is submit in JSP?

    - by user261002
    I am trying to create a an online exam with JSP. I want to get the questions one by one and show them on the screen, and create a "Next" button then user is able to to see the next question, but the problem is that I dont know how to find out that the user has clicked on the "Next" button, I know how to do it in PHP : if($_SERVER['REQUEST_METHOD']=='GET') if($_GET['action']=='Next') but I dont know how to do it in JSP. Please help me this is piece of my code: String result = ""; if (database.DatabaseManager.getInstance().connectionOK()) { database.SQLSelectStatement sqlselect = new database.SQLSelectStatement("question", "question", "0"); ResultSet _userExist = sqlselect.executeWithNoCondition(); ResultSetMetaData rsm = _userExist.getMetaData(); result+="<form method='post'>"; result += "<table border=2>"; for (int i = 0; i < rsm.getColumnCount(); i++) { result += "<th>" + rsm.getColumnName(i + 1) + "</th>"; } if (_userExist.next()) { result += "<tr>"; result += "<td>" + _userExist.getInt(1) + "</td>"; result += "<td>" + _userExist.getString(2) + "</td>"; result += "</tr>"; result += "<tr>"; result += "<tr> <td colspan='2'>asdas</td></tr>"; result += "</tr>"; } result += "</table>"; result+="<input type='submit' value='next' name='next'/></form>"; }

    Read the article

  • Passing JSP parameter to javascript won't work in IE8!

    - by Ronen
    Could really use with some help here... I've got a servlet that generates an XML string (relatively long) which I then pass to a javascript variable in a forwarded jsp file: $(document).ready(function() { ... var itXML = <% out.print((String)request.getAttribute("xml"));% ; ... } This seems to work just fine in Firefox but when I run the same project on IE8 I get a syntax error for this line. Any Ideas? Thanks!

    Read the article

  • I am unsure of how to access a persistence entity from a JSP page?

    - by pharma_joe
    Hi, I am just learning Java EE, I have created a Persistence entity for a User object, which is stored in the database. I am now trying to create a JSP page that will allow a client to enter a new User object into the System. I am unsure of how the JSP page interacts with the User facade, the tutorials are confusing me a little. This is the code for the facade: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Add User to System</title> </head> <body> <h2>Add User</h2> <h3>Please fill out the details to add a user to the system</h3> <form action=""> <label>Email:</label> <input type="text" name="email"><br /> <label>Password:</label> <input type="password" name="name"><br /> <label>Name:</label> <input type="text" name="name"><br /> <label>Address:</label> <input type="text" name="address"><br /> <label>Type:</label> <select name="type"> <option>Administrator</option> <option>Member</option> </select><br /> <input type="submit" value="Add" name="add"/> <input type="reset" value="clear" /> </form> </body> This is the code I have to add a new User object within the User facade class: @Stateless public class CinemaUserFacade { @PersistenceContext(unitName = "MonashCinema-warPU") private EntityManager em; public void create(CinemaUser cinemaUser) { em.persist(cinemaUser); } I am finding it a little difficult to get my head around the whole MVC thing, getting there but would appreciate it if someone could turn the light on for me!

    Read the article

  • Strage character encoding problem with Eclipse / Spring / Tomcat 6

    - by Czar
    Hi, I have been trying things all da but can't get a proper solution. My problem is: I am developing a Spring MVC based app in my local Tomcat. My MYSQl database has UTF-8 encoding set, all content in there displays properly when using phpMyAdmin. Also the output in LOG files using log4j in catalina.out works fine. My JSP pages are configured by <!-- encoding --> <%@ page contentType="text/html; charset=UTF-8" %> <%@ page pageEncoding="UTF-8" %> Also showing data on my JSP works fine. I can also send data from my Controller without any DB intereference using special chars, e.g. String str = "UTF-8 Test: Ä Ö Ü ß è é â"; logger.debug(str); mav.addObject("utftest", str); That displays correctly in log and on jsp page in browser. BUT: When having special chars directly in my JSP file, e.g. for text in headers, this does not work. FF and Google Chrome display strange chars but report the page to be UTF-8. When switching to Latin, the chars just get more and more strange. Same problem when showing text tokens from my messages.properties file, although Eclipse says when right-clicking that UTF-8 will be used. I am a little it lost and don't know where to check now. Summary: DB storage is fine DB output on JSP is fine Output on JSP directly form controller is fine even reading in form forms is fine .properties files and JSP text is not fine !!! Any ideas? I really appreciate and tips.

    Read the article

  • Spring MVC: How to resolve the path to subdirectories of the root 'JSP' folder in a web application

    - by chrisjleu
    What is a simple way to resolve the path to a JSP file that is not located in the root JSP directory of a web application using SpringMVCs viewResolvers? For example, suppose we have the following web application structure: web-app |-WEB-INF |-jsp |-secure |-admin.jsp |-admin2.jsp index.jsp login.jsp I would like to use some out-of-the-box components to resolve the JSP files within the jsp root folder and the secure subdirectory. I have a *-servlet.xml file that defines: an out-of-the-box, InternalResourceViewResolver: <bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"></property> <property name="prefix" value="/WEB-INF/jsp/"></property> <property name="suffix" value=".jsp"></property> </bean> a handler mapping: <bean id="handlerMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="mappings"> <props> <prop key="/index.htm">urlFilenameViewController</prop> <prop key="/login.htm">urlFilenameViewController</prop> <prop key="/secure/**">urlFilenameViewController</prop> </props> </property> </bean> an out-of-the-box UrlFilenameViewController controller: <bean id="urlFilenameViewController" class="org.springframework.web.servlet.mvc.UrlFilenameViewController"> </bean> The problem I have is that requests to the JSPs in the secure directory cannot be resolved, as the jspViewResolver only has a prefix defined as /jsp/ and not /jsp/secure/. Is there a way to handle subdirectories like this? I would prefer to keep this structure because I'm also trying to make use of Spring Security and having all secure pages in a subdirectory is a nice way to do this. There's probably a simple way to acheive this but I'm new to Spring and the Spring MVC framework so any pointers would be appreciated.

    Read the article

  • Print the jena result set in html(servlet/jsp).

    - by Udayanga
    hi, I'm using servlet for manipulating ontology.I got the result of my SPARQL query and I want to display(print) that result in JSP(Servlet). Following code segment can be used to print the result in console. . . . com.hp.hpl.jena.query.Query query = QueryFactory.create(queryStr); QueryExecution qe = QueryExecutionFactory.create(query,model); com.hp.hpl.jena.query.ResultSet rs = qe.execSelect(); ResultSetFormatter.out(System.out, rs); any idea..? Thank in advance!

    Read the article

  • Is it possible to cache JSP bytecode to avoid recompiles w/ Tomcat?

    - by Computer Guru
    Hi, Is there any way of caching the bytecode for JSP webapps/ In particular, using Tomcat as the Java servlet? I'm getting really fed up of Tomcat taking up all the CPU for 10 minutes while it compiles 4 different webapps every time I restart it.... I'm already using Jikes to "speed up" the compiles, but it's really killing me. The code does not change unless the webapp is upgraded (very rarely), and I cannot believe that there is no way to cache the compiled java bytecode instead of recompiling it each and every time. I'd appreciate any advice on the matter!

    Read the article

  • Spring mvc: controller returns [][], usable in jsp with foreach, but how to bind?

    - by Joe
    I'm building a spring mvc application. Now the problem I have is the following. I have a controller which adds a DayInfo[][] to my ModelMap. (DayInfo has an id, a title (String) and Text(also String). Now the problem I have is that I have no problem displaying this DayInfo[][] with foreach tags in my jsp. However I'm outputting the Title property as an input box(type text), and I'd like to be able to update this value (and thus saving it to be a database but that shouldn't be a problem). However I'm having trouble with binding this value to the input box so that it is actually returned to the controller. If anyone has some advice it would be welcome.

    Read the article

  • how to extract data from excel (apache poi) to put it in mysql table using jsp? [ SOLVED]

    - by Nihad KH
    I want to extract data from excel sheet to insert it into a mysql table using jsp, so far i've done this and its printing data into the outpout(using apache poi),what should i add to this code ? Output : Name Age Adress Mark 35 New york,AA Elise 22 India,bb Charlotte 45 France,cc Readexcel.jsp : <%@page import="java.sql.Statement"%> <%@page import="java.util.ArrayList"%> <%@page import="java.sql.PreparedStatement"%> <%@page import="java.sql.Connection"%> <%@page import="java.util.Date"%> <%@page import="org.apache.poi.ss.usermodel.Cell"%> <%@page import="org.apache.poi.ss.usermodel.Row"%> <%@page import="org.apache.poi.xssf.usermodel.XSSFSheet"%> <%@page import="org.apache.poi.xssf.usermodel.XSSFWorkbook"%> <%@page import="java.io.File"%> <%@page import="org.apache.commons.io.FilenameUtils"%> <%@page import="org.apache.commons.fileupload.FileItem"%> <%@page import="java.util.Iterator"%> <%@page import="java.util.List"%> <%@page import="org.apache.commons.fileupload.servlet.ServletFileUpload"%> <%@page import="org.apache.commons.fileupload.disk.DiskFileItemFactory"%> <%@page import="org.apache.commons.fileupload.FileItemFactory"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>PRINT DATA FROM EXCEL FILE</title> </head> <body> <% try{ boolean ismultipart=ServletFileUpload.isMultipartContent(request); if(!ismultipart){ }else{ FileItemFactory factory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(factory); List items = null; try{ items = upload.parseRequest(request); }catch(Exception e){ } Iterator itr = items.iterator(); while(itr.hasNext()){ FileItem item = (FileItem)itr.next(); if(item.isFormField()){ }else{ String itemname = item.getName(); if((itemname==null || itemname.equals(""))){ continue; } String filename = FilenameUtils.getName(itemname); File f = checkExist(filename); item.write(f); try{ XSSFWorkbook workbook = new XSSFWorkbook(item.getInputStream()); XSSFSheet sheet = workbook.getSheetAt(0); Iterator<Row> rowIterator = sheet.iterator(); while (rowIterator.hasNext()){ Row row = rowIterator.next(); Iterator<Cell> cellIterator = row.cellIterator(); while (cellIterator.hasNext()) { Cell cell = cellIterator.next(); switch (cell.getCellType()){ case Cell.CELL_TYPE_NUMERIC: out.print(cell.getNumericCellValue() + "t"); break; case Cell.CELL_TYPE_STRING: out.print(cell.getStringCellValue() + "t"); break;} } out.println(""); } }catch (Exception e){ e.printStackTrace(); } } } } }catch(Exception e){ } finally { out.close(); } %> <%! private File checkExist(String fileName){ String saveFile = "D:/upload/"; File f = new File(saveFile+"/"+fileName); if(f.exists()){ StringBuffer sb = new StringBuffer(fileName); sb.insert(sb.lastIndexOf("."),"-"+new Date().getTime()); f = new File(saveFile+"/"+sb.toString()); } return f; } %> </body> </html> I've created a table in my database named EXCELDATA with the header of the excel sheet : ExcelData (Name varchar(50),age int,adress varchar(50)); what should i add to this code to get the data from the excel sheet to the mysql table ??

    Read the article

  • What other Freemarker JSP Tag libraries are out-there?

    - by Mat Banik
    I have been using Freemarker for a while and found displaytag library very useful. I just wondering if there are any other libraries that could be used in similar means as displaytag, which have been very helpful to you in development: FTL page <#assign display=JspTaglibs["/WEB-INF/tlds/displaytag.tld"]/> <@display.table uid="items" name="items" pagesize=10 class="table"> <@display.column title="Category" property="category.name"/> <@display.column title="Delivery" property="delivery"/> </@display.table> Example of usage would be appreciated since most of the JSP tag libs don't have them.

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >