JAVA SERVER PAGES

hi,can u tell mehow to check the duplicate values in jsp?
[78 byte] By [sudhinaa] at [2007-10-3 0:54:03]
# 1
duplicate values in what exactly? Your question is far to open ended for anyone to answer.
gimbal2a at 2007-7-14 17:49:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
duplicate values on the elements?
jgalacambraa at 2007-7-14 17:49:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

if i enter the useriid and submit means

it has to check for the duplicate values and give alert message

that the userid already exists

function setValues(userid,username,proj,password,userrole,userlocation,userstatus)

{

var opt =document.frm_panel.reqcmd.value;

userid = userid.replace('<span style=background-color:#FFFF00>','');

userid = userid.replace('</span>','');

document.frm_panel.txt_user_id.value = userid;

document.frm_panel.txt_user_name.value = username;

document.frm_panel.txt_project.value = proj;

document.frm_panel.txt_password.value = password;

document.frm_panel.txt_user_role.value = userrole;

document.frm_panel.cmb_action.value = userlocation;

document.frm_panel.cmb_act.value = userstatus;

}

only for txt_user_id

Message was edited by:

sudhina

sudhinaa at 2007-7-14 17:49:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
will it check from the database?
jgalacambraa at 2007-7-14 17:49:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
still u hav't said where are the values to check for duplicates....
saravanan.chennaia at 2007-7-14 17:49:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
yesbut i want it to check in the user form with an alert message
sudhinaa at 2007-7-14 17:49:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7
tat can be done using AJAX...:)
saravanan.chennaia at 2007-7-14 17:49:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8
you have to submit the page or use ajax to check it from the db
jgalacambraa at 2007-7-14 17:49:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 9
sorry..........when i enter the user id in the text boxand when i start to enter the value in the next text boxthe first text box must throw that the user id already exists
sudhinaa at 2007-7-14 17:49:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 10
where are the two textboxes located? on the same page? or different page?
jgalacambraa at 2007-7-14 17:49:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 11
yep.. u can call to server on lostfocus of tat textbox...and get ur err to be displayed... but tat's wil take some time it would be better if u show in some lable field near tat textbox...
saravanan.chennaia at 2007-7-14 17:49:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 12
same pageMessage was edited by: sudhina
sudhinaa at 2007-7-14 17:49:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 13
if(document.frm_panel.userid1.value==document.frm_panel.userid1.value){alert("Userid's must not be the same");}
jgalacambraa at 2007-7-14 17:49:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 14
thanx jhe.......i got it...
sudhinaa at 2007-7-14 17:49:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 15

> if(document.frm_panel.userid1.value==document.fr

> m_panel.userid1.value){

> alert("Userid's must not be the same");

> }

can u tell me

how to give an alert message for delete

sudhinaa at 2007-7-21 9:19:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 16
a confirm message?
jgalacambraa at 2007-7-21 9:19:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 17
yes..........
sudhinaa at 2007-7-21 9:19:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 18

function setDelete(){

if(confirm("Are you sure you want to delete this file?")){

//do something

//of course delete something

}else{

//do nothing

}

}

jgalacambraa at 2007-7-21 9:19:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 19
this function i have to include it in <input type="submit" name="cmd" value=" OK ">right like <onSubmit ="return setDelete();">
sudhinaa at 2007-7-21 9:19:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 20

then it would be:

function setDelete(){

if(confirm("Are you sure you want to delete this file?")){

//do something

//of course delete something

return true;

}else{

//do nothing

return false;

}

}

jgalacambraa at 2007-7-21 9:19:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 21

how to get the value from the search panel and

