Search Results

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

Page 5/74 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Code Formatter: cleaning up horribly formatted jsp code

    - by ahiru
    So I am working on a jsp/servlet that came to me and I'm looking at the jsp file and it is just a jungle of jstl tags, java code and html thrown together. At first it looked like someone ran the standard eclipse formatter on it and had the page width set to 40 so alot of stuff is broken up, I tried to format it with a larger page width but that seemed to make it worse to the point of not being able to tell what is going on without formatting parts of it first. Anyone have any luck with any jsp/code formatter?

    Read the article

  • How to create templates in JSTL JSP

    - by desau
    Say I have a JSP page with JSTL. I'm using c:forEach and looping over 5 different sets of objects, each very similar. Each loop is nearly identical.. lots of duplicated code. I'd like to make that loop a template -- such as a JSP template, but I want to pass the JSTL object(s) in the parameters. How can I do this? Or a more general question -- how can I create reusable HTML templates in JSP/JSTL?

    Read the article

  • synchronized block in JSP tag class

    - by Sudhakar
    Hi, I am trying to find answer for the following ,for the past couple of days ,but couldnt find comprehensive answer Problem Statement I have a custom JSP tag class which handles a web form submission ,captures data and write it to same file in the filesystem. As all web applications,this can be triggeredsimultaneosly ,and i fear that multiple threads would be in action handling each of the submission (we all know thats how Servlet works.) CODE synchronized (this){ final String reportFileName = "testReport.csv"; File reportDir = new File( rootCsDirectory, "reports" ); if(!reportDir.isDirectory())reportDir.mkdir(); File reportFile = new File (reportDir, reportFileName); logReport(reportFile,reportContent.toString()); } ISSUE: - A File object can be opened by one thread for writing and at same time another thread might try to access and fail and throw an exception So i thought of synchronizing (on the object ) should solve the issue , but read some where that jsp engine would have pool of jsp tag objects, so i am afraid that synchronized (this) wont work and it should be changed to synchronized (this.getClass())

    Read the article

  • Struts/JSP/J2EE performance and memory profiling and issues

    - by Berlin Brown
    We are using Struts and having performance issues. And making heavy use of jsp includes, tiles, EL expressions. I am sure this is eating up a lot of memory and processing time. What are some approaches to profile the JSP page? What tools could I use? What should I look for when profiling? I have seen the code generated JSP Java Servlet Code and I see the bottlenecks but would rather measure it more accurately. This is under JDK1.5 and IBM Websphere 6.1 (RAD7)

    Read the article

  • non-servlet JSP

    - by h2g2java
    I realise there are EL and near EL frameworks like StringTemplate, JUEL, Velocity, etc. However, I am not asking for list of alternatives to JSTL/EL. I came across a package more than a year ago, someone who wrote a util that emulates the functionality of JSP for non-servlet env, i.e., JSP composition which does not need a "servlet container" to function. I ignored it and now I think it would be helpful to me and I need help to recall what it is. My actual motivation is similar to what StringTemplate, JUEL, Velocity would offer to help me compose SQL blocks, HTML blocks but I am thinking that JSPs are precompiled into bytecode and JSPs are more run-time efficient since run-time parsing is done no more than once. So actually, recommendation for alternatives would be acceptable as long as the templates are precompiled into bytecode. But I still prefer the JSP emulator.

    Read the article

  • processing json objects in jsp

    - by user98534
    i have a JSON object sent from the browser to the jsp page. how do i receive that object and process it in jsp. do i need any specific parsers? i have used the following piece of code. but it wouldnt work. essentially i should read the contents of the object and print them in the jsp. <%@page language="java" import="jso.JSONObject"%> <% JSONObject inp=request.getParameter("param1"); %> <% for(int i=0;i<inp.size();i++) {%> <%=inp.getString(i)%> <% } %>

    Read the article

  • Spring+JSP url building best practices

    - by dotsid
    I wonder if there are any good practices for addressing Spring controllers in JSP. Suppose I have controller: @Controller class FooController { // Don't bother about semantic of this query right now @RequestMapping("/search/{applicationId}") public String handleSearch(@PathVariable String applicationId) { [...] } } Of course in JSP I can write: <c:url value="/search/${application.id}" /> But it's very hard to change url then. If you familiar with Rails/Grails then you now how this problem resolved: redirect_to(:controller => 'foo', :action = 'search') But in Spring there is so much UrlMappers. Each UrlMapper have own semantic and binding scheme. Rails alike scheme simply doesn't work (unless you implement it yourself). And my question is: are there any more convenient ways to address controller from JSP in Spring?

    Read the article

  • Struts 1 - problem in showing ActionMessages through a JSP page

    - by Yatendra Goel
    I am using Struts 1.3.10. I am trying to display ActionMessage and ActionError set by Action class through a JSP page. The problem is that the ActionErrors are displaying well but ActionMessages are not displaying. When I debug the application, I found that the messages (reference variable of ActionMessages) contains messages. I also saved those messages through saveMessages(request, messages) method of Action class. So, I think that the problem is in the JSP code through which I am trying to display those messages. The JSP code is as follows: <logic:messagesPresent> <ul id="messsages"> <html:messages id="msg" message="true"> <li><bean:write name="msg"/> </li> </html:messages> </ul> </logic:messagesPresent>

    Read the article

  • JSP::Confused with the session objects

    - by Legend
    I just started exploring Java Servlets and JSP and am a little confused about the sessions object. Inside a servlet I have this: public class SampleServlet extends HttpServlet { public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { HttpSession session = request.getSession(true); session.setAttribute("_session", "_value"); response.sendRedirect("page2.jsp"); } } Now, inside page2.jsp, there is a session object as well, but when I do this <% out.print(session.getAttribute("_session")) %> it gives me an error. Can someone tell me the right way of doing this? As to what I am trying to do, I want to share some session variables.

    Read the article

  • Pass a parameter from one jsp to another using form.action

    - by Ntz
    I have an ID that I need in the next jsp once the user click a button. I am trying to do the following: FirstJSP.jsp: function getSecond() { var frm = document.getElementById("frm"); frm.action = "**second.jsp?id=myId;"** frm.submit(); } ... form id="frm" ..... input type="button" value="Next" onclick="getSecond()"/ ...... This code takes me to my second page, but if I tried to access the id, it gives me an error since the id is null. I access the id in the second page by: final Long passedId = Long.parseLong(request.getParameter("id")); I think I am not passing the parameter correctly, but I don't know how to do it. Any ideas? Thank you so much!

    Read the article

  • Problem with interaction servlet-jsp

    - by zp26
    Hi, I have a implementation prolbem. I have create a jsp and a servlet file. I have a remoteInterface of session bean. I wanna use remoteInterface in servlet and after write the data on the jsp. The client must see only the result page. For Example: A method of session bean return a Collection. I use this collection in the servlet and after this stamp all the element in the jsp. Can you help me with a code example. Thanks

    Read the article

  • jsp and java beans

    - by JRR
    I am building jsp pages hosted on tomcat and am wondering if the bean instances referenced in each jsp are stateless / stateful? How do those bean instances come about? Are they (re-)created each time when the page is visited? Do I need to worry about two different users visiting the same page at the same time and getting hold of the same bean instance? In general I find the interaction between jsp and beans quite confusing so I'd appreciate if someone can refer a tutorial / explanation of those concepts. Thanks!

    Read the article

  • Why can't my jsp page read chinese chars from mysql? [migrated]

    - by Canking
    The mysql chars is utf-8, and the jsp page is also set to utf-8. I use the method: DriverManager.getConnection("jdbc:mysql://localhost:3306/jsptest?"+"useUnicode=true&characterEncoding=UTF-8","root",""); But it can not be use. When I insert Chinese chars into mysql and select it out, that would be proper functioning. The question is when I select some Chinese chars that I write into mysql at first, it would be all the "?" at the Chinese char place! Please watch the picture:

    Read the article

  • how to get the result query one by one in jsp and mysql

    - by user261002
    I am trying to implement as Online Mock exam in JSP, but I have a problem to get the questions one by one, it get connceted for the first time, and show me the first question and answers, but when I click on "next" again, it still show me the first question, I think by clicking on "next" it start querying again. please help me. this is my bean : database.SQLSelectStatement sqlselect; database.SQLSelectStatement sqlselect2; static ResultSet questions; static ResultSetMetaData rsm; static ResultSet answers; public void setConnection() throws SQLException { if (database.DatabaseManager.getInstance().connectionOK()) { sqlselect = new database.SQLSelectStatement("question", "question", "0"); sqlselect2 = new database.SQLSelectStatement("answers", "question_id", "0"); questions = sqlselect.executeWithNoCondition(); } } public int i=0; public String getQuestions() throws SQLException { String result = ""; rsm = questions.getMetaData(); for (int i = 0; i < rsm.getColumnCount(); i++) { result += "<th>" + rsm.getColumnName(i + 1) + "</th>"; } if (!questions.isLast()) { questions.next(); System.out.println(i+1); result += "<tr>"; result += "<td>" + questions.getInt(1) + "</td>"; result += "<td>" + questions.getString(2) + "</td>"; result += "</tr>"; result += "<tr>"; sqlselect2.setValue(String.valueOf(questions.getInt(1))); answers = sqlselect2.Execute(); while (answers.next()) { result += "<tr> <td colspan='2'><input type='radio' name='answer' value='" + answers.getString(2) + "'> " + answers.getString(2) + "</td></tr>"; } result += "</tr>"; answers.close(); } return result; } this is the HTML: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <h1>JSP Page</h1> <jsp:useBean id="exam" class="exam.ExamQuestions"></jsp:useBean> <% exam.setConnection(); %> <form method="post"> <table > <%=exam.getQuestions()%> </table> <input type="submit" name="action" value="next"/> </form> <% String action = request.getParameter("action"); if ("next".equals(action)) { out.println(request.getParameter("answer")); } %> </body> </html>

    Read the article

  • jsp getServletContext() error

    - by Reigel
    html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Murach's Java Servlets and JSP</title> </head> <body> <%-- import packages and classes needed by the scripts --%> <%@ page import="business.*, data.*" %> <% //get parameters from the request String firstName = request.getParameter("firstName"); String lastName = request.getParameter("lastName"); String emailAddress = request.getParameter("emailAddress"); // get the real path for the EmailList.txt file ServletContext sc = this.getServletContext(); String path = sc.getRealPath("/WEB-INF/EmailList.txt"); // use regular Java objects User user = new User(firstName, lastName, emailAddress); UserIO.add(user, path); %> <h1>Thanks for joining our email list</h1> <p>Here is the information that you entered: </p> <table cellspacing="5" cellpadding="5" border="1"> <tr> <td align="right">First name:</td> <td><%= firstName %></td> </tr> <tr> <td align="right">Last name:</td> <td><%= lastName %></td> </tr> <tr> <td align="right">Email Address:</td> <td><%= emailAddress %></td> </tr> </table> <p>To enter another email address, click on the Back <br /> button in your browser or the Return button shown <br /> below.</p> <form action="index.jsp" method="post"> <input type="submit" value="Return" /> </form> </body> </html> and it's giving me this error page... Compilation of 'C:\bea\user_projects\domains\mydomain.\myserver.wlnotdelete\extract\myserver_sample01_WebContent\jsp_servlet__display_email_entry.java' failed: C:\bea\user_projects\domains\mydomain.\myserver.wlnotdelete\extract\myserver_sample01_WebContent\jsp_servlet__display_email_entry.java:140: cannot resolve symbol probably occurred due to an error in /display_email_entry.jsp line 19: ServletContext sc = this.getServletContext(); Full compiler error(s): C:\bea\user_projects\domains\mydomain.\myserver.wlnotdelete\extract\myserver_sample01_WebContent\jsp_servlet__display_email_entry.java:140: cannot resolve symbol symbol : method getServletContext () location: class jsp_servlet.__display_email_entry     ServletContext sc = this.getServletContext(); //[ /display_email_entry.jsp; Line:19]                                    ^ 1 error Thu Jun 03 15:56:09 CST 2010 any hint? I'm really new to JSP, and this is my first learning practice... can't find it by google.com.... thanks!

    Read the article

  • Stack Overflows in the Eclipse JSP Editor

    - by stevedbrown
    When editing JSPs in Eclipse, I periodically get stack overflows. Once I get one, each time I click a character I get a pop-up telling me there was another stack overflow. This continues until I close the JSP and re-open it, at which time it's fine for a while. org.eclipse.jst.jsp.core.internal.parser.JSPSourceParser: input could not be parsed correctly at position 1 java.lang.StackOverflowError Has anyone else seen this issue, do you know the cause, and is there a way to fix it?

    Read the article

  • ajax : multiple ajax calls for included js files inside jsp fragment

    - by Nrj
    I am including a jsp fragment by making an ajax call. Now this jsp frag happened to include several js files. When the ajax request is completed, it is loading each of the included js files (on fragments) using a separate get request. (I checked this using firebug.) Now is this the correct behavior (making separate get calls) or am I missing something. Is there a way to include the js files and send the response in one go ?

    Read the article

  • how to access owl file inside jsp

    - by Udayanga
    hi, I'm trying to access owl file using jsp.I've successfully load the owl file and quering that using SPARQL.But still I couldn't success with JSP. I'm always getting error "java.lang.ClassNotFoundException: com.hp.hpl.jena.util.FileManager " help me! Thank in advance!

    Read the article

  • How to insert JSP functionality in Servlets?

    - by chustar
    How can I use Servlets to access the HTML uses of having JSP without having to have all my client-facing pages called *.jsp? I would rather do this than using all the response.write() stuff because I think it is easier to read and maintain when it is all clean "HTML". Is this is fair assesment?

    Read the article

  • ajax and jsp integration

    - by kawtousse
    I want to capture the responseXML that i have built in my jsp. What should I do. after that i will transform it in html. I know this is annoying and we could do it with a framework or a library like jquery but i realize it with ajax. Also i have problems with jquery and jsp\servlet since i must use a JSON SERVICE. Why it seems to me that is so complicated.

    Read the article

  • Error in JSP program -Eclipse 3.5

    - by megala
    while running jsp it shows the following error error reading /opt/eclipse/plugins/com.google.appengine.eclipse.sdkbundle.1.3.0_1.3.0.v200912141120/appengine-java-sdk-1.3.0/lib/shared/jsp/repackaged-appengine-ant-launcher-1.6.5.jar; error in opening zip file How to solve this

    Read the article

  • how to reload the whole page through a button placed in a division in jsp

    - by ajeet singh
    when i tried to make web project, i placed the links on the left on one division and a bigger division on the right to load the jsp pages on clicking the links making the main page same... but when there is a need arises to load the whole page by clicking the button placed on the right division, i found that the only page is loaded on the right division jsp calling its action... please help me to sort out this problem..

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >