Search Results

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

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

  • Populating JavaScript Array from JSP List

    - by tkeE2036
    Ok so perhaps someone can help me with a problem I'm trying to solve. Essentially I have a JSP page which gets a list of Country objects (from the method referenceData() from a Spring Portlet SimpleFormController, not entirely relevant but just mentioning in case it is). Each Country object has a Set of province objects and each province and country have a name field: public class Country { private String name; private Set<Province> provinces; //Getters and setters } public class Province { private String name; //Getters and setters } Now I have two drop down menus in my JSP for countries and provinces and I want to filter the provinces by country. I've been following this tutorial/guide to make a chain select in JavaScript. Now I need a dynamic way to create the JavaScript array from my content. And before anyone mentions AJAX this is out of the question since our project uses portlets and we'd like to stay away from using frameworks like DWR or creating a servlet. Here is the JavaScript/JSP I have so far but it is not populating the Array with anything: var countries = new Array(); <c:forEach items="${countryList}" var="country" varStatus="status"> countries[status.index] = new Array(); countries[status.index]['country'] = ${country.name}; countries[status.index]['provinces'] = [ <c:forEach items="${country.provinces}" var="province" varStatus="provinceStatus"> '${province.name}' <c:if test="${!provinceStatus.last}"> , </c:if> </c:forEach> ]; </c:forEach> Does anyone know how to create an JavaScript array in JSP in the case above or what the 'best-practice' would be considered in this case? Thanks in advance!

    Read the article

  • Accessing Spring beans from a Tiles view (JSP)

    - by Sinuhe
    In Spring MVC I can access my beans in JSP using JstlView's exposedContextBeanNames (or exposeContextBeansAsAttributes). For example, then, in my JSP I can write (${properties.myProperty). But when the same JSP is a part of a tiles view, these properties aren't accessible. Is possible to configure Tiles properly or access these properties in another way? I'm using Spring MVC 3.0.2 and Tiles 2.2.1. Here's a bit of my configuration: <bean id="tilesViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver"> <property name="order" value="1"/> <property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView" /> </bean> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> <property name="order" value="2"/> <property name="prefix" value="/WEB-INF/views/"/> <property name="suffix" value=".jsp"/> <property name="exposedContextBeanNames"> <list><value>properties</value></list> </property> </bean>

    Read the article

  • html includes in a JSP using IIS/WebLogic

    - by Striker
    I have my IIS 6 server setup to process server side includes, we're also using the WebLogic ISAPI plugin for IIS. I have a simple html file that I'm trying to include in the JSP using the following include: <!-- #include file="/pleaseWait/pleaseWait.html" --> When I use the above line in a JSP I get an error message saying: "pleaseWait is not defined". From an HTML file on the web server it works fine. The include works in the HTML whether I use file or virtual. I can't use the jsp @ include because that's resolved at build time and the HTML file does not exist in the Java project. It's static content so it's on the IIS server. In the past we've change the extension to .jsp and included the images and static content in the .war file....the problem with that is we now have 10 different versions of this code in our apps and not all of them look or function the same. This is an attempt to standardize and centralize the code for this feature across our apps. Any ideas or suggestions?

    Read the article

  • Java: attributes order in .jsp getting inversed

    - by NoozNooz42
    Every single time I've read about the meta tags, the attribute where in this order for the description: <meta name="description" content="..." /> First name, then content. It's also like that in the Google Webmaster documentation. Basically, it's like that everywhere. Now in a .jsp (in XML notation) I've got the following: <meta name="description" content="${metadesc}"/> So it's name first, then content. Yet on the generated webpage, I get this: <meta content="...(200 chars or so here making it a very long line)..." name="description"/> Somehow the attributes have been inversed. Because the content follows the official W3C and Google recommendations, the content is a bit less than 200 characters long, which makes it a major pain to "visually verify" that the name attribute is correctly there (I've got to scroll). Anyway... Why are these attribute not appearing in the order defined in the .jsp? Can I force them to appear in the same order as I wrote them in my .jsp? I realize the resulting tag may be valid... But I can also imagine a lot of very creative ways to have valid tags which users would be very upset about. Does this make any sense to inverse these attributes? EDIT wow, just wow... If I invert the attributes in my .jsp (that is, writing them in the "wrong" order), then they appear as I want them to appear in the generated web page. (Tomcat 6.0.26 btw)

    Read the article

  • SQL query in JSP file pulling variable from VXML file

    - by s1066
    Hi I'm trying to get an SQL query to work within a JSP file. The JSP file is pulled by a VXML file here is my JSP file code: <?xml version="1.0"?> <%@ page import="java.util.*" %> <%@ page import="java.sql.*" %> <% boolean success = true; // Always optimistic String info = ""; String schoolname = request.getParameter("schoolname"); String informationtype = request.getParameter("informationtype"); try { Class.forName("org.postgresql.Driver"); String connectString = "jdbc:postgresql://localhost:5435/N0176359"; String user = "****"; String password = "*****"; Connection conn = DriverManager.getConnection(connectString, user, password); Statement st = conn.createStatement(); ResultSet rsvp = st.executeQuery("SELECT * FROM lincolnshire_school_information_new WHERE school_name=\'"+schoolname+"\'"); rsvp.next(); info = rsvp.getString(2); }catch (ClassNotFoundException e) { success = false; // something went wrong } %> As you can see I'm trying to insert the value of the variable declared as "schooname" into the end of the SQL query. However when I come to run the jsp file it doesn't work and I get an error "ResultSet not positioned properly". When I put a standard query in (without trying to make it value of the variable it works fine) Hope that makes sense, and thank you for any help!

    Read the article

  • From Servlet to JSP

    - by kawtousse
    When trying to pass a table built with HTML in my servlet like that: response.setContentType("text/html" ); PrintWriter out = response.getWriter(); out.println("<html>" ); out.println("<head>" ); out.println("<title>Imput OPC</title>" ); out.println("</head>" ); out.println("<body>" ); ... and then response.sendRedirect("/xxx.jsp" ); But I did not found any table in the JSP. A friend told me to use a Bean but how can i catch values from the form ( because I have a treatement with the form before constructing table)in a bean.I must use a servlet for that. So what I want is exactly to construct in the response a table then send it to jsp knowing that: .sendRedirect and getServletContext().getRequestDispatcher("/xxx.jsp").forward(request, response); gives nothing at all. Please Help its urgent. Thinks.

    Read the article

  • populate jsp drop down with database info

    - by Cano63
    Hello, people, i,m looking for the way to populate a jsp dropdown. I want that when the jsp load it fill the dropdown with the info that i have in a database table. Down I,m icluding the code of my class that will create the array and fill it with the database info. Whant i don,t know is how to call that class from my jsp and fill the dropdown. '// this will create my array public static ArrayList getBrandsMakes() { ArrayList arrayBrandsMake = new ArrayList(); while(rs.next()) { arrayBrandsMake.add(loadOB(rs)); // CARGO MI ARREGLO CON UN OBJETO } return arrayBrandsMake; } } //this will load my array object private static DropDownBrands loadOB(ResultSet rs)throws SQLException { DropDownBrands OB = new DropDownBrands (); OB.setBrands("BRAN"); return OB; } '

    Read the article

  • pass ResultSet from servlet to JSP

    - by Dave
    Hi I am doing the following in my SampleServlet.java //Fill resultset from db ..... try { ArrayList Rows = new ArrayList(); while (resultSet.next()){ ArrayList row = new ArrayList(); for (int i = 1; i <= 7 ; i++){ row.add(resultSet.getString(i)); } Rows.add(row); } request.setAttribute("propertyList", Rows); RequestDispatcher requestDispatcher = getServletContext().getRequestDispatcher("/DisplayProperties.jsp"); requestDispatcher.forward(request,response); # and then in my jsp DisplayPropeties.jsp i have <% ArrayList rows = new ArrayList(); if (request.getSession().getAttribute("propertyList") != null) { rows = (ArrayList ) request.getSession().getAttribute("propertyList"); } %> but rows is allways null. Can anyone help with what I am doing wrong please.

    Read the article

  • JSP load external php not using iFrames

    - by Rudiger
    I have a bit of an issue with a site I maintain. I have been asked to add a report to a page that sits in a jsp page. The reporting information comes from a MySQL database. The problem is to connect the jsp to the database would require added functions to code that I do not have the original source of. I thought about redoing all the db connection again but thats a lot of time for something that will probably be rewritten in 3 weeks. Then I thought of just using PHP to display the report in the jsp as I have other pages connecting to the database using php (long story as to why were are using 2 languages). But the only way I know of is by using iFrames which is a bit of a no no. Using the object tag I've seen also has errors in IE. What would be the best way to do this?

    Read the article

  • Populate JSP dropdown with database info

    - by Cano63
    I'm looking for the way to populate a JSP dropdown. I want that when the JSP loads it fills the dropdown with the info that I have in a database table. I'm including the code of my class that will create the array and fill it with the database info. What I don't know is how to call that class from my JSP and fill the dropdown. // this will create my array public static ArrayList<DropDownBrands> getBrandsMakes() { ArrayList<DropDownBrands> arrayBrandsMake = new ArrayList<DropDownBrands>(); while (rs.next()) { arrayBrandsMake.add(loadOB(rs)); // CARGO MI ARREGLO CON UN OBJETO } return arrayBrandsMake; } // this will load my array object private static DropDownBrands loadOB(ResultSet rs) throws SQLException { DropDownBrands OB = new DropDownBrands(); OB.setBrands("BRAN"); return OB; }

    Read the article

  • 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

  • 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

  • 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

  • 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

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