when i click radio button(ie in project_search.jsp")

it should return the value to txt_project

<input class="txt" type="text" name="txt_project" maxlength="30" readonly=yes> <input type="button" name="cmd_search" value="..." onClick="javascript:window.open('project_search.jsp?cmd=view&reqcmd=view&txt_project=' + document.frm_panel.txt_project.value, 'myWindow','toolbars=no,scrollbars=yes,menubar=no,height=400,width=500,left=275,top=50,readonly=yes' )">

but the error here is

its taking value to other text box and other as undefined.

how to get the value to the text box ("txt_project")

sudhinaa at 2007-7-21 9:19:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 22
the text box in the popupwindow doesn't get any value?
jgalacambraa at 2007-7-21 9:19:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 23

i gave like this

but it is not working

<script language="JavaScript">

function setDelete(){

if(confirm("Are you sure you want to delete this file?"))

{

return true;

}else{

return false;

}

}

</script>

<input type="submit" name="cmd" value=" OK " onSubmit = "return setDelete();">

Message was edited by:

sudhina

sudhinaa at 2007-7-21 9:19:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 24
what is your output?
jgalacambraa at 2007-7-21 9:19:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 25
the records are deleted without giving alert message
sudhinaa at 2007-7-21 9:19:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 26
> what is your output?ya got the o/p
sudhinaa at 2007-7-21 9:19:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 27
ok hope that helps..(',')
jgalacambraa at 2007-7-21 9:19:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 28
hi jhe,could u plz tell mehow to generate a report (crystal report ) using jsp?thanx.....
sudhinaa at 2007-7-21 9:19:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 29
hello sujatha.. sorry but haven't tried a generating report through jsp.. i only know through java.. elexir reports
jgalacambraa at 2007-7-21 9:19:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 30
hi jhe,tell me abt the elexir reports.........if i do that reports in javacan i give a link ( ie <a href>) from my jsp page to that java
sudhinaa at 2007-7-21 9:19:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 31
elixir reports is gui based.. cannot be implimented in jsp.. it can only be rendered through html and its not free..
jgalacambraa at 2007-7-21 9:19:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 32
can u tell me any other reports?
sudhinaa at 2007-7-21 9:19:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 33
sorry have tried any report yet....
jgalacambraa at 2007-7-21 9:19:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 34
can u explain mehow to add the jar file of elixir report
sudhinaa at 2007-7-21 9:19:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 35
it uses a different engine for generating report.. i think its jetty..so you cannot just add the jar files
jgalacambraa at 2007-7-21 9:19:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 36
http://www.elixirtech.com/
jgalacambraa at 2007-7-21 9:19:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 37
how to use prepared statement in javaand how to use it in jsp
sudhinaa at 2007-7-21 9:19:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 38

can be inserted into jsp as scriptlets

RegisterBean rb = (RegisterBean)form;

try

{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();

Connection conn = DriverManager.getConnection("jdbc:odbc:SampleDB","","");

PreparedStatement pstmt = conn.prepareStatement("insert into logintable values(?,?,?,?,?,?,?,?,?,?,?)");

pstmt.setString(1,rb.getUsername());

pstmt.setString(2,rb.getPassword());

pstmt.setString(3,rb.getLastname());

pstmt.setString(4,rb.getFirstname());

pstmt.setString(5,rb.getMiddlename()!=null?rb.getMiddlename():" ");

pstmt.setString(6,rb.getAddress()!=null?rb.getAddress():" ");

pstmt.setString(7,rb.getPhone()!=null?rb.getPhone():" ");

pstmt.setString(8,rb.getEmail());

pstmt.setString(9,rb.getGender());

pstmt.setString(10,rb.getCivilstatus());

pstmt.setString(11,"3");

insert = pstmt.executeUpdate();

conn.commit();

conn.close();

} catch (Exception ex)

{

ex.printStackTrace();

}

jgalacambraa at 2007-7-21 9:19:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 39

hi jhe,

ca u tell me

y this error is coming

EXCEPTION WHILE WORKING WITH SQL "java.lang.IllegalArgumentException"

i declared like this

public Vector getResultsoftrack(String fileName,int upfileid,int downfileid)

sudhinaa at 2007-7-21 9:19:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 40

see ,this problem can be solved very simply.

do as follow.

when u enter the value,before the cursor move to next field,we have to check the values.

For doing this,

code is:

<input type="text" name="userid" onBlur=checkUserId()>

see function:

checkUserId()

{

<%//here u get connection.

u write the query as follow

ResultSet rs=st.executeQuery("select * from tablename where userid='textfieldvalue';

so that u can test

if(rs.next())

//means alreday exists

else

//not exist.

}

I think u can understood cleary because i had given just a template

Cheers

Sudha.

9819542886.

sudha_1234a at 2007-7-21 9:19:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 41

hello sujatha,

if you use the codes that i gave you, then you must consider setting values for your database like if the data type is varchar2 then you will use preparedstatement.setString() , if number you can use preparedstatement.setInt(), preparedstatement.setFloat() or preparedstatement.setDouble() and others like preparedstatement.setDate();

jgalacambraa at 2007-7-21 9:19:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 42

hi jhe,

how to count a button click?

for example:

<td class="results_col" bgcolor="#F3F3E9"><input type="submit" name="myBox" value="Enable" onClick = "return confirm('Want to Enable?')"></td>

<%

String[] checkboxvalue = request.getParameterValues("myBox");

if(checkboxvalue != null)

{

fileName = rec.getfileName();

String downstatus = "";

batchb.modifydownstatusof(fileName,downstatus.toUpperCase().trim());

}

}

else

{ %>

<td class="results_col" bgcolor="#F3F3E9"> -- </td>

<% }

if i click the button

i should hava a count that how many times i clicked

sudhinaa at 2007-7-21 9:19:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 43

<%@ page contentType="text/html;charset=windows-1252"%>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<title>untitled</title>

<script language="javascript">

var x = 0;

function setButtonClick(){

x++;

alert("time clicked: "+x);

}

</script>

</head>

<body>

<form>

<input type="BUTTON" name="button" value="click me" onclick="setButtonClick()"/>

</form>

</body>

</html>

jgalacambraa at 2007-7-21 9:19:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 44
hi jhe,can u tell how to upload a file to the server and download from it using jsp...?the file should not save in a folder in the same machineit has to b store in the serverhow to do that?plzzzz help methanx jhe.......
sudhinaa at 2007-7-21 9:19:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 45
hello sujatha, is your file server and web server different machines?
jgalacambraa at 2007-7-21 9:20:03 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 46
if am uploading a file meansit has to store in the server not in the local machine,in which am workingMessage was edited by: sudhina
sudhinaa at 2007-7-21 9:20:03 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 47
yes i think you've done it already?.. right?.. when you used javazoom?
jgalacambraa at 2007-7-21 9:20:03 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 48
no......i have done it by saving the files in a temporary folder in my local machine only ,not in the server
sudhinaa at 2007-7-21 9:20:03 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 49

when you deploy the application server it should be placed on the server.. now if you are testing it on your jdeveloper on your local machine then you should map a drive on the server in order for you to save the files to the folder on the server.. and also change the path of the files from which it is save to you local machine to the path of your network drive

jgalacambraa at 2007-7-21 9:20:03 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 50
ok jhe
sudhinaa at 2007-7-21 9:20:03 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 51
hope it works for your environment
jgalacambraa at 2007-7-21 9:20:03 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 52
hi jhe, am in confusion plz help meif am uploading a file from one system it has save at one location meanswhen the other user who has to work on the file can download it from other machine?could it b done in jsp(like in yahoo) ?if so how to do that?
sudhinaa at 2007-7-21 9:20:03 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 53
You should provide your piece of code and let other sort out what problem you have got form your code. If you don't know how start your project, please search Java site and find the tutorial, study by yourself. It is the best way for you.
rcd27a at 2007-7-21 9:20:03 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 54
i think its possible if the your web server has mapped the drive4s to other machines
jgalacambraa at 2007-7-21 9:20:03 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 55
hi jhe,is it possible to delete the temporary Internet file folder from the local system using jsp?
sudhinaa at 2007-7-21 9:20:03 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 56
i have no idea it cannot be done.. i think it is only applicable for cookies.. but search the net if it is possible
jgalacambraa at 2007-7-21 9:20:03 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 57
hi jhe,hw r u?how to view a file without downloading it in jsp?thankssujatha
sudhinaa at 2007-7-21 9:20:03 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 58
hi jhe.....could u plz tell me that we can give alert message in jsp?thanks,sujatha
sudhinaa at 2007-7-21 9:20:03 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 59
hello sudhina,alert in javascript?alert('sujatha')
jgalacambraa at 2007-7-21 9:20:03 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 60

hi jhe,

my tomcat is starting up with this exception,

SEVERE: Catalina.start:

LifecycleException: Protocol handler start failed: java.net.BindException: Addr

ess already in use: JVM_Bind:8080

at org.apache.coyote.tomcat5.CoyoteConnector.start(CoyoteConnector.java:

1529)

at org.apache.catalina.core.StandardService.start(StandardService.java:4

89)

at org.apache.catalina.core.StandardServer.start(StandardServer.java:231

3)

at org.apache.catalina.startup.Catalina.start(Catalina.java:556)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

sorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)

how to solve this,

thanks,

sujatha

sudhinaa at 2007-7-21 9:20:08 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 61
the port has been used by another application try to change the port of tomcat
jgalacambraa at 2007-7-21 9:20:08 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 62
plz tell me how to change the port of tomcat?
sudhinaa at 2007-7-21 9:20:08 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 63
go to the <tomcat install>\conf directory there you can see server.xml find the port 8080 and change it to 8081 ...
jgalacambraa at 2007-7-21 9:20:08 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 64
thanks jhe.......its working now
sudhinaa at 2007-7-21 9:20:08 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 65
no problem. (',') you have ym?
jgalacambraa at 2007-7-21 9:20:08 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 66
what is ym?
sudhinaa at 2007-7-21 9:20:08 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 67
yahoo messenger
jgalacambraa at 2007-7-21 9:20:08 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 68
no only gmail chat
sudhinaa at 2007-7-21 9:20:08 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 69
ok here's my email jgalacambra@gmail.com
jgalacambraa at 2007-7-21 9:20:08 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...