Search Results

Search found 7465 results on 299 pages for 'jsp tags'.

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

  • JSP or .ascx equivalent for Scala?

    - by Daniel Worthington
    I'm working on a small MVC "framework" (it's really very small) in Scala. I'd like to be able to write my view files as Scala code so I can get lots of help from the compiler. Pre-compiling is great, but what I really want is a way to have the servlet container automatically compile certain files (my view files) on request so I don't have to shut down Jetty and compile all my source files at once, then start it up again just to see small changes to my HTML. I do this a lot with .ascx files in .NET (the file will contain just one scriptlet tag with a bunch of C# code inside which writes out markup using an XmlWriter) and I love this workflow. You just make changes and then refresh your browser, but it's still getting compiled! I don't have a lot of experience with Java, but it seems possible to do this with JSP as well. I'm wondering if this sort of thing is possible in Scala. I have looked into building this myself (see more info here: http://www.nabble.com/Compiler-API-td12050645.html) but I would rather use something else if it's out there.

    Read the article

  • how to restrict a jsp hit counter?

    - by user261002
    I am writing a hot counter in jsp, for my coursework. I have write the code, and there is not error and its working, but the problem is that: if the user have open the website and try to user different page, when ever that the user get back to the home page the counter still is adding a number , how can I restrict this part??? shall restrict it with session?? this is my code : The current count for the counter bean is: <% counter.saveCount(); int _numberofvisitors=counter.getVisitorsNumber(); out.println(_numberofvisitors); % Bean: package counter; import java.sql.*; import java.sql.SQLException; public class CounterBean implements java.io.Serializable { int coun = 0; public CounterBean() { database.DatabaseManager.getInstance().getDatabaseConnection(); } public int getCoun() { return this.coun; } public void setCoun(int coun) { this.coun += coun; } public boolean saveCount() { boolean _save = false; database.SQLUpdateStatement sqlupdate = new database.SQLUpdateStatement("counter", "hitcounter"); sqlupdate.addColumn("hitcounter", getCoun()); if (sqlupdate.Execute()) { _save = true; } return _save; } public int getVisitorsNumber() throws SQLException { int numberOfVisitors = 0; if (database.DatabaseManager.getInstance().connectionOK()) { database.SQLSelectStatement sqlselect = new database.SQLSelectStatement("counter", "hitcounter", "0"); ResultSet _userExist = sqlselect.executeWithNoCondition(); if (_userExist.next()) { numberOfVisitors = _userExist.getInt("hitcounter"); } } return numberOfVisitors; } }

    Read the article

  • call lynx from jsp script

    - by Piero
    Hi, I have an execute(String cmd) in a jsp script that calls the exec method from the Runtime class. It works when I call a local command, like a php script stored on the server. for example: /usr/bin/php /path/to/php/script arg1 arg2 So I guess my execute command is ok, since it is working with that. Now when I try to call lynx, the text-based web browser, it does not work. If I call it in a terminal, it works fine: /usr/bin/lynx -dump -accept_all_cookies 'http://www.someurl.net/?arg1=1&arg2=2' But when I call this from my execute command, nothing happens... Any idea why? This is my execute method: public String execute(String cmd){ Runtime r = Runtime.getRuntime(); Process p = null; String res = ""; try { p = r.exec(cmd); InputStreamReader isr = new InputStreamReader(p.getInputStream()); BufferedReader br = new BufferedReader(isr); String line = null; //out.println(res); while ((line = br.readLine()) != null) { res += line; } p.waitFor(); } catch (Exception e) { res += e; } System.out.println(p.exitValue()); return res; }

    Read the article

  • Jsp static import

    - by folone
    I've created a Spring Roo project. Everything looks fine. Now I want to add a form with a text input and a button to my index.jspx. This form will change a static field currentUser in my ToDo class. So I'm adding: <form> <%@ page import="static com.mypack.domain.ToDo.*" %> <label for="_username_id">My name is:</label> <% currentUser = request.getParameter("username"); %> <input type="text" id="username" name="username" maxlength="30" path="username" size="0" value="<%= currentUser %>"/> <input type="submit"/> </form> somewhere in the middle of it. And now it won't work: This page contains the following errors: error on line 6 at column 20: StartTag: invalid element name Below is a rendering of the page up to the first error. function readCookie(name) { var nameEQ = name + '='; var ca = document.cookie.split(';'); for(var i=0;i If I comment the lines above, it works just fine. What is wrong? Is there a way to write a value to a static field of a class from a jsp page? How do I work around this?

    Read the article

  • JSP Upload File Java.lang.NullPointer

    - by newbie123
    I want to develope upload and download file from server. Upload.html <form action="/UploadFile/UploadFile" method="POST" enctype="multipart/form-data">Select a file: <input type="submit" name="button" /> <input type="file" name="first"></form> UploadFile.servlet protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String temp = request.getParameter("first"); System.out.println(temp); File origFile = new File(temp); FileOutputStream out = new FileOutputStream(request.getContextPath() + "pdtImages/" + "FirstFile"); InputStream ins = new FileInputStream(origFile); try { System.out.println(request.getContextPath()); byte[] buf = new byte[1024]; int len; while ((len = ins.read(buf)) > 0) { out.write(buf, 0, len); } out.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } When I submitted the file I got null pointer error message. I not very familiar with jsp can anybody help me? I want to store the file to the server directory.

    Read the article

  • Passing dynamic string in hyperlink as parameter in jsp

    - by user3660263
    I am trying to pass a dynamic string builder variable in jsp I am generating a string through code. String Builder variable has some value but i am not able to pass it in at run time.It doesn't get the value. CODE FOR VARIABLE <% StringBuilder sb=new StringBuilder(""); if(request.getAttribute("Brand")!=null) { String Brand[]=(String[])request.getAttribute("Brand"); for(String brand:Brand) { sb.append("Brand="); sb.append(brand); sb.append("&&"); } } if(request.getAttribute("Flavour")!=null) { String Flavour[]=(String[])request.getAttribute("Flavour"); for(String flavour:Flavour) { sb.append(flavour); sb.append("&&"); } sb.trimToSize(); pageContext.setAttribute("sb", sb); } out.print("this is string"+sb); %> CODE FOR HYPERLINK <a href="Filter_Products?${sb}page=${currentPage + 1}" style="color: white;text-decoration: none;">Next</a></td>

    Read the article

  • Call HashMap from jsp EL ?

    - by Parhs
    Here is my Entity Class public enum UnitType { HOSPITAL, HEALTHCENTER } public static LinkedHashMap<UnitType, String> unitType = new LinkedHashMap<UnitType, String>() { { put(UnitType.HEALTHCENTER, "???t?? ??e?a?"); put(UnitType.HOSPITAL, "??s???µe??"); } }; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String name; private String address; @Column(columnDefinition = "TEXT") private String info; @Enumerated(EnumType.STRING) private UnitType type; At my jsp <c:forEach var="unit" items="${requestScope.units}"> <tr> <td>${unit.id}</td> <td>${unit.name}</td> <td>${unit.address}</td> <td>??!?</td> <td><a href="#">?e??ss?te?a</a></td> </tr> </c:forEach> How can i place the text value of the enum at ??!? .. Any idea? Tried some ways but nothing worked..

    Read the article

  • XML Doc to JSP to TIFF

    - by SPD
    We have around 100 word templates, every time user gets a business request he goes into shared folder select the template he/she wants and enter information and save it as tiff, these tiffs later processed by some batch program. I am trying to automate this process. So I defined an XML which has Template information like <Template id="1"> <Section id="1"> <fieldName id="1">Date</fieldName> <fieldValue></fieldValue> <fieldtype></fieldType> <fieldProperty>textField</fieldProperty> </Section> <Section id="2"> <fieldName id="2">Claim#</fieldName> <fieldValue></fieldValue> <fieldtype></fieldType> <fieldProperty>textField</fieldProperty> </Section> </Template> Based on the template values I generate the JSP on fly. Now I would like to generate a TIFF file out of it in specified format. I am not sure how to handle this requirement. *edited the original question.

    Read the article

  • Cannot connect to MySQL server using JSP

    - by Dibya
    I just set foot on JSP. I started writing simple programs to display dates, system info. Then I tried to connect a MySQL database I have a free hosting account, but I am not able to connect to MySQL database. Here is my code: <%@ page import="java.sql.*" %> <%@ page import="java.io.*" %>  <html> <head> <title>Connection with mysql database</title> </head> <body> <h1>Connection status</h1> <% try { String connectionURL = "jdbc:mysql://mysql2.000webhost.com/a3932573_product"; Connection connection = null; Class.forName("com.mysql.jdbc.Driver").newInstance(); connection = DriverManager.getConnection(connectionURL, "a3932573_dibya", "******"); if(!connection.isClosed()) out.println("Successfully connected to " + "MySQL server using TCP/IP..."); connection.close(); }catch(Exception ex){ out.println("Unable to connect to database."); } %> </font> </body> </html> I am getting Message as Connection Status unable to connect to database. I have tested this connection using PHP using the same username, password and database name. Where am I making mistake?

    Read the article

  • password is auto-completed despite setting redisplay=false in JSP (Struts)

    - by lmcgowin
    So I have a web application on Tomcat, built on top of Struts 1.1. Here is a snippet of my JSP, it's a login. <html:form action = "LoginAction" focus = "username"> <table> <tr><td align = "right">User name: </td> <td><html:text property = "username"/> </td></tr> <tr><td align = "right">Password: </td><td><html:password property = "password" redisplay = "false"/></td></tr> </table> </html:form> Snippet from struts-html-1.1.tld: <tag> <name>password</name> <tagclass>org.apache.struts.taglib.html.PasswordTag</tagclass> <attribute> <name>redisplay</name> <required>false</required> <rtexprvalue>true</rtexprvalue> </attribute> </tag> Resulting HTML: Having trouble getting this to post as code but the relevant part is an input tag of type 'password' with no reference to redisplay, autocomplete, etc. It is my understanding that the redisplay element should be passed through Struts to appear in the HTML.

    Read the article

  • Struts 2: redirect-action ? From on page to another and back again.

    - by Stephan
    Hello, i have a jsp page that has a submit button. This button is linked with another jsp page. So lets assume my stuts file looks like this: B.jsp So now the submit button being on page "A.jsp" will take me to B.jsp. This works. The problem is that i want to do the following: press on the submit button on page A.jsp , go to B.jsp where i will press again a button and go back to A.jsp . The problem is that to page B.jsp go many pages, so B.jsp has to know when pressing the submit button to which page will take me back , in this case A.jsp again. So in a few words, B.jsp has to know from which page i came from so that i can go back again by pressing a submit button (this could be a parameter that would be sent back to A.jsp again, but does not really matter at the current point) A.jsp - B.jsp - A.jsp C.jsp - B.jsp - C.jsp

    Read the article

  • JDBC with JSP fails to insert

    - by StrykeR
    I am having some issues right now with JDBC in JSP. I am trying to insert username/pass ext into my MySQL DB. I am not getting any error or exception, however nothing is being inserted into my DB either. Below is my code, any help would be greatly appreciated. <% String uname=request.getParameter("userName"); String pword=request.getParameter("passWord"); String fname=request.getParameter("firstName"); String lname=request.getParameter("lastName"); String email=request.getParameter("emailAddress"); %> <% try{ String dbURL = "jdbc:mysql:localhost:3306/assi1"; String user = "root"; String pwd = "password"; String driver = "com.mysql.jdbc.Driver"; String query = "USE Users"+"INSERT INTO User (UserName, UserPass, FirstName, LastName, EmailAddress) " + "VALUES ('"+uname+"','"+pword+"','"+fname+"','"+lname+"','"+email+"')"; Class.forName(driver); Connection conn = DriverManager.getConnection(dbURL, user, pwd); Statement statement = conn.createStatement(); statement.executeUpdate(query); out.println("Data is successfully inserted!"); } catch(SQLException e){ for (Throwable t : e) t.printStackTrace(); } %> DB script here: CREATE DATABASE Users; use Users; CREATE TABLE User ( UserID INT NOT NULL AUTO_INCREMENT, UserName VARCHAR(20), UserPass VARCHAR(20), FirstName VARCHAR(30), LastName VARCHAR(35), EmailAddress VARCHAR(50), PRIMARY KEY (UserID) );

    Read the article

  • Creating a page selector with JSP/JSTL

    - by zakSyed
    I am working on a project where I am required to build a page somewhat similar to the one you see when you visit a website like blockbuster. When you click on browse more you are taken to a page with a bar on top with different page numbers and a drop down to select the number of pages you want to view on that page. I want to include a feature like that on my page but I am not sure where to start. In my page I have list of 200 items which I want to display page by page. I was suggested to use custom tags, but is there a more simpler or efficient way to create that functionality. My web application uses Spring MVC framework and is coded entirely in Java. Any suggestions will be appreciated.

    Read the article

  • HTML custom tags: pros & cons

    - by o_O Tync
    I'd like to use some semantic HTML tags instead of <div>s: <article>, <product>, <footer> etc. Some of them are already presented in the upcoming HTML5, however, it's not fully supported. Which are the possible cons I might face when Rendering? Using CSS, JS? The one I remember is: IE6 can't clone tags it doesn't know.

    Read the article

  • Database Schema for Machine Tags?

    - by Gabriel
    Machine tags are more precise tags: http://www.flickr.com/groups/api/discuss/72157594497877875. They allow a user to basically tag anything as an object in the format object:property=value Any tips on a rdbms schema that implements this? Just wondering if anyone has already dabbled with this. I imagine the schema is quite similar to implementing rdf triples in a rdbms

    Read the article

  • [X]HTML custom tags: pros & cons

    - by o_O Tync
    I'd like to use some semantic [X]HTML tags instead of <div>s: <article>, <product>, <footer> etc. Some of them are already presented in the upcoming HTML5, however, it's not fully supported. Which are the possible cons I might face when Rendering? Using CSS, JS? The one I remember is: IE6 can't clone tags it doesn't know.

    Read the article

  • dynamic button in jsp

    - by kawtousse
    hi everyone, in my jsp i have a table constructed dynamically like the following: retour.append("<tr>"); try { s= HibernateUtil.currentSession(); tx=s.beginTransaction(); Query query = s.createQuery(HQL_QUERY); for(Iterator it=query.iterate();it.hasNext();) { if(it.hasNext()){ Dailytimesheet object=(Dailytimesheet)it.next(); retour.append("<td>" +object.getActivity() +"</td>"); retour.append("<td>" +object.getProjectCode() + "</td>"); retour.append("<td>" +object.getWAName() + "</td>"); retour.append("<td>" +object.getTaskCode() +"</td>"); retour.append("<td>" +object.getTimeFrom() +"</td>"); retour.append("<td>" +object.getTimeSpent() + "</td>"); retour.append("<td>" +object.getPercentTaskComplete() + "</td>"); if (droitdaccess) { retour.append(""); retour.append(""); retour.append(""); retour.append("<td bordercolor=#FFFFFF>"); retour.append("<input type=\"hidden\" id=\"id_"+nomTab+"_"+compteur+"\" value=\""+object.getIdDailyTimeSheet()+"\"/>"); retour.append("<img src=\"icon_delete.gif\" onClick=\"deletearowById('id_"+nomTab+"_"+compteur+"')\" style=\"cursor:pointer\" name=\"action\" value=\"deleting\" />"); retour.append("</td>"); } } compteur++; retour.append("</tr>"); } //terminer la table. retour.append ("</table>"); next to the table i want to display a button named send in order to send the table content. I do not really want to dispaly this button where the table is empty. So at least if the table is populated by nly one record i want that button being displayed. How should i deal in this case. Thanks.

    Read the article

  • Handling a Long Running jsp request on the server using Ajax and threads

    - by John Blue
    I am trying to implement a solution for a long running process on the server where it is taking about 10 min to process a pdf generation request. The browser bored/timesout at the 5 mins. I was thinking to deal with this using a Ajax and threads. I am using regular javascript for ajax. But I am stuck with it. I have reached till the point where it sends the request to the servlet and the servlet starts the thread.Please see the below code public class HelloServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("POST request!!"); LongProcess longProcess = new LongProcess(); longProcess.setDaemon(true); longProcess.start(); request.getSession().setAttribute("longProcess", longProcess); request.getRequestDispatcher("index.jsp").forward(request, response); } } class LongProcess extends Thread { public void run() { System.out.println("Thread Started!!"); while (progress < 10) { try { sleep(2000); } catch (InterruptedException ignore) {} progress++; } } } Here is my AJax call <!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>My Title</title> <script language="JavaScript" > function getXMLObject() //XML OBJECT { var xmlHttp = false; xmlHttp = new XMLHttpRequest(); //For Mozilla, Opera Browsers return xmlHttp; // Mandatory Statement returning the ajax object created } var xmlhttp = new getXMLObject(); //xmlhttp holds the ajax object function ajaxFunction() { xmlhttp.open("GET","HelloServlet" ,true); xmlhttp.onreadystatechange = handleServerResponse; xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xmlhttp.send(null); } function handleServerResponse() { if (xmlhttp.readyState == 4) { if(xmlhttp.status == 200) { document.forms[0].myDiv.value = xmlhttp.responseText; setTimeout(ajaxFunction(), 2000); } else { alert("Error during AJAX call. Please try again"); } } } function openPDF() { document.forms[0].method = "POST"; document.forms[0].action = "HelloServlet"; document.forms[0].submit(); } function stopAjax(){ clearInterval(intervalID); } </script> </head> <body><form name="myForm"> <table><tr><td> <INPUT TYPE="BUTTON" NAME="Download" VALUE="Download Queue ( PDF )" onclick="openPDF();"> </td></tr> <tr><td> Current status: <div id="myDiv"></div>% </td></tr></table> </form></body></html> But I dont know how to proceed further like how will the thread communicate the browser that the process has complete and how should the ajax call me made and check the status of the request. Please let me know if I am missing some pieces. Any suggestion if helpful.

    Read the article

  • How to: Searchlogic and Tags

    - by bob
    I have installed searchlogic and added will_paginate etc. I currently have a product model that has tagging enabled using the acts_as_taggable_on plugin. I want to search the tags using searchlogic. Here is the taggable plugin page: http://github.com/mbleigh/acts-as-taggable-on Each product has a "tag_list" that i can access using Product.tag_list or i can access a specific tag using Product.tags[0] I can't find the scope to use for searching however with search logic. Here is my part of my working form. <p> <%= f.label :name_or_description_like, "Name" %><br /> <%= f.text_field :name_or_description_like %> </p> I have tried :name_or_description_or_tagged_with_like and :name_or_description_or_tags_like and also :name_or_description_or_tags_list_like to try and get it to work but I keep have an error that says the options i have tried are not found (named scopes not found). I am wondering how I can get this working or how to create my own named_scope that would allow me to search the tags added to each product by the taggable plugin. Thanks!

    Read the article

  • Facebook Like Meta Tags not showing Images

    - by Hooman Ahmadi
    I have implemented the Facebook Like button on all our pages and it works properly by posting to Facebook with the correct meta tags. However, the images do not show in Facebook. The image meta tags show up properly when I use the Facebook Linter, but they don't show on someone's facebook page where the Like is posted on their wall. Also, is there any way to have the info recache more often? The tags take forever to update. Our site is built with CakePHP. Below are snippets of my code, thanks: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml"> <head> <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script> <script type="text/javascript" src="http://use.typekit.com/wlx8xgm.js"></script> <script type="text/javascript">try{Typekit.load();}catch(e){}</script> <?php if(!isset($meta_title)) { $meta_title = $title_for_layout; } if(!isset($meta_location)) { $meta_location = null; } if(!isset($meta_image)) { $meta_image = null; } if(!isset($meta_type)) { $meta_type = null; } ?> <meta property="og:title" content="<?= $meta_title ?>"/> <meta property="og:type" content="<?= $meta_type ?>"/> <meta property="og:url" content="<?= $meta_location ?>"/> <meta property="og:image" content="<?= $meta_image ?>"/> <meta property="fb:admins" content="1004432800"/> ... echo '<br><br><fb:like href="' . $fbook_url . '" width="300" height="80" layout="standard" show_faces="true" colorscheme="light"></fb:like>';

    Read the article

  • using internationalization on list data

    - by singh
    i am using Struts2 in application. <s:iterator value="listObject"> <s:component template="abc.vm"> <s:param name="text" value="listValue" /> <s:param name="prefix" value="listIndex" /> </s:component> </s:iterator> listValue is a values of list. i am using iterator to traverse the list. now on listValue, i want to put here internationalization concept.so that all the list value can be display based on Locale which store in a list. please suggest!

    Read the article

  • Regular Expression HTML tags

    - by user134615
    I'd like to know whether it exists a way to put the following HTML tags in a regex. What I want is a regex that can match all the start tags with their corresponding closing tags. E.g., Hello There might be more tags inside. I had thought of something like this: ^<([a-z]+)([^<]+)(?:(.)</\1|\s+/)$/, but it wont work. Sorry if this question doesnt belong to this section. Thank you.

    Read the article

  • RegEx match open tags except XHTML self-contained tags

    - by Jeff
    I need to match all of these opening tags: <p> <a href="foo"> But not these: <br /> <hr class="foo" /> I came up with this and wanted to make sure I've got it right. I am only capturing the a-z. <([a-z]+) *[^/]*?> I believe it says: Find a less-than, then Find (and capture) a-z one or more times, then Find zero or more spaces, then Find any character zero or more times, greedy, except /, then Find a greater-than Do I have that right? And more importantly, what do you think? =) EDIT: Hmm, which answer to mark as correct? For the record, ALL the answers are appreciated. Many thanks!

    Read the article

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