ResultSet date into JavaScript Function HELP!!
I am developing an auction web site for a end year project in college, it is all done except this countdown thingy. I got the 'endDate' of an auction in a table. I can get the date out no problem at all, where im stuck is where i gotta pass the date from the result set into the javascript countdown function so it can countdown to the end of the auction. Code below
<%@ page language = "java" contentType = "text/html"%>
<%@ page language = "java" import = "com.sybase.jdbcx.SybDriver" %>
<%@ page language = "java" import = "java.sql.*" %>
<%@ page language = "java" import = "java.util.*"%>
<% Connection dbConn = null;
try
Class.forName("com.sybase.jdbc2.jdbc.SybDriver");
dbConn = DriverManager.getConnection("jdbc:sybase:Tds:compserver:5000/syb3044","
syb3044", "syb3044");
Statement b = dbConn.createStatement();
ResultSet bid = b.executeQuery("select * from bid where carID=1");
if(bid.next()){}
%>
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
mDate = new Date("20 April 2004 16:45") //Hard Coded Date Here, Want ResultSet Date Passed Here
function countdown()
var now=new Date()
var diff=mDate.getTime()-now.getTime()
if (diff <= 0)
document.bid.mseconds.value = 0
return 0;
document.bid.days.value = Math.round(diff/(24*60*60*1000))
document.bid.hours.value = Math.round(diff/(60*60*1000))
document.bid.minutes.value = Math.round(diff/(60*1000))
document.bid.seconds.value = Math.round(diff/1000)
document.bid.mseconds.value = diff
var id=setTimeout("countdown()",0)
</SCRIPT>
</HEAD>
<BODY onLoad="countdown()">
<BR>
<form name="bid" method="post" action="">
<p>Timeleft</p>
<TABLE BORDER=0>
<TD width="79">Days: </TD>
<TD width="81">
<INPUT TYPE="text" NAME="days" SIZE=15></TD> <TR>
<TD width="79">Hours: </TD>
<TD width="81">
<INPUT TYPE="text" NAME="hours" SIZE=15></TD> <TR>
<TD width="79">Minutes:</TD>
<TD width="81">
<INPUT TYPE="text" NAME="minutes" SIZE=15></TD> <TR>
<TD width="79">Seconds: </TD>
<TD width="81">
<INPUT TYPE="text" NAME="seconds" SIZE=15></TD> <TR>
<TD width="79">Milliseconds:</TD>
<TD width="81">
<INPUT TYPE="text" NAME="mseconds" SIZE=15></TD> <TR>
</TABLE>
</form>
</BODY>
</HTML>
<%
bid.close();
catch (SQLException sqle)
out.println(sqle.getMessage());
catch (ClassNotFoundException cnfe)
out.println(cnfe.getMessage());
catch (Exception e)
out.println(e.getMessage());
finally
try
if(dbConn != null)
dbConn.close();
catch (SQLException sqle)
out.println(sqle.getMessage());
%>
...........................................................SQLTable.......................................................................................................................
create TABLE bid
bidID integer primary key,
carID numeric NOT NULL,
seller varchar(50) NOT NULL,
username varchar(50),
startDate varchar(25) not null,
endDate datetime not null
PS, tried putting endDate as varchar but same result
Please note I am a computer science student
Regards Don Colvin
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 19 in the jsp file: /Test.jsp
Generated servlet error:
[javac] Compiling 1 source file
C:\Tomcat\work\Catalina\localhost\Mess\org\apache\jsp\Test_jsp.java:55: cannot resolve symbol
symbol : class SimpleDateFormat
location: class org.apache.jsp.Test_jsp
out.print( new SimpleDateFormat("dd MMMM YYYY hh:MM").format(bid.getDate("endDate")) );
^
1 error
It throwing back this error, any suggestions
Similar Messages
-
Post data into Ajax function for Item type plugin
Please advise how to post data into Ajax function for item type plugin
Edited by: Casufi on Jan 16, 2013 7:44 AMCasufi wrote:
Casufi wrote:
Please advise how to post data into Ajax function for item type plugin
Edited by: Casufi on Jan 16, 2013 7:44 AMI used the following code
var get = new htmldb_Get(null, html_GetElement(''pFlowId'').value, ''NATIVE='||apex_plugin.get_ajax_identifier||''', $v(''pFlowStepId''));
get.addParam(''x01'', node.data.key);
gReturn = get.get();You should use this published true ajax API instaed. apex.server.process( pAjaxIdentifier, pData, pOptions ) -
I can't insert my data into the table - help please
Hello everyone,
I have a trouble about JSP. I'm using Java2 SDK,JSP 1.2,Mysql and TOMCAT.
I want to do this. A user has to enter the nicno,into the html form(EnterNicInter.jsp),to verify if it is already exist or not. If it is exist in the db, an error msg(Record already exist) must be displayed. If not, then the page "InterviewForm.jsp" displayed. This part is working.
But, I can't save these details into the db by clicking submit button int the InterviewForm.jsp.
I wrote a javaBean for this task. Here is it.
CandidateMgr.java
package hrm;
import java.io.*;
import java.sql.*;
public class CandidateMgr
private String nicno;
private String title;
private String firstName;
private String civilStatus;
private String tele;
private String eduQua;
// Constructor
public CandidateMgr()
this.nicno = nicno;
this.title = title;
this.firstName = firstName;
this.civilStatus= civilStatus;
this.tele = tele;
this.eduQua = eduQua;
//getters & setters.
// Initializes the connection and statements
public void initConnection() {
if (connection == null) {
try {
String sql;
// Open the database
Class.forName(DRIVER).newInstance();
connection = DriverManager.getConnection(URL);
//Verify nicno
sql="SELECT * FROM Candidate where nicNo= ?";
pstmt1 = connection.prepareStatement(sql);
sql ="INSERT INTO Candidate
VALUES(?,?,?,?,?,?)";
pstmt2 = connection.prepareStatement(sql);
catch (Exception ex) {
System.err.println(ex.getMessage());
public boolean verifyNicNo(){
boolean nic_no_select_ok = false;
String nic="xxxx";
initConnection();
try {
pstmt1.setString(1, nicno);
ResultSet rs1 = pstmt1.executeQuery();
if(rs1.next()){
nic=rs1.getString("nicNo");
if(nic=="xxxx")
nic_no_select_ok = true;
} else{
nic_no_select_ok = false;
rs1.close();
pstmt1.close();
catch (Exception ex) {
System.err.println(ex.getMessage());
return nic_no_select_ok;
public boolean addInter(){
boolean add_inter_ok = false;
try{
//assign values for the object
pstmt2.setString(1, nicno); // ERROR(java:652)
pstmt2.setString(2, title);
pstmt2.setString(3, firstName);
pstmt2.setString(4, civilStatus);
pstmt2.setString(5, tele);
pstmt2.setString(6, eduQua);
if(pstmt2.executeUpdate()==1) add_inter_ok=true;
pstmt2.close();
catch(SQLException e2){
System.err.println(e2.getMessage());
return add_inter_ok;
IntreviewForm.jsp (used to submit data into the db)
<form method="POST" action="InterviewCtrl.jsp">
//codes
<input type="text" name="nicno" size="14" style="border:1px solid #0000FF;
color: #FF0000; font-weight: bold">
<input type="text" name="title" size="14" style="border:1px solid #0000FF;
color: #FF0000; font-weight: bold">
<input type="text" name="firstName" size="14" style="border:1px solid #0000FF;
color: #FF0000; font-weight: bold">
<input type="text" name="civilStatus" size="14" style="border:1px solid #0000FF;
color: #FF0000; font-weight: bold">
<input type="text" name="tele" size="14" style="border:1px solid #0000FF;
color: #FF0000; font-weight: bold">
<input type="text" name="eduQua" size="14" style="border:1px solid #0000FF;
color: #FF0000; font-weight: bold">
</form>.......................................................................
Here is the "InterviewCtrl.jsp"
<%@ page language="java" import="java.util.*"%>
<%@ page import="hrm.CandidateMgr" %>
<%@ page session="false" %>
<jsp:useBean id="candidate" class="hrm.CandidateMgr" scope="request"/>
<jsp:setProperty name="candidate" property="*"/>
<%-- Execute the addInter() method on the bean and check if it is true or false.-- %>
<%-- if it's true then display a confirmation message "InterConfirm.html" --%>
<%-- else display InterError.html --%>
<%
String nextPage ="MainForm.jsp";
if(candidate.addInter()){
nextPage="InterConfirm.html";
}else{
nextPage="InterError.html";
%>
<jsp:forward page="<%=nextPage%>"/>.......................................................................
Here is the error:(I mark it in my bean also)
root cause
java.lang.NullPointerException
at hrm.CandidateMgr.addInter(CandidateMgr.java:652)
at org.apache.jsp.InterviewCtrl_jsp._jspService(InterviewCtrl_jsp.java:66)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
I use JSP 1.2 , mySQL with TOMCAT. My table name is Candidate.It's fields are as follows:
Candidate(nicNo,title,fName,civilStatus,tele,eduQua)
Can anybody tell me whats going on, help me to solve this please.
Thanks.you should try something different, since you are mixing up a lot of code.
1) create a separate method just to connect and disconnect from a database;
2) use the value entered and see if you can find a record in the table. If the record is there, then you should re-direct your jsp to a jspError, else goes to another form.
the code below give you some idea
if( sAction.equals("Add1") ) {
sITEM = request.getParameter("parameter1");
try {
itemmaster.connect();
itemmaster.viewitemmaster( sITEM );
rs = itemmaster.getRs();
if( rs.next() ) {
sURL = "additemmaster1.jsp";
else {
request.setAttribute( "asITEM", sITEM );
sURL = "additemmaster2.jsp";
finally {
rs.close();
itemmaster.disconnect();
} -
Pass a Java Bean into Javascript function.
Good day. Please help urgent :
I am trying to pass an instance of MyBean class into a javascript function
This code is added to the form.
private String getJavaScriptForLaunchNewComponent()
StringBuffer sb = new StringBuffer();
sb.append("<SCRIPT language='JavaScript'>");
sb.append(" function testFunction(zBean) { ");
sb.append("popAssetWinSpecs = \"left=250,top=250,width=300,height=300,scrollbars=no,toolbar=no,menubar=no,resizable=no,status=no,titlebar=no,location=no\";");
sb.append("htmlfile=\"/irj/servlet/prt/portal/prtroot/com.roche.mss.pdf.comp.PDFLauncher?zBean=\"+zBean;");
sb.append("window.open(htmlfile,\"editWindow\",popAssetWinSpecs);");
sb.append("return false;");
sb.append(" }");
sb.append("</SCRIPT>");
return sb.toString();
This code is set in the create component meth
private Component buildLink(){
GridLayout grid = new GridLayout(1,1);
grid.setCellSpacing(5);
TestBean zBean = new TestBean();
zBean.setValue("Me Now");
Link link = new Link("myLink");
link.addText("Print PDF");
link.setOnClientClick("testFunction("+zBean +")");
grid.addComponent(1,1,link);
return grid;
Is this possible ????
Thanks.solved it. Thanks
-
Passing JSP into JavaScript function
I have a database table containing a date for the end of an auction, I am able to successfully take the date from the database but I am having problems passing it and casting it to a date object within a javascript function. The purpose of the function is to begin a countdown to the passed in date. Any suggestions? The countdown function i have only works with a hard coded date object.
<SCRIPT LANGUAGE="JavaScript1.2">
mDate = new Date("October 18 2004")
function countdown(){
var now=new Date()
var diff=mDate.getTime()-now.getTime()
document.bid.days.value = Math.round(diff/(24*60*60*1000))
document.bid.hours.value = Math.round(diff/(60*60*1000))
document.bid.minutes.value = Math.round(diff/(60*1000))
document.bid.seconds.value = Math.round(diff/1000)
document.bid.mseconds.value = diff
var id=setTimeout("millenium()",1)
</SCRIPT>
<body onLoad="countdown()">
<form name="bid" method="post" action="">
<p>Timeleft</p>
<TABLE BORDER=0>
<TD width="79">Days: </TD>
<TD width="81">
<INPUT TYPE="text" NAME="days" SIZE=15></TD> <TR>
<TD width="79">Hours: </TD>
<TD width="81">
<INPUT TYPE="text" NAME="hours" SIZE=15></TD> <TR>
<TD width="79">Minutes:</TD>
<TD width="81">
<INPUT TYPE="text" NAME="minutes" SIZE=15></TD> <TR>
<TD width="79">Seconds: </TD>
<TD width="81">
<INPUT TYPE="text" NAME="seconds" SIZE=15></TD> <TR>
<TD width="79">Milliseconds:</TD>
<TD width="81">
<INPUT TYPE="text" NAME="mseconds" SIZE=15></TD> <TR>
</TABLE>
</form>
I wish to pass it as follows:
<body onLoad="countdown(<%rsProduct.get........%>)"> and then cast within the function
.............................................................................JSP.....................................................................................................
<% Connection dbConn = null;
try
Class.forName("com.sybase.jdbc2.jdbc.SybDriver");
dbConn = DriverManager.getConnection("jdbc:sybase:Tds:compserver:5000/syb3044","syb3044", "syb3044");
Statement select = dbConn.createStatement();
int ID = Integer.parseInt(request.getParameter("carId"));
ResultSet rsProduct = select.executeQuery("SELECT * FROM car WHERE carID =" + ID);
if(rsProduct.next()){}
<%
rsProduct.close();
catch (SQLException sqle)
out.println(sqle.getMessage());
catch (ClassNotFoundException cnfe)
out.println(cnfe.getMessage());
catch (Exception e)
out.println(e.getMessage());
finally
try
if(dbConn != null)
dbConn.close();
catch (SQLException sqle)
out.println(sqle.getMessage());
}%>
PLEASE NOTE THAT I AM A SECOND YEAR COMPUTER SCIENCE STUDY!
sorry if code is messy to read.
RegardsLooks like everyone's having a countdown problem.....
The script in this thread is awefully like in this one:http://forum.java.sun.com/thread.jsp?forum=45&thread=514095&tstart=0&trange=15
Anyway, there're what you can do. Write out the Date object in JSP as a Javascript Date, two ways to achieve that:
1, mydate.getTimeStamp() is should return a long value, time in millisec, so
var mDate = new Date(<%= myDate.getTimeStamp()%>);
2. a lil messy, use DateFormatter to format the sql.Date, this gives you a Date in Strint form. Do remember the exact API for the DataFormater, but something like this.
var mDate = new Date("<%= DateFormatter.format(myDate) %>");
I'd prefer the 1st approach, why changing a Date to String then just change to Date again....Also watch out the TimeZone stuff and Daylight saving time....have fun. -
Putting resultset Data into sql server 2000
hello,
I have some trouble with putting my Date into the sql server. I'm very confused about this and gives me a lot of headage!
This is my code:
public void GenerateAlarms(StringBuffer alarmsLeft) throws Exception
try
statement = conn.createStatement();
rsGenerate = statement.executeQuery("SELECT event_it, oplcl_id, host_id, app_id, sev_id, alarm_id,desc_id, prodef_id, alert_id, date_time FROM ScenarioFive");
int saveCheck;
sqlInsert.setInt(1, 1);
sqlInsert.setDate(2, rsGenerate.getDate(10));
sqlInsert.setInt(3, 1);
sqlInsert.setInt(4, 1);
sqlInsert.setInt(5, 2);
sqlInsert.setInt(6, 0);
sqlInsert.setInt(7, 2);
sqlInsert.setInt(8, 1);
sqlInsert.setInt(9, 2);
sqlInsert.setInt(10, 4);
saveCheck = sqlInsert.executeUpdate();
if (saveCheck == 0)
conn.rollback();
System.out.println("Alarms not Updated in new Database");
else
conn.commit();
rs.deleteRow();
catch (Exception e)
System.err.println("Got an exception! ");
System.err.println(e.getMessage());
System.out.println("Foult at insert alarms");
The error is Got an exception!
[Microsoft][ODBC Driver Manager] Invalid cursor state
OF course i have a Connection function to the database, I will give this just in case (this one is oke I think)
public void connection()throws Exception
String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
String url = "jdbc:odbc:MSSQL-Storm1";
String username = "sqldemo";
String password = "sqldemo";
Class.forName(driver);
//Establish the conCection to the database.
conn = DriverManager.getConnection(url, password, username);
System.out.println("We are got Connected to STORM: Sql Server Port:1433");
statement = conn.createStatement();
conn.setAutoCommit(false);
Thanks a lot!!Not a concern for an Oracle forum.
Als no need for SHOUTING.
Conventional solutions are
- dump the data to a csv file and load it in Mickeysoft SQL server
- use Oracle Heterogeneous services
- use Mickeysoft DTS
Whatever you prefer.
Sybrand Bakker
Senior Oracle DBA -
Putting ResultSet data into select boxes
I am running a query, and returning the data to a JSP which in turn, places the query data into 3 different select boxes. Each of these three select boxes will contain a different number of values. The query is as follows:
partQuestionList="SELECT DISTINCT carMake, carModel, partTypeName FROM PARTTYPE, CARSPARTAVAIL";
Hence, I have three select boxes to display the three types of data. I assume I will need to use a loop of some kind. What is the best way to accomplish this without having code all over the place? Also, what is the best way to make these distinct? Thanks.By the way..here is the code I have so far...
while(rs.next()){
carMake.add(rs.getString("carMake"));
carModel.add(rs.getString("carModel"));
//carYear.add(rs.getInt("carYear"));
partTypeName.add(rs.getString("partTypeName"));
<SELECT name="Model">
<% for (int x = 0; x<carModel.size(); x++) { %>
<OPTION><%=carModel.get(x) %></OPTION>
<% } %>
</SELECT>
Which will obviously work, but doesnt get rid of the duplicates.. -
Moving sum using date intervals - analytic functions help
let's say you have the following set of data:
DATE SALES
09/02/2012 100
09/02/2012 50
09/02/2012 10
09/02/2012 1000
09/02/2012 20
12/02/2012 1000
12/02/2012 1100
14/02/2012 1000
14/02/2012 100
15/02/2012 112500
15/02/2012 13500
15/02/2012 45000
15/02/2012 1500
19/02/2012 1500
20/02/2012 400
23/02/2012 2000
27/02/2012 4320
27/02/2012 300000
01/03/2012 100
04/03/2012 17280
06/03/2012 100
06/03/2012 100
06/03/2012 4320
08/03/2012 100
13/03/2012 1000
for each day i need to know the sum of the sales in the present and preceding 5 days (calendar) [not five rows].
What qurey could i use???
Please help!Hi.
Here's one way.
WITH data AS
SELECT TO_DATE('09/02/2012','DD/MM/YYYY') d, 100 n FROM DUAL UNION ALL
SELECT TO_DATE('09/02/2012','DD/MM/YYYY') d, 50 n FROM DUAL UNION ALL
SELECT TO_DATE('09/02/2012','DD/MM/YYYY') d, 10 n FROM DUAL UNION ALL
SELECT TO_DATE('09/02/2012','DD/MM/YYYY') d, 1000 n FROM DUAL UNION ALL
SELECT TO_DATE('09/02/2012','DD/MM/YYYY') d, 20 n FROM DUAL UNION ALL
SELECT TO_DATE('12/02/2012','DD/MM/YYYY') d, 1000 n FROM DUAL UNION ALL
SELECT TO_DATE('12/02/2012','DD/MM/YYYY') d, 1100 n FROM DUAL UNION ALL
SELECT TO_DATE('14/02/2012','DD/MM/YYYY') d, 1000 n FROM DUAL UNION ALL
SELECT TO_DATE('14/02/2012','DD/MM/YYYY') d, 100 n FROM DUAL UNION ALL
SELECT TO_DATE('15/02/2012','DD/MM/YYYY') d, 112500 n FROM DUAL UNION ALL
SELECT TO_DATE('15/02/2012','DD/MM/YYYY') d, 13500 n FROM DUAL UNION ALL
SELECT TO_DATE('15/02/2012','DD/MM/YYYY') d, 45000 n FROM DUAL UNION ALL
SELECT TO_DATE('15/02/2012','DD/MM/YYYY') d, 1500 n FROM DUAL UNION ALL
SELECT TO_DATE('19/02/2012','DD/MM/YYYY') d, 1500 n FROM DUAL UNION ALL
SELECT TO_DATE('20/02/2012','DD/MM/YYYY') d, 400 n FROM DUAL UNION ALL
SELECT TO_DATE('23/02/2012','DD/MM/YYYY') d, 2000 n FROM DUAL UNION ALL
SELECT TO_DATE('27/02/2012','DD/MM/YYYY') d, 4320 n FROM DUAL UNION ALL
SELECT TO_DATE('27/02/2012','DD/MM/YYYY') d, 300000 n FROM DUAL UNION ALL
SELECT TO_DATE('01/03/2012','DD/MM/YYYY') d, 100 n FROM DUAL UNION ALL
SELECT TO_DATE('04/03/2012','DD/MM/YYYY') d, 17280 n FROM DUAL UNION ALL
SELECT TO_DATE('06/03/2012','DD/MM/YYYY') d, 100 n FROM DUAL UNION ALL
SELECT TO_DATE('06/03/2012','DD/MM/YYYY') d, 100 n FROM DUAL UNION ALL
SELECT TO_DATE('06/03/2012','DD/MM/YYYY') d, 4320 n FROM DUAL UNION ALL
SELECT TO_DATE('08/03/2012','DD/MM/YYYY') d, 100 n FROM DUAL UNION ALL
SELECT TO_DATE('13/03/2012','DD/MM/YYYY') d, 1000 n FROM DUAL
days AS
SELECT TO_DATE('2012-02-01','YYYY-MM-DD')+(LEVEL-1) d
FROM DUAL
CONNECT BY LEVEL <= 60
totals_per_day AS
SELECT dy.d,SUM(NVL(dt.n,0)) total_day
FROM
data dt,
days dy
WHERE
dy.d = dt.d(+)
GROUP BY dy.d
ORDER BY 1
SELECT
d,
SUM(total_day) OVER
ORDER BY d
RANGE BETWEEN 5 PRECEDING AND CURRENT ROW
) AS five_day_total
FROM totals_per_day;
2012-02-01 00:00:00 0
2012-02-02 00:00:00 0
2012-02-03 00:00:00 0
2012-02-04 00:00:00 0
2012-02-05 00:00:00 0
2012-02-06 00:00:00 0
2012-02-07 00:00:00 0
2012-02-08 00:00:00 0
2012-02-09 00:00:00 1180
2012-02-10 00:00:00 1180
2012-02-11 00:00:00 1180
2012-02-12 00:00:00 3280
2012-02-13 00:00:00 3280
2012-02-14 00:00:00 4380
2012-02-15 00:00:00 175700
2012-02-16 00:00:00 175700
2012-02-17 00:00:00 175700
2012-02-18 00:00:00 173600
2012-02-19 00:00:00 175100
2012-02-20 00:00:00 174400
2012-02-21 00:00:00 1900
2012-02-22 00:00:00 1900
2012-02-23 00:00:00 3900
2012-02-24 00:00:00 3900
2012-02-25 00:00:00 2400
2012-02-26 00:00:00 2000
2012-02-27 00:00:00 306320
2012-02-28 00:00:00 306320
2012-02-29 00:00:00 304320
2012-03-01 00:00:00 304420
2012-03-02 00:00:00 304420
2012-03-03 00:00:00 304420
2012-03-04 00:00:00 17380
2012-03-05 00:00:00 17380
2012-03-06 00:00:00 21900
2012-03-07 00:00:00 21800
2012-03-08 00:00:00 21900
2012-03-09 00:00:00 21900
2012-03-10 00:00:00 4620
2012-03-11 00:00:00 4620
2012-03-12 00:00:00 100
2012-03-13 00:00:00 1100
2012-03-14 00:00:00 1000
2012-03-15 00:00:00 1000
2012-03-16 00:00:00 1000
2012-03-17 00:00:00 1000
2012-03-18 00:00:00 1000
2012-03-19 00:00:00 0
2012-03-20 00:00:00 0
2012-03-21 00:00:00 0
2012-03-22 00:00:00 0
2012-03-23 00:00:00 0
2012-03-24 00:00:00 0
2012-03-25 00:00:00 0
2012-03-26 00:00:00 0
2012-03-27 00:00:00 0
2012-03-28 00:00:00 0
2012-03-29 00:00:00 0
2012-03-30 00:00:00 0
2012-03-31 00:00:00 0Hope this helps.
Regards. -
How to get value stored in javascript function and display in a JSP
i am doing a questionaire which is for user to input data in every question, After user input the data, a javascript function will be called to do some score calculation. Since each question will carry its final score after the calculation by the javascript function, so i use an array to store those scores and then display those scores in the same page.
However, i have to make a confirmation page to display both data and calculated score in another jsp, i only know how to display the data as it is a textfield that i can get the value by "request.getParameter("textfield1"); but i dun know how to get those scores as they are stored in an array in the javascript function, what way i can do??thank you for all your help!
I have chosen to set the score value to the hidden field when every time run the function
<script language="javascript">
function cal(index){
var thisForm = document.MC;
thisForm.score1.value=score[index];//set value to the hidden field
</script>
<input type="hidden" name="score1" value="">
<input type="hidden" name="score2" value="">
<input type="hidden" name="score3" value="">
The function will calculate only one score when every time being called. So that i can only assign one score to one hidden value at a time.
e.g, assign score[1] to thisForm.score1.value
assign score[2] to thisForm.score2.value
assign score[3] to thisForm.score3.value
how can i do this?? -
Ability to Import Spreadsheet Data into Table in Apps added Anytime Soon??
I love HTMLDB so much, and I thought I would never find anything it couldn't do, but I have run headlong into a problem that I've discovered many users have.
The Import Spreadsheet Data into Table functionality available in Data Workshop is such a treasure, and I was hoping with all of my heart that such functionality would be available for use inside the User Applications in HTMLDB 2.0. Alas, it is not so.
I know some brave folks have come up with work-arounds for this lack, and I applaud them. However, none of those will work for the situation I am faced with. I am about to strike out into the no-man's-land of trying to create my own PL/SQL csv file parsing function. Please wish me luck. Also, could you please tell me if this functionality is going to be included anytime soon?Well I looked at the FLOWS_020000.WWV_FLOW_LOAD_DATA.LOAD_CSV_DATA procedure
From what I can gather(considering nobody cant look at the actual procedural code):
P_FILE_ID seems to be file id you find in FLOWS_FILES.WWV_FLOW_FILE_OBJECTS$
P_CNAMES seems to be the column names of table you are loading into
P_UPLOAD seems to be the names of field from file you are loading
P_SCHEMA seems to be the schema that contains table where data will be loaded
P_TABLE seems to be table that you load data into
P_DATA_TYPE seems to be the datatypes from file to be loaded
P_DATA_FORMAT not sure
P_PARSED_DATA_FORMAT not sure
P_SEPARATOR seems to be the field seperator from file
P_ENCLOSED_BY seems to be what fields will be enclosed with
P_FIRST_ROW_IS_COL_NAME seems to be to tell whether or not first row contains column headings
P_LOAD_TO not sure
P_CURRENCY seems to be the currency symbol that comes from file
P_NUMERIC_CHARS not sure
P_CHARSET not sure
P_LOAD_ID not sure
Essentially you could run this process provided you get all the kinks worked out(that is what all the parameters mean/are expected)...
...or..
you write your own process:
- that reads the blob/clob content line by line
declare
n number;
buffer varchar2(4000);
begin
(do some sort of loop until end of length of lob)
n := dbms_lob.instr( "your lob", ',',"next comma position" );
if ( nvl(n,0) > 0 )
then
buffer := dbms_lob.read( p_lob, "amount of lob length to read", n);
end if;
end;
The above code with some tweaking will read the lob. However you still will have to add a piece that creates sql insert statement. One of the pitfalls I see with custom code is the fact that if you end up with huge lob string you will run into problem of creating sql insert statement. Not the actual statement but assigning the statement to a variable due to datatype lengths.
Hopefully this will help you more in the right direction! -
Hi gurus,
How do we get evtcreation_date and evtcreation_time data into check function module or implementation of object type? I am using cdhdr and cdpos and able to write my own logic.
Thanks in advance!!!
Xevi G.I think check FM's contain these value in any paramters.
Otherwise check CDHDR/CDPOS with appropriate OBJECT number etc.
This question can more appropriately answered in WORKFLOW forum.
Try [this|http://www.*******************/2007/09/work-flow-2.html] link also. -
To upload a data into SAP Table with the help of RFC function in BODS
Hi,
Please provide me step-by-step solution to upload data into any SAP table with the help of RFC function in Data Services.
I have created RFC function that upload data into SAP table. RFC Function contains one table that has same structure as my database table.
In the data services how can i filled the table of RFC function, i am using this function in query transform of data services but it gives me error.
I am also follow link http://wiki.sdn.sap.com/wiki/display/BOBJ/BusinessObjectsDataServicesTipsand+Tricks
but it did not help me.
Thanks,
AbhishekHi Abhishek,
Did you import the function module in the SAP datastore first? When you open the SAP datastore, the function should be listed in the 'functions' section. If not, import it. Make sure your function is remote executable.
Once the function is there, you can use it in a transformation. In 'Schema Out' right-click on 'Query' (top level) and choose 'New Function Call'. You can then select a datastore and a function in the datastore. The wizard will show you which output parameters are available. I believe you have to add at least one and can select as many as you like.
After confirming your selection the function and the output parameters appear in Schema Out. You can then right-click on the function and choose 'Modify function call'. A popup will appear where you can specify the input parameters.
I hope this helps.
Jan. -
How to put a jsp variable into a javascript function?
Please read the following coding. I want to pass the variable ans from jsp to the function check_answer() of javascript. ans is a string got from database. But I cannot put the variable ans into the Javascript function. Can anyone help?
<script language="Javascript">
function check_answer() {
if (testing.result.value==ans ){
window.alert("You have got 10 marks.");
</script>
<body>
<form name="testing"...>
<%
ResultSet rs = stmt.executeQuery("select * from level where...");
while(rs.next())
out.println("<tr>");
out.println("<td>" + rs.getString("question") + "</td>");
ans = rs.getString("answer");
out.println("</tr>");
out.println("<input type='text' name='result'>);
out.println("<input type='button' value='Enter' onclick='check_answer()'>");
%>The following should be able to pass ans.
<script language="Javascript">
function check_answer(ans) {
if (testing.result.value==ans ){
window.alert("You have got 10 marks.");
</script>
<body>
<form name="testing"...>
<%
ResultSet rs = stmt.executeQuery("select * from level where...");
while(rs.next())
out.println("<tr>");
out.println("<td>" + rs.getString("question") + "</td>");
ans = rs.getString("answer");
out.println("</tr>");
out.println("<input type='text' name='result'>);
out.println("<input type='button' value='Enter' onclick='check_answer('<%= ans%>')'>");
%>jag -
Help needed in calling a javascript function from a jsp
Hey guys,
I need help.
In my jsp I have a field called date. When i get date field from the database, it is a concatination of date and time field, so I wrote a small javascript function to strip just the date part from this date and time value.
The javascript function is
function formatDate(fieldName)
var timer=fieldName;
timer = timer.substring(5,7)+"/"+timer.substring(8,10)+"/"+timer.substring(0,4);
return timer;
Now I want to call this javascript function from the input tag in jsp where I am displaying the value of date. Check below
This is one way I tried to do:
<input size="13" name="startDate" maxLength="255" value=<script>formatDate("<%=startDate%>")</script> onChange="checkDate(this)">
I even tried this:
<input size="13" name="startDate" maxLength="255" value="'formatDate(<%=startDate%>)'" onChange="checkDate(this)">
But it dosen't work
Please help. I am struggling on this for days.
Thanks,
RubyHey all you developers out there , Pleaseeee help me with this one.
-
Javascript Question - How to Insert a Dynamic/Current Date into the Footer of a Scanned Document
Hi!
I am looking for help in finding a Javascript that would allow the insertion of a dynamic/current date into the footer of a scanned document at the time the document is printed.
I am currently using Adobe Acrobat Professional 8.0 at my work and there has arisen a need to have a dynamic/current date in the footer on scanned documents when they are printed out on different days by different people.
I am new to the Forum and I am also very new to Javascript and what this entails.
Thank you in advance for your help and input!
Tracythis.addWatermarkFromText({
cText: util.printd("mmmm dd, yyyy", new Date()),
nTextAlign: app.constants.align.right,
nHorizAlign: app.constants.align.right,
nVertAlign: app.constants.align.bottom,
nHorizValue: -72, nVertValue: 72
Will insert the current Monday/Day/Year as a text watermark at the bottom of every page of a document, 1 inch up and 1 inch in from the right corner.
Maybe you are looking for
-
User is receiving error when creating receipts in iProcurement
User is getting following error when trying to create a receipt in iProcurement Error: Receipts cannot be created for the selected items because of one of the following reasons. The transaction could not be completed successfully. Please contact syst
-
Error: "Audio configuration contains unknown items"
After a few sessions I did on a song I get this error message. The song continues to work. But from time to time this error appears. What does it mean? And how can I eliminate it?
-
I am trying to get audio to play through from the audio input to the audio output. I have plugged a line-level keyboard into the audio input and as I play it, it shows that it has plenty of input level in the sound panel of the system preferences. Ho
-
Scan to email server connection error for HP Envy 5530
Hi, Everyone! I LOVE my printer. But, I had to add another laptop (both WIndows) - and then had to add a couple of monitors to that laptop (and a docking statiion) and now it doesn't want to scan to my emails any longer after working like gangbuster
-
Same issue here with Windows 7. I waited a couple of months hoping that there will be a fix down the road with the latest version. I miss the old days when everything was working fine with Adobe products. When It's not reinstalling Adobe Acrobat, it'