JSF :: Using JQuery In Template File With Single And Double Quotes
Jan 5, 2015
I'm learning jQuery to integrate into a JSF application but finding some confusion on the correct syntax especially when it comes to combining double and single quotes in the jQuery scripts. So for this particular page I want jQuery to traverse through a list of documents and put icons next to each document to state what type of document each is (ie: PDF, doc, xls). I can get this to work using normal html markup but I get a Syntax Error - Unexpected Token exception in the browser.
I'm confused about whether this means I need to use the right html references for the JSF element I wish to traverse or whether this is a problem with the way I'm using my quotes.
Also I'm not sure how to correctly reference jsf tags inside jQuery scripts. So for an ordinary html page I execute the following jQuery script:
<script type="text/javascript">
$("document").ready(function () {
$("li a[href = ' .pdf']").after("<img src='myImage'/>");
});
</script>
</code>
Then I have a JSF page with the following commandLink:
<p:column>
<p:commandLink class="downLoadLink" value="Download" ajax="false">
<p:fileDownload value="#{projectDocBean.downloadedFile}"
contentDisposition="attachment"/>
</p:commandLink>
</p:column>
For this page I try to execute the following script:
<script type="text/javascript">
$("document").ready(function () {
$("#downLoadLink = ' .pdf']").after("<img src='myImage'/>");
});
</script>
I get the same syntax error no matter what I put into the script of the JSF page. How to correctly integrate jQuery with JSF.
View Replies
ADVERTISEMENT
Sep 26, 2014
If I'm using an xml file and the piece of data I want from the file looks like Staff id ="Test";
Is it something like this? Only seen two examples of it but I'm not sure they were reading from a file like myself.
Staff id = """ + Test + """;
View Replies
View Related
Mar 17, 2014
how to replace all the command that is found on a string between 2 double quotes? for example I have a text file that contains data like as following
A,"-16,12","-178,245","-15,506"
B,"-16,12","-178,245","-15,506"
C,0, 0,1
I need an output like this:
A,"-16.12","-178.245","-15.506"
B,"-16.12","-178.245","-15.506"
C,0, 0,1
I did this but without regular expression. It seems to me that a regular expression it's more elegant than to parse every line and replace it.
View Replies
View Related
Apr 1, 2014
How to maintain quotes in a text file? If no source files .
Новый точечный .jpg
Prompt in what direction to go .... maybe you can use other languages to do it?
Заранее СПасибо!!!
View Replies
View Related
Jun 1, 2015
I have a template file which I'm tring to upload into a database using setBlob or setBinaryStream but I'm getting the following error:
java.lang.AbstractMethodError: setBlob
at weblogic.jdbc.wrapper.PreparedStatement.setBlob(PreparedStatement.java:1005)
at com.capitalone.citrix.ssp.dao.KatetDaoImpl.uploadReport(KatetDaoImpl.java:1697)
at com.capitalone.citrix.ssp.services.FileOpsImpl.generateDownload(FileOpsImpl.java:648)
at com.capitalone.citrix.ssp.controller.JSONController.display(JSONController.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[Code] .....
I'm using :
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
Weblogic Server Versions: 10.3.0.0 with Java 1.6.0_05
The driver class name for the weblogic datasource: weblogic.jdbcx.oracle.OracleDataSource
Initially, I tried:
sqlQuery = new StringBuffer();
ps = null;
sqlQuery.append("insert into KATET_REPORTS (FILE_DATA)");
[Code] ....
This failed, so I changed ps.setBlob(1,is)
to
ps.setBinaryStream(1,is). This failed as well with teh same error, just for setBinaryStream instead of setBlob.
Is there a known inconsistency between that driver and this Weblogic version? Is there something else going on? If I haven't given enough data to debug the issue here, what other data should I gather?
View Replies
View Related
Dec 17, 2014
I am using Spring to develop a web application.I have used JQuery ui in HTML page it is working fine a Dialog box appear with JQuery effect.But When I use the same procedure in jsp it is not working.Here is my code of jsp file
<%@ 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>Login Page</title>
<style>
[code]....
View Replies
View Related
Mar 31, 2013
When I click on "Clean and Build" NetBeans generates a .jar file and inside the folder "dist" it add a directory called "lib" with all the java libraries used to implement the program. I would like to achieve with this IDE an unique .jar file that includes everything you need such as Eclipse does by default. Is it possible?
View Replies
View Related
Apr 20, 2015
I am trying to create a second class in a single java file (first time trying this) and want to use data from the first class in the second class but I am not able to do it. What am I missing :
package simplecommissioncalculation;
import java.util.Scanner; // import java.util.Scanner
public class SimpleCommissionCalculation {
public static void main(String[] args) {
[Code] .....
View Replies
View Related
Apr 17, 2015
I need to generate XML file based on XSD template in Java, I can parse the XSD file, but don’t know after parsing, how to generate XML file.
View Replies
View Related
Oct 12, 2014
I have to read data from a text file and print it in a new text file. An example of one line is like this:
Johnson 85 98 75 89 82
I then have to take the average of all the numbers and assign a "grade" to the numbers for each line of the text file and make a new file so it looks like this for 10 lines:
Name 1 2 3 4 5 Average Grade
Johnson 85 98 75 89 82 85.80 B
My problem is extracting the data from the file so I can use it.
View Replies
View Related
May 28, 2015
I need to write out multiple BufferedImages to a single tiff file. Each image represents a seismic time slice which can be several megabytes in size. I have used the TIFFEncodeParam.setExtraImages method and saved all my BufferedImages to a vector but my since I create so many BIs I keep running out of memory. Is there a way to create a BI, write it out to a TIFF file, then discard the BI and create the next one?
View Replies
View Related
Aug 24, 2014
Basically, I am trying to write a method that will take a string, a target, and a replacement (a replacement function like string.replace). I want it to replace all instances of target with replacement EXCEPT for instances that occur within single or double quotes.
Example input / output:
this "Wont" be " replaced, be"
call: replace(theString, "replaced", "narf") and replace(theString, "be", "rafn")
output:
this "Wont" rafn " replaced, be"
View Replies
View Related
Oct 20, 2014
I am new to Java, programming, and intelliJ. I am trying to make a BMI Calculator using this code as my initial template which converts Fahrenheit to Celsius.
import javax.swing.JFrame;
public class Fahrenheit
{
//-----------------------------------------------------------------
// Creates and displays the temperature converter GUI.
//-----------------------------------------------------------------
[code]....
I created a local field within BMIButtonListener for weight, height, resultLabel, and was able to compile but it did not calculate and listed exceptions.
View Replies
View Related
Aug 8, 2014
I'm trying to do a program that send a single file from a client to a default directory of a Server. The program use the datagramSocket and datagramPacket for the transfer via UDP. The client sent the packet of the file correctly and the server start the receiving but every time the Server class crashes after it's receiving 4/5 packet (exactly 8192 byte)
Then i put the code of the 2 class and the 2 output.
OUTPUT CLIENT:
PROGRAM TRANSFER PACKAGES
name of file is : Doc1.pdf
his dimension: 11408 byte
*** start sending
- 1024 byte
- 2048 byte
- 3072 byte
- 4096 byte
- 5120 byte
- 6144 byte
- 7168 byte
- 8192 byte
- 9216 byte
- 10240 byte
- 11264 byte
- 11408 byte
*** FILE SUCCESFULL SENDED***
BUILD SUCCESSFUL (total time: 3 seconds)
OUTPUT SERVER
PROGRAM TRANSFER PACKAGES
START NEW CONNECTION
Directory: C:prova
Server waiting in port: 9876
Waiting Client...
Name of file is : Doc1.pdf
Dimension : 11408
[Code] ....
In this point the program go in loop and didn't anything. I don't understand how can i resolve it...
SERVER
package udp_pacchetti;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
[Code] ...
View Replies
View Related
Nov 3, 2014
After opening a file dialog box and choosing a file and the path to that file is placed ina jTextField, How can I surround that text with quotes, if that path contains spaces? This is how I did it in VB.
Function WrapIfRequired(ByVal Filename As String) As String
Dim containsSpaces As Boolean = False
Dim FilePath As String = Filename.Trim
If FilePath.Contains(" ") Then containsSpaces = True
If containsSpaces = True Then
Return """" & FilePath & """"
Else
Return FilePath
End If
View Replies
View Related
Nov 29, 2014
If I have a web page with a lot of data to show, say a lot of tables and graphics, would using non JSP based frameworks result in a lot more individual AJAX requests? For example if the page have 5 tables, with JSP the whole page will be returned to the browser with data for all 5 tables already. But if this is a pure HTML / Javascript based view, then we need to have each of the 5 tables to make individual AJAX requests in order to render the page. Is this indeed the down side for not using JSP?
The reason I'm asking is because I'm considering moving away from JSP to a template based framework such as Thymeleaf or Freemarker.
View Replies
View Related
Oct 8, 2014
why when i use the following outputText tag
<h:outputText value="Testone"/>
The generated HTML is
<div>Testone</div>
And when i use the next outputText tag the output is enclosed in quotes
<h:outputText value='<a href="http://some.site.com/login?URL=http://a.b.com/">Some sitelink</a>'/>
"<a href="http://some.site.com/login?URL=http://a.b.com/">Some sitelink</a>"
To temporarily fix something i need to generate an html tag using a param value. Here an example
<h:outputText value="<a href="http://some.domain.nl/login?URL={0}">Hi There</a>">
<f:param value="#{request.scheme}://#{request.serverName}:#{request.serverPort}#{request.contextPath}" />
</h:outputText>
View Replies
View Related
Apr 8, 2014
I want to validate my JSF page using JQuery. I tried a piece of code. But it did not work. The foll is my code.
<?xml version="1.0" encoding="UTF-8"?>
<!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"
xmlns:f="http://java.sun.com/jsf/core"
[code]....
View Replies
View Related
Nov 4, 2014
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String delete = ("DELETE FROM anagrafica WHERE Nome = ? And Cognome = ?");
ConnectionManager cm = new ConnectionManager();
String Nome = request.getParameter("nome");
String Cognome = request.getParameter("cognome");
[code]....
and this is my JSP.The problem is easy, when I click on the grid for deleting the record two things happen, or the record is deleted only on JSP but not in my Database or Nothing happens even on my JSP, it is because I don't know how to get values from my jsp and send them to replace the ? in my delete query I tried even to give a name to the <tr> which contains Name and Last name but obviously i guess it works only for input type ex. Textbox.
View Replies
View Related
Nov 14, 2014
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>JQuery Demo</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" />
[Code] ....
The above code works great and displays date picker with next and previous button but when I use same code on a jsp page the buttons to go back to previous and next month does not show up.
View Replies
View Related
Mar 3, 2015
I'm using JSF1.2 and IBM websphere portal 7 (Core) not prime or rich faces. I would like to know to sort the JSF data table(<h:datatable /> using Jquery 1.7
View Replies
View Related
Mar 21, 2015
By using FileReader, FileWriter and their constituents, I am creating a file to contain employee information ( name, age, hours, etc. ). The user is to input all of the data on a single line and we were asked to implement StringTokenizer to assign that data to the file. I have never used the StringTokenizer before, but I have a rough idea how it is to function. I used pw.println to test what I have so far, now I would like to let the user build the initial file with the "first employees" of the company, and then view the file, and then go back and append new employee data to that same file. My question is, how can I take the user input as a StringTokenizer and add that to the file?
In the for loop below, I thought I would see if it would work, but it does not. The loop only executes once and does not allow me to enter data.
public class Records {
public static void main(String [] args) throws IOException {
Scanner input = new Scanner(System.in);
FileWriter fw = new FileWriter("dbs3.java");
BufferedWriter bw = new BufferedWriter(fw);
PrintWriter pw = new PrintWriter(bw);
System.out.println("NEW EMPLOYEE DATA SHEET");
System.out.print("Number of new employees: ");
int number = input.nextInt();
[Code] ....
View Replies
View Related
Aug 9, 2014
I have an bean vacationRequestBean with startdate and enddate of date field. I used jquery date picker in my index.xhtml for those fields. format is MM-dd-yyyy for date picker
<script>
$(function() {
$("#datepicker").datepicker();
});
</script>
and in xhtml
<h:inputText id="date" class="datepicker" value="#{vacationRequestBean.startdate }" >
<f:convertDateTime pattern="MM-dd-yyyy" type="date />
</h:inputText>
<h:inputText id="date" class="datepicker" value="#{vacationRequestBean.enddate }" >
<f:convertDateTime pattern="MM-dd-yyyy" type="date />
</h:inputText>
I am getting error as "<f:convertDateTime > Parent not an instance of ValueHolder". How to store the value selected using jquery date picker to bean on submitting the form.
View Replies
View Related
Jun 25, 2014
I am developing my college's project in JSP using jquery to open a magnific popup when user clicks on a link and the in the magnific Popup must be fetched from Mysql and i tried two approaches for this:
1. magnific Popup type is ajax here i passed the variable value in the link of href (after '?') to another JSP page where connection to database is created and queries are written in JSTL to fetch data and show this in magnific Popup .. But i failed in this approach, don't know in another JSP page the data without having database connection is loaded in the magnific Popup easily but not database data..
2. magnific Popup type inline here i need to pass the variable value in the same page between different tags..
View Replies
View Related
Mar 18, 2015
i don't need ordinary javascript alert box. so i was use the jquery modal alert box for different action like success, error etc.but i have problem to call the alert box within servlet.
out.println("<link href="css/jquery.modal.css" type="text/css" rel="stylesheet" />");
out.println("<script type="text/javascript" src="js/jquery-latest.min.js">");
out.println("<script type="text/javascript" src="js/jquery.modal.min.js">");
out.println("<script type="text/javascript" src="js/jscript.js">");
out.println("<script type="text/javascript" src="js/success.js">");
out.println("<script type="text/javascript">");
response.getOutputStream().println("success();");
out.println("</script>");
how to call the modal function in the js file?
otherwise how to show the modal alert box?
View Replies
View Related
Nov 17, 2014
I have a need to refresh my database for every 15 seconds. I have to work with jsp ajax and jquery. For small amount of db entries it is ok but My application is going to handle huge records more than 20000. In my present scenario, Im forwarding request to another jsp page which communicate db and returns a table as result. Instead of this what are things I need to do?? This is just a sample application only. On success I am gonna implement using Spring, hibernate. So instead of table returning json or arraylist like that will work??
Here is my code:
## index.jsp ##
<!-- begin snippet: js hide: false -->
<!-- language: lang-html -->
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.*" %>
[Code] .....
View Replies
View Related