Search Results

Search found 2126 results on 86 pages for 'jsp fragments'.

Page 26/86 | < Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >

  • Type of object returned by an input from a web page

    - by controlfreak123
    I'm attempting to upload a file into a jsp and then use the file in some other code. My problem is that it comes into the servlet as an Object via the request.getAttribute() call so I don't know what to cast it to. I have this code so far to try and test what it is but I'm getting a NullPointerException. PrintWriter out = response.getWriter(); out.println(request.getAttribute("file1").getClass()); Is my understanding of whats going on flawed or am I just coding it up wrong?

    Read the article

  • Java webapp: adding a content-disposition header to force browsers "save as" behavior

    - by WizardOfOdds
    Even though it's not part of HTTP 1.1/RFC2616 webapps that wish to force a resource to be downloaded (rather than displayed) in a browser can use the Content-Disposition header like this: Content-Disposition: attachment; filename=FILENAME Even tough it's only defined in RFC2183 and not part of HTTP 1.1 it works in most web browsers as wanted. So from the client side, everything is good enough. However on the server-side, in my case, I've got a Java webapp and I don't know how I'm supposed to set that header, especially in the following case... I'll have a file (say called "bigfile") hosted on an Amazon S3 instance (my S3 bucket shall be accessible using a partial address like: files.mycompany.com/) so users will be able to access this file at files.mycompany.com/bigfile. Now is there a way to craft a servlet (or a .jsp) so that the Content-Disposition header is always added when the user wants to download that file? What would the code look like and what are the gotchas, if any?

    Read the article

  • Need to preserve order of elements sent in JSON from Java

    - by Kush
    I'm using JSON.org APIs for Java to use JSON in my JSP webapp, I know JSONObject doesn't preserve order of elements the way they are put into it and one has to use JSONArray for that but I don't know how to use it since I need to send key and value both as received from the database, and here I'm sending data to jQuery via JSON where I need the order of data to be maintained. Following is my servlet code, where I'm getting results from the database using ORDER BY and hence I want the order to be exact as returned from the database. Also this JSON object requested using $.post method of jQuery and is used to populate dropdown on reciever page. ResultSet rs = st.executeQuery("SELECT * FROM tbl_state order by state_name"); JSONObject options = new JSONObject(); while(rs.next()) options.put(rs.getString("state_id"),rs.getString("state_name")); response.setContentType("application/json"); response.setCharacterEncoding("UTF-8"); response.getWriter().write(options); Thanks.

    Read the article

  • problem in opening a link to .rar file

    - by Kenneth
    Hi all, In my jsp, I have a hyperlink linking to a .rar file in the system. Somehow when I clicked on the link, it does not ask users to 'save file' or 'open file' nor using 7zip to open the .rar file. Instead, it just displays some junk characters on the web page. I thought it might be the problem with mime-mapping. So I put an mime-mapping to web.xml with mime-type=application/x-rar-compressed. But it still doesn't work. Do you have any idea what the problem is and how to solve it? Thanks a lot in advance. Other file types have no problem. Kenneth

    Read the article

  • Websites using JEE

    - by Rob
    Hi guys, I have a simple question, but I can't find out the answer. I'm wondering if we can see that a website is built using the JEE technology, or servlets/JSP. I think it could be possible to look for specials pages from the server (404, wrong parameters, ...) in some cases, but what about the everyday use ? In fact, I look for a collection of great (or wide used) website using the java technology, and I can't really find a list of these. I'llbe very happy if you can help me with these two small questions

    Read the article

  • Website using JEE

    - by Rob
    Hi guys, I have a simple question, but I can't find out the answer. I'm wondering if we can see that a website is built using the JEE technology, or servlets/JSP. I think it could be possible to look for specials pages from the server (404, wrong parameters, ...) in some cases, but what about the everyday use ? In fact, I look for a collection of great (or wide used) website using the java technology, and I can't really find a list of these. I'llbe very happy if you can help me with these two small questions

    Read the article

  • Can not set Character Encoding using sun-web.xml

    - by stck777
    I am trying to send special characters like spanish chars from my page to a JSP page as a form parameter. When I try get the parameter which I sent, it shows that as "?" (Question mark). After searching on java.net thread I came to know that I should have following entry in my sun-web.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 8.0 Servlet 2.4//EN" "http://www.sun.com/software/sunone/appserver/dtds/sun-web-app_2_4-0.dtd"> <sun-web-app> <locale-charset-info default-locale="es"> <locale-charset-map locale="es" charset="UTF-8"/> <parameter-encoding default-charset="UTF-8"/> </locale-charset-info> </sun-web-app> But it did not work with this approach still the character goes as "?".

    Read the article

  • Item value in JSTL foreach loop not working in Portlet

    - by danimajo
    Given the following Portlet Code: ArrayList nameList = new ArrayList(); nameList.add("Willi Willisch"); nameList.add("Seppi Seppisch"); renderRequest.setAttribute("names", nameList); And the following JSP Code: <c:forEach var="aName" items="${names}"> <tr> <td>${aName} </td> </tr> </c:forEach> Prints out: ${aName} ${aName} I don't have any clue why a $(aName) isn't evaluated. The forEach loops works, because ${aName} is printed out twice ....

    Read the article

  • How to convert an arbitrary object to String with JSTL? (calling toString())

    - by hstoerr
    Is there any way to call toString() on an object with the JSTL? (I need the String representation of an enum as index in a map in a JSP EL expression.) I hoped something like ${''+object} would work like in java, but JSTL isn't that nice, and there does not seem to be any function that does it. Clarification: I have a variable somemap that maps Strings to Strings, and I have a variable someenum that is an enumeration. I'd like to do something like ${somemap[someenum.toString()]}. (Of course .toString() does not work, but what does?)

    Read the article

  • Get status of servlet request before the response is returned

    - by Alex
    Good evening, I am in the process of writing a Java Servlet (Struts 2, Tomcat, JSP etc) which is capable of doing some fairly complex simulations. These can take up to 2 minutes to complete on the and will return a graph of the results. It is trivial to calculate the percentage of the simulation completed because the process works by repeating the same calculations 1000s of times. I would be interested to know if anyone has ever tried to use client side technology to provide any estimate of the percentage complete. I.e query the servlet processing to get the number of cycles completed at various point throughout the simulation. This could then be displayed as a bar in the client browser. Any thoughts, advice, resources would be much appreciated. Thanks, Alex

    Read the article

  • How can I create a user registration form using datastore - google appengine ??

    - by srivigneshwar
    I am very new to jsp and google appengine , but still I can do something if I get some basic idea , I wanna create an user registration form with fields like name, user id , password, confirm password, etc,. using google appengine datastore feature. and I wanna retrieve user information . Please help me .. Thanks in advance. Thanks for the replies, I need to get some information from user and I want to store it in database, and I will use that information for my application. How can I do that?

    Read the article

  • java get file paths

    - by user283188
    hey everybody, I have a jsp page which contains the code which prints all files in a given directory and their file paths. The code is if (dir.isDirectory()) { File[] dirs = dir.listFiles(); for (File f : dirs) { if (f.isDirectory() && !f.isHidden()) { File files[] = f.listFiles(); for (File d : files) { if (d.isFile() && !d.isHidden()) { System.out.println(d.getName()+ d.getParent() + (d.length()/1024)); } } } if (f.isFile() && !f.isHidden()) { System.out.println(f.getName()+ f.getParent() + (f.length()/1024)); } } } The problem is that it prints the complete file path, which when accessed from tomcat is invalid. For example, the code spits out the following path: /usr/local/tomcat/sites/web_tech/images/scores/blah.jpg and I want it to only print the path up to /images ie /images/scores/blah.jpg I know I could just mess around with an actual string, ie splitting it or string matching, but is there an easier way to do it? Thanks

    Read the article

  • JSTL Session Lookup - Key Has Periods

    - by John W.
    Hello All, I am working with some legacy code, and at some point there is a key in the session that is something like session.setAttribute("com.org.something.Object",someObject); Now trying to access this in a jsp using jstl is a bit difficult becuase if I tried it like I normally would I would do: ${sessionScope.com.org.something.Object.someFieldGetter} As most of us can imagine it will fail because there is no com object in session scope. I also tried ${sessionScope.'com.org.something.Object'.someFieldGetter} And a parsing error was thrown. Does anyone know how to resolve this so that I can correctly get the object similar to session.getAttribute("com.org.something.Object") but through jstl? thank you.

    Read the article

  • server controlled or Synchronized web slide show?

    - by Gnome Guru
    I am creating a e-learning application , where the students (wireless) connect to the teachers machine, the teacher hosts a tomcat server. the teacher has a set of HTML web-pages(each of which can be thought of as a slide). and the students can view a web slide-show on his/her browser... the problem is.... i want the pages on the students browser to be redirected according to the teachers input.. in short: i want the server to automatically redirect all the client browsers to the next page when the teacher wants it to be so... how do i do it?? [i am using JSP/javascript/Java/Tomcat/Eclipse]

    Read the article

  • Java String Replace and null characters

    - by praspa
    Testing out someone elses code (of course it was ...) , I noticed a few JSP pages printing funky non-ascii characters. Taking a dip into the source I found this tidbit. // remove any periods from first name e.g. Mr. John --> Mr John firstName = firstName.trim().replace('.','\0'); Does replacing a character in a String with a null character even work in Java? I know that '\0' will terminate a c-string. Would this be the culprit to the funky characters? Thanks PR

    Read the article

  • How to create temporary files on the client machine, from Web Application?

    - by Gaurav Srivastava
    I am creating a Web Application using JSP, Struts, EJB and Servlets. The Application is a combined CRM and Accounting Package so the Database size is very huge. So, in order to make Execution faster, I want prevent round trips to the Database. For that purpose, what I want to do is create some temporary XML files on the client Machine and use them whenever required. How can I do this, as Javascript do not permits me to do so. Is there any way of doing this? Or, is there any other solution which I can adopt in order to make my application Faster?

    Read the article

  • Jquery Retrieving data from webpage and entering it in database.

    - by user279321
    Hello Everyone. I am new to Jquery. I want to read specific data(some div's only) from a webpage and store it in my database. Now I am not able to do so as load functions loads the data into the current page id. My goal is to read specific data and store them in database. So which Jquery function should I use for this? if someone can throw some light on it, it would be really helpful for me. I am using JSP,MySQL,Java.

    Read the article

  • How to show a client-side message with Java JSF/Tobago?

    - by Marcus
    I have a web application created with JSF and Tobago. The user types some date into a sheet and clicks a button (all within one sheet-row). Now my java class checks whether the data is correct or not. In case there are some problems, I would like to show up something like a messagebox containing the errormessage. I cannot use something like JDialog, since this would happen only server side. Every user independently of his location needs to get the message. I thought about setting the error information into a databean and having my jsp show up the message after reloading. But how can I achieve this? Is there something like a tag which can be used for this? Or can I use the "confirmation" facet for this? But how would I start it without having the user to do something? Thanks in advance!

    Read the article

  • Getting a popup help for an option in listview.

    - by Judy
    I have an interface with a listview of various options e.g 1)Asian 2) Euorpian 3)...... this listview is populated by calling JSP script that accesses this data (i.e. all options) from database. I want to have a small popup window (like any help window) to be displayed when I move mouse over( onmousemove function) any option. e.g when i put mouse over Asian then a small help sort of window display Indians,chinese,thai...etc. Can anyone suggest how to achieve this?

    Read the article

  • copy file from one location to another location in linux using java program

    - by Mouli
    Using JSP am trying to move customer logo into another location in linux but its not working. thanks in advance Here is my program String customerLogo = request.getParameter("uploadCustomerLogo").trim(); StringBuffer absoluteFolderPath = new StringBuffer(); absoluteFolderPath.append("/zoniac"); absoluteFolderPath.append("/Companies/"); absoluteFolderPath.append("companyCode/"); absoluteFolderPath.append("custom/"); String destination = absoluteFolderPath.toString(); File sourcefile = new File(customerLogo); File destfile = new File(destination+sourcefile.getName()); FileUtils.copyFile(sourcefile,destfile);

    Read the article

  • Doing a generic <sql:query> in Grails

    - by melling
    This is a generic way to select data from a table and show the results in an HTML table using JSP taglibs. What is the generic way to do this in Grails? That is, take a few lines of SQL and generate an HTML table from scratch in Grails, including the column names as headers. <sql:query var="results" dataSource="${dsource}" select * from foo </sql:query (# of rows: ${results.rowCount}) <table border="1" <!-- column headers -- <tr bgcolor=cyan <c:forEach var="columnName" items="${results.columnNames}" <th<c:out value="${columnName}"/</th </c:forEach </tr <!-- column data -- <c:forEach var="row" items="${results.rowsByIndex}" <tr <c:forEach var="column" items="${row}" <td<c:out value="${column}"/</td </c:forEach </tr </c:forEach </table The solution to this was answered in another StackOverFlow question. http://stackoverflow.com/questions/425294/sql-database-views-in-grails IF SOMEONE WRITES A GOOD ANSWER, I'LL ACCEPT IT. I would like a 100% acceptance on all of my questions.

    Read the article

  • JSF - Session Bean restart on logout and login

    - by Ben
    Hi, I have a web application with a backing bean which has the context of the current logged in user. It is implemented on JSF. When the user logs out he is forwarded to a login screen (in another JSP page). I would like the current session to be erased when that happens and a new one to be created the next time the user logs in and enters the application. My question is - how do you delete a session? (I guess the new session will be created automatically the next time the user enters the link) This is kinda newb i guess, but I couldn't find a solution for this. Thanks for the Help!

    Read the article

  • How to call sql procedure from an html button?

    - by anand
    Hey guys, my doubt is pretty simple to understand. I have a sql procedure that generates a util file as its output depending on the input parameters that are passed to it. I have to pass these parameters from an html page from 3 text boxes.There will also be a button ,on clicking which, the procedure will be called and the util will be generated. I thought of doing it in jsp and writing the full procedure there itself. But i want to util file to opened in WORD the moment it is generated. I want to know how to call a procedure using button and how to show the util after its generated. Thanks guys, any help will be appreciated.

    Read the article

  • Form character encoding problems with special characters

    - by Enrique
    Hello I have a jsp with an html form. I set the content type like this: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %> When I send special characters like á é í ó ú they are saved correctly in the database. My table charset is utf-8. I want to change iso-8859 to utf-8 like this to standardize my application and accept more special characters: <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> but when I change it to utf-8 the special characters á é í ó ú are not saved correctly in the databse. When I try to save á it is saved as á In the server side I'm using Spring MVC. I'm getting the text field value like this: String strField = ServletRequestUtils.getStringParameter(request, "field");

    Read the article

  • Pre-populating Radio Buttons with Java

    - by Gary Deuces Rozanski
    Is it possible to pre-populate a radio button, using jsp, depending on the value in the database? If so, how? I have done research here at StackOverflow & Google but with no real solution. p.s. I hope somebody can help me out with a question. As you will see from previous questions, I am not a developer, but get loaded with questions being the most technical on my team. oh the joy. Any help will be appreciated & I apologize in advance if my question is dumb.

    Read the article

< Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >