Urgent help on null values
hi
every body
i hope some body might have faced similar problem
i have a database retrival problem and i am getting the values in the last row of the table,
But the problem is if the value stored is "NULL" my program and application hangs
can any body tell me how to handle this
thanks in advance
Hi Anilkumar
if u r trying to retrieve from database then u must be using resultset to get the data. ResultSet has a method called wasNull() which returns boolean when the last column read had a value of SQL NULL. This shud solve your problem. If u get a null value dont process that column.
-vinucon
Similar Messages
-
Need help with NULL values in Crosstables
Hello everybody,
I need some help with NULL values and crosstables. My issue is the following:
I have a query (BW - MDX-Query) that gives me turnover measures for each month. In Crystal Reports I choose crosstable to display this whereby I put all month in columns and all turnover-measures in rows. Each month that has a value (measures are not empty) is chown in the crosstables rows. So far so good. The problem occures when there are month that actually have no values (measures are empty). In that case these months are not chown in columns. But I need CR to display these columns and show the value 0. How can I do that?Hi Frank,
Cross tab shows the data based on your column and these column fields are grouped and based on the group it will show your summaries.
If there is no data for any of your group it will not display that group. In this case you will have to create a standard report which should look like cross tab and to get zero values you need to write formulas .
Example if you want to display Moth wise sales :
if Month() = 01 Then
sum() else 0
Now this formula will check if your month is Jan, then it will sum up the values else it will display zero value.
This is possible only through standard report not with Cross Tab.
Thanks,
Sastry -
Need help on Null value check function
Hey guys,
I need to create a function that will accept two values and perform a comparison on them and based on whether or not they're different, return true or false.
Initially I had no idea about the problems of comparing when a value was null, hence the need for a function, as I need to compare many fields of rows of a table in order to find what has changed.
Now, I think I have the NULL check logic in place :
IF R1.X IS NULL THEN
IF R2.X IS NULL THEN
RETURN FALSE; -- both R1 and R2 are null so no diffs
ELSE
RETURN TRUE; -- R1 is null but R2 is not, so it's a diff
END IF;
ELSE
IF R2.X IS NULL THEN
RETURN TRUE; -- R1 is not null but R2 is so a diff
ELSE
IF R1.X != R2.X THEN
RETURN TRUE; -- both not null but different
ELSE
RETURN FALSE; -- both not null but equal
END IF;
END IF;
END IF;My problem is that I don't know how, or if i can, create function that can simply accept two column values without defining their datatypes in the function sig. Reason being that while I will always be comparing like-for-like datatypes, I won't always be comparing the "same" like-for-like datatypes; so as I loop through 100 table rows (differentiated by a date), I'll physically compare all the fields in the rows one by one, and in one instance i'm comapring two NUMBERs and then two VARCHARs and then two DATEs, etc.
What i didn't want was duplicate func's that are all the same apart from the sig's.
Is there an easy(ier) way to accomplish this? Is there a more "generic" value type I could use? basically i just want to have a function like :
CREATE OR REPLACE FUNCTION(val1 VALUE, val2 VALUE)
And not multiple like :
CREATE OR REPLACE FUNCTION(val1 NUMBER, val2 NUMBER)
CREATE OR REPLACE FUNCTION(val1 DATE, val2 DATE)
and so on.
Edited by: user11258962 on 28-Jun-2010 09:02You can use function overloading. So, although three function will exist, they will all be called the same name, so your code will always call a single function
create or replace package pkg_compare as
function is_Alike (p1 in number
,p2 in number) return boolean ;
function is_Alike (p1 in varchar2
,p2 in varchar2) return boolean;
function is_Alike (p1 in date
,p2 in date) return boolean;
end pkg_Compare;
create or replace package body pkg_compare as
function is_Alike (p1 in number
,p2 in number) return boolean as
begin
return ( nvl(p1,0) = nvl(p2,-1) );
end is_Alike;
function is_Alike (p1 in varchar2
,p2 in varchar2) return boolean as
begin
return ( nvl(p1,'X') = nvl(p2,'Z') );
end is_Alike;
function is_Alike (p1 in date
,p2 in date) return boolean as
begin
return ( nvl(p1,sysdate) = nvl(p2,sysdate-1) );
end is_Alike;
end pkg_Compare;
/ -
How to check for null values in bpel?? Please Help! very urgent!!!
Hello Guys,
I have a problem. I have an external webservice to which I have to post my request. My task is to create an Webservice and Service Assembly to which others would post request and get response. I have to create SA to deploy onto the bus.
The problem is that there are optional elements in the request and response xsd's. In the Response sometimes certain feilds may come or they may not. for Example:- my response could contain a tag like this <firstName></firstName>
I have to copy these feilds in my bpel process from one variable to another.(like in the mapper).
My Question is , Is there any way in BPEL process or BPEL mapper where I could Check for null values in the request or response???
Your inputs would be very helpful.
Thanks
RajeshThanks for replying man :)
Ok I will be more clear.
Here is a snippet of one of the xsd's that I am using.
<xs:element name="returnUrl" nillable="false" minOccurs="0">
<xs:annotation>
<xs:documentation>Partner specifies the return URL to which responses need to be sent to, in case of
Async message model.
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:anyURI">
<xs:maxLength value="300"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
This means that the return URL field can be there or it may not be there. But if it is there it cant be null because nillable=false. But the whole <returnURL> </returnURL> can be there or it may not be there because minOccurs=0.
My requirement is , if returnURL is there in the response with a value, then in my BPEL mapper I should map it else I should not map it.
Thats the issue.
and Yes kiran, the node be non-existant.
So can you please help me with this.
Thanks
Rajesh -
Need help Take out the null values from the ResultSet and Create a XML file
hi,
I wrote something which connects to Database and gets the ResultSet. From that ResultSet I am creating
a XML file. IN my program these are the main two classes Frame1 and ResultSetToXML. ResultSetToXML which
takes ResultSet & Boolean value in its constructor. I am passing the ResultSet and Boolean value
from Frame1 class. I am passing the boolean value to get the null values from the ResultSet and then add those
null values to XML File. When i run the program it works alright and adds the null and not null values to
the file. But when i pass the boolean value to take out the null values it would not take it out and adds
the null and not null values.
Please look at the code i am posing. I am showing step by step where its not adding the null values.
Any help is always appreciated.
Thanks in advance.
============================================================================
Frame1 Class
============
public class Frame1 extends JFrame{
private JPanel contentPane;
private XQuery xQuery1 = new XQuery();
private XYLayout xYLayout1 = new XYLayout();
public Document doc;
private JButton jButton2 = new JButton();
private Connection con;
private Statement stmt;
private ResultSetToXML rstx;
//Construct the frame
public Frame1() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
catch(Exception e) {
e.printStackTrace();
//Component initialization
private void jbInit() throws Exception {
//setIconImage(Toolkit.getDefaultToolkit().createImage(Frame1.class.getResource("[Your Icon]")));
contentPane = (JPanel) this.getContentPane();
xQuery1.setSql("");
xQuery1.setUrl("jdbc:odbc:SCANODBC");
xQuery1.setUserName("SYSDBA");
xQuery1.setPassword("masterkey");
xQuery1.setDriver("sun.jdbc.odbc.JdbcOdbcDriver");
contentPane.setLayout(xYLayout1);
this.setSize(new Dimension(400, 300));
this.setTitle("Frame Title");
xQuery1.setSql("Select * from Pinfo where pid=2 or pid=4");
jButton2.setText("Get XML from DB");
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
catch(java.lang.ClassNotFoundException ex) {
System.err.print("ClassNotFoundException: ");
System.err.println(ex.getMessage());
try {
con = DriverManager.getConnection("jdbc:odbc:SCANODBC","SYSDBA", "masterkey");
stmt = con.createStatement();
catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
jButton2_actionPerformed(e);
contentPane.add(jButton2, new XYConstraints(126, 113, -1, -1));
//Overridden so we can exit when window is closed
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
void jButton2_actionPerformed(ActionEvent e) {
try{
OutputStream out;
XMLOutputter outputter;
Element root;
org.jdom.Document doc;
root = new Element("PINFO");
String query = "SELECT * FROM PINFO WHERE PID=2 OR PID=4";
ResultSet rs = stmt.executeQuery(query);
/*===========This is where i am passing the ResultSet and boolean=======
===========value to either add the null or not null values in the file======*/
rstx = new ResultSetToXML(rs,true);
} //end of try
catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
======================================================================================
ResultSetToXML class
====================
public class ResultSetToXML {
private OutputStream out;
private Element root;
private XMLOutputter outputter;
private Document doc;
// Constructor
public ResultSetToXML(ResultSet rs, boolean checkifnull){
try{
String tagname="";
String tagvalue="";
root = new Element("pinfo");
while (rs.next()){
Element users = new Element("Record");
for(int i=1;i<=rs.getMetaData().getColumnCount(); ++i){
tagname= rs.getMetaData().getColumnName(i);
tagvalue=rs.getString(i);
System.out.println(tagname);
System.out.println(tagvalue);
/*============if the boolean value is false it adds the null and not
null value to the file =====================*/
/*============else it checks if the value is null or the length is
less than 0 and does the else clause in the if(checkifnull)===*/
if(checkifnull){
if((tagvalue == null) || tagvalue.length() < 0 ){
users.addContent((new Element(tagname).setText(tagvalue)));
else{
users.addContent((new Element(tagname).setText(tagvalue)));
else{
users.addContent((new Element(tagname).setText(tagvalue)));
root.addContent(users);
out=new FileOutputStream("c:/XMLFile.xml");
doc = new Document(root);
outputter = new XMLOutputter();
outputter.output(doc,out);
catch(IOException ioe){
System.out.println(ioe);
catch(SQLException sqle){Can someone please help me with this problem
Thanks. -
HELP NEEDED !! Null values in Database
Hi there !!
I need help with EJB 3.0 passing null values to database. The situation looks like that :
I have created EJB entity class called "Osoba.java", it is in relation
with "Rola.java" (one to many). Each Object of class Osoba can have
many Roles. Then I created "OsobaServiceBean.java " I included it with
metod "CreateUnregisteredOsoba(Osoba , Boolean)". From "flex" level I
call this bean - call is accepted, and as a result new object of class Osoba is added to database. Problem is that only one column is filled in table,
dispite that in service bean I enforce it to fill all columns (see
source code - file OsobaServiceBean.java , method
createUnregisteredOsoba() )
I provided source code here :
FILE Rola.java
package test.granite.ejb3.entity ;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
@Entity
public class Rola extends AbstractEntity {
private static final long serialVersionUID = 1L;
@Basic
private String login = new String("");
@Basic
private String rola = new String("");
@Basic
private String roleGroup = new String("");
@Basic
private Boolean zatwierdzony = new Boolean(false);
@ManyToOne(optional=false)
private Osoba osoba;
public Boolean getZatwierdzony() {
return zatwierdzony;
public void setZatwierdzony(Boolean zatwierdzony) {
this.zatwierdzony = zatwierdzony;
public String getLogin() {
return login;
public void setLogin(String login) {
this.login = login;
public String getRola() {
return rola;
public void setRola(String rola) {
this.rola = rola;
public Osoba getOsoba() {
return osoba;
public void setOsoba(Osoba osoba) {
this.osoba = osoba;
public String getRoleGroup() {
return roleGroup;
public void setRoleGroup(String roleGroup) {
this.roleGroup = roleGroup;
FILE Osoba.java
package test.granite.ejb3.entity ;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
@Entity
public class Osoba extends AbstractEntity {
private static final long serialVersionUID = 1L;
@Basic
private String imie;
@Basic
private String nazwisko;
@Basic
private String login;
@Basic
private String haslo;
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER,
mappedBy="osoba")
private Set<Rola> role = new HashSet<Rola>();
@Basic
private String email;
@Basic
private String nrTelefonu;
@Basic
private int rokStudiow;
public String getPelneImie() {
StringBuilder sb = new StringBuilder();
if (imie != null && imie.length() > 0)
sb.append(imie);
if (nazwisko != null && nazwisko.length() > 0) {
if (sb.length() > 0)
sb.append(' ');
sb.append(nazwisko);
return sb.toString();
public String getImie() {
return imie;
public void setImie(String imie) {
this.imie = imie;
public String getNazwisko() {
return nazwisko;
public void setNazwisko(String nazwisko) {
this.nazwisko = nazwisko;
public String getLogin() {
return login;
public void setLogin(String login) {
this.login = login;
public String getHaslo() {
return haslo;
public void setHaslo(String haslo) {
this.haslo = haslo;
public Set<Rola> getRole() {
return role;
public void setRole(Set<Rola> role) {
this.role = role;
public String getEmail() {
return email;
public void setEmail(String email) {
this.email = email;
public String getNrTelefonu() {
return nrTelefonu;
public void setNrTelefonu(String nrTelefonu) {
this.nrTelefonu = nrTelefonu;
public int getRokStudiow() {
return rokStudiow;
public void setRokStudiow(int rokStudiow) {
this.rokStudiow = rokStudiow;
FILE OsobaServiceBean.java
package test.granite.ejb3.service;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.annotation.security.RolesAllowed;
import javax.ejb.Local;
import javax.ejb.Stateless;
import javax.persistence.Query;
import org.jboss.annotation.security.SecurityDomain ;
import test.granite.ejb3.entity.Osoba;
import test.granite.ejb3.entity.Rola;
@Stateless
@Local(OsobaService.class)
@SecurityDomain("other")
public class OsobaServiceBean extends AbstractEntityService implements
OsobaService{
private static final long serialVersionUID = 1L;
public OsobaServiceBean() {
super();
public List<Osoba> findAllOsoba() {
return findAll(Osoba.class);
@SuppressWarnings("unchecked")
public List<Osoba> findAllOsoba(String name) {
Query query = manager.createQuery (
"select distinct p from Osoba p " +
"where upper(p.imie) like upper('%" + name + "%')
or upper(p.nazwisko) like upper('%" + name + "%')"
return query.getResultList();
public Osoba createOsoba(Osoba person) { // pozwalamy
tworzyc zeby niezalogowany
return manager.merge (person); //
uzytkownik utworzyl osobe
} // ale
osoba ta i tak nie bedzie jeszcze
// zatwierdzona
@RolesAllowed({"unregistered"})
public Osoba createUnregisteredOsoba(Osoba person, boolean
zatwierdzony) {
Rola niezarejestrowany = new Rola();
niezarejestrowany.setRola("user");
niezarejestrowany.setOsoba(person);
niezarejestrowany.setRoleGroup("Roles");
niezarejestrowany.setLogin(person.getLogin());
niezarejestrowany.setZatwierdzony(zatwierdzony);
Set<Rola> role = new HashSet<Rola>();
role.add(niezarejestrowany);
// Arrays;
Object a[] = role.toArray();
Rola temp;
temp = (Rola)a[0];
System.out.println("Login = " + temp.getLogin() + //
added only for check !!
"Rola = " + temp.getLogin() +
"Zatwierdzony = " +
temp.getZatwierdzony() +
"Rolegroup = " + temp.getRoleGroup());
person.setRole (role);
return manager.merge(person); //
uzytkownik utworzyl osobe
} // ale
osoba ta i tak nie bedzie jeszcze
public Osoba modifyOsoba(Osoba person) {
return manager.merge(person);
@RolesAllowed({"admin"})
public void deleteOsoba(Osoba person) {
person = manager.find(Osoba.class, person.getId());
manager.remove(person);
public void deleteRola(Rola rola) {
rola = manager.find(Rola.class, rola.getId());
rola.getOsoba().getRole().remove(rola);
manager.remove(rola);
DATABASE LISTING :
-----------------------------------------------------------------+----------\
--------------------------------------------------------+
| id | ENTITY_UID | version | rola |
zatwierdzony | osoba_id | login | RoleGroup |
-----------------------------------------------------------------+----------\
--------------------------------------------------------+
| 1 | | NULL | unregistered |
| 0 | unregistered | Roles | NULL |
| 33 | eee91bd9-8c5f-4154-8260-3cac9a18eb97 | 0 | user |
| 34 | NULL | NULL |
| 32 | a7ed4e8d-a1ba-473a-921c-73c8f8f89efb | 0 | user |
| 33 | NULL | NULL |
-----------------------------------------------------------------+----------\
--------------------------------------------------------+
The row numer 1 is added by hand and it works. row number 33 and 32
are added to database by method CreateUnregisteredOsoba. As you can
see fields login as well as Roles and RoleGroup are empty (NULL). What
Im doing wrong ?
Thanks for your help -
Roman Kliś
PS. Table Osoba works fine - everything is added as I want.I solved problem.
The reason why EJB had not added anything to database NULL was becouse wrong names of class. Ive refactored whole class Rola.java to RolaClass.java and suddenly it worked.
True reason is still unknown but most importent is that it works.
Thanx for reading topic - hope next time someone will answer my questions.
By !! -
Null Values(Urgent Req)
Hi Guys,
I have a date column where I use Max(Date) function...
As per the req I have changed the Date format to MMM-dd-YYYY from mm-dd-yyyy...
Now I want to display "No Date" when ever the data value is null....
I tried writing a case statement by casting the max(date) to char...but it shows MMM-dd-YYY instead of "No Date"
Case when cast(max(date) as char) IS NULL then 'No Date' Else cast(max(date) as char) end;
Can some one please let me know how this can be resolved?
Thanks in advance...When you changed the format to CHAR in Criteria mode, a null value will display the format syntax since the column is now CHAR. So what you want now is a CASE statement that changes 'MMM-dd-YYYY' to 'No Date.'
Try writing the CASE statement like this:
CASE WHEN CAST(MAX(DATE) AS CHAR) IS 'MMM-dd-YYYY' THEN 'No Date' ELSE Max(Date) END
Tell me if this works. I'm at home and can't test it. -
Help: matrix report grid lines missing for null values only on server side
Hi,
I created a matrix report in pdf format. The output in great when run through report builder locally, it renders all necessary details. However, after the report being moved into AS server, the report does not show grid lines for null values.
It looks to me this has something to do with configurations and hope someone know what needs to be done.
Any suggestions are greatly appreciated.
JimmyThanks for replying.
DESFORMAT is PDF.
There should be a fix as I had same issue with same Oracle version at my previous company. DBA fixed the issue on AS server.
I found your post on 09/28/2010 with a link to patch set: Re: Null value fields disappear in pdf output format
We worked out with the work around without install the patch.
Jimmy
Edited by: WJHORA on Sep 8, 2011 2:16 PM -
To overcome column with null value-urgent
hai all,
when i query i get column with null value.
how to solve it?
thank in advance.
rcs
SQL> DESC SCOTT.CB1;
Name Null? Type
ID NUMBER
SUPCODE NUMBER
SUPLNAME VARCHAR2(100)
NAME VARCHAR2(100)
ITEMCODE VARCHAR2(10)
RECDOC NUMBER
RECDATE VARCHAR2(10)
TOTVALUE NUMBER
QTY NUMBER
CB_IPNO NUMBER
CB_VNNO NUMBER
CB_VDT VARCHAR2(10)
CB_AMT NUMBER
RECDOC_GR VARCHAR2(30)
RECDATE_GR DATE
SUPCODE_GR VARCHAR2(10)
TABLE LOOK LIKE THIS (NOT ALL DATA IN SAME ROW, BECUSE I INSERTED LAST 3 COLUMN VALUES):
ID SUPCODE SUPLNAME NAME ITEMCODE RECDOC RECDATE TOTVALUE QTY CB_IPNO CB_VNNO CB_VDT CB_AMT RECDOC_GR RECDATE_GR SUPCODE_GR
2015 AAAA 04117 9083 10545.6 78
2016 BBBB 04609 9087 25200 3600
2017 GGGG 04609 9088 28175 4025
2018 36591371.64 2565017.27
00001/07-08 02/04/2007 14020362
00002/07-08 02/04/2007 14020362
00003/07-08 02/04/2007 14010254
00004/07-08 02/04/2007 14010254
00005/07-08 02/04/2007 14021458
SQL> SELECT DISTINCT ID, SUPCODE_GR, NAME, ITEMCODE, RECDOC, RECDATE_GR, TOTVALUE, QTY FROM SCOTT.CB
1;
ID SUPCODE_GR
NAME
ITEMCODE RECDOC RECDATE_G TOTVALUE QTY
1
PRO.AT.ALU.POWDER UNCOATED
04609 15 51975 7425
2
PEN, GEL PEN
07969 17 154 11
ID SUPCODE_GR
I NEED RESULT AS FOLLOWS (ALL RESPECTIVE DDATA IN ONE LINE NOW NOT LIKE THAT):
ID SUPCODE SUPLNAME NAME ITEMCODE RECDOC RECDATE TOTVALUE QTY CB_IPNO CB_VNNO CB_VDT CB_AMT RECDOC_GR RECDATE_GR SUPCODE_GR
2015 AAAA 04117 9083 10545.6 78 00001/07-08 02/04/2007 14020362
============Even accounting for the formatting, I'm not sure I even understand the question. It could be any number of different problems or non-problems.
-
Urgent help needed... PL/SQL Insert statement
Hi...
I need some urgent help on this project. I have a 2 column table with values that need to be inserted into another existing table which has a sequence.
This is the 2 column table:
FUND YEAR
29587 05
29587 07
Existing table:
Name Null? Type
LIST_ID NOT NULL NUMBER(6) -- This is a sequence
WEB_USER_ID NOT NULL VARCHAR2(10)
RESOURCE_TYPE NOT NULL VARCHAR2(8)
LIST_TYPE NOT NULL VARCHAR2(10)
LIST_NAME NOT NULL VARCHAR2(50)
LIST_CODE_1 NOT NULL VARCHAR2(6) -- FUND from table above
LIST_CODE_2 NOT NULL VARCHAR2(6) -- YEAR from table above
LIST_CODE_3 NOT NULL VARCHAR2(6)
LAST_UPDATED_DT NOT NULL DATE
LAST_UPDATED_BY NOT NULL VARCHAR2(10)
LIST_CODE_4 NOT NULL VARCHAR2(20)
The columns from table 1 (FUND, YEAR) correspond to columns (LIST_CODE_1, LIST_CODE_2) in table 2. The column LIST_ID is a sequence. I can put in sysdate for LAST_UPDATED_DT and my initials SN for LAST_UPDATED_BY. This is going to be for 2 unique WEB_USER_IDs which would be in the WHERE clause. I will be inserting 2200 rows for each id. A single insert statement would look like this -
INSERT INTO EXISTING_TBL (list_id,web_user_id,resource_type,list_type,list_name,list_code_1,list_code_2,list_code_3,list_code_4,last_updated_dt,last_updated_by) VALUES ('470027','WEBUSER','GL','FUNDFYF',' FUND BALANCE SUM','12010','01',' ',' ',{ts '2010-5-19 10:16:9'},'SN')
How would I do this to insert the 2200 values from my 2 column table to the existing table?
All help is greatly appreciated!!
SNHello ,
I think this will work
INSERT INTO TABLE2
LIST_ID,
WEB_USER_ID,
RESOURCE_TYPE,
LIST_TYPE,
LIST_NAME,
LIST_CODE_1,
LIST_CODE_2,
LIST_CODE_3,
LIST_CODE_4,
LAST_UPDATED_DT,
LAST_UPDATED_BY
SELECT
SEQ.NEXTVAL,
FUND,
YEAR,
<VALUE FOR RESOURCE_TYPE>,
<VALUE FOR LIST_TYPE>,
<VALUE FOR LIST_NAME>,
<VALUE FOR LIST_CODE_1>,
<VALUE FOR LIST_CODE_2>,
<VALUE FOR LIST_CODE_3>,
<VALUE FOR LIST_CODE_4>,
SYSDATE,
'SN'
FROM
TABLE1
REGARDS
Rahul Sharma -
I am having problems implementing a username validaion bean for my login system. Every time I click my login icon on my main JSP page the login JSP page does not appear except one of the error JSP pages.
How can I correct this problem?
Does the code below look correct?
Below is the codes for the Username Validation Bean :
LOGIN.JSP
<%@ page import="java.io.*"%>
<%@ page import="java.util.*"%>
<%@ page import="java.sql.*"%>
<%@ page import="com.mysql.jdbc.*"%>
<%@ page errorPage="badLogin.jsp"%>
<%@ page import="gcd.UserNameValidationBean"%>
<%
Class.forName("com.mysql.jdbc.Driver");
java.sql.Connection connection=java.sql.DriverManager.getConnection("jdbc:mysql://localhost/gcdBB_db");
java.sql.Statement statement = connection.createStatement();
Enumeration parameters = request.getParameterNames();
if(parameters.hasMoreElements())
String usernameValue = request.getParameter("username");
String passwordValue = request.getParameter("password");
statement.executeUpdate("INSERT INTO users (username,password) VALUES ('"+usernameValue+"','"+passwordValue+"')");
%>
GOODLOGIN.JSP
<%@ page errorPage="badLogin.jsp"%>
<%@ page import="gcd.UserNameValidationBean"%>
<% UserNameValidationBean validationBean = new UserNameValidationBean();
if(request.getParameter("username")!=null)
validationBean.validateUserNameBean(request.getParameter("username"));
%>
<%=request.getParameter("username")%>
USERNAMEVALIDATIONBEAN.JAVA
package gcd;
public class UserNameValidationBean
public UserNameValidationBean(){}
public boolean validateUserName(String userName) throws InvalidUserNameException
if(userName.length() < 32)
throw new InvalidUserNameException("User Name Invalid: " + userName);
return true;
INVALIDUSERNAMEEXCEPTION.JAVA
package gcd;
public class InvalidUserNameException extends Exception
public InvalidUserNameException(String message)
super(message);
I need urgent help to get this working!Here is code for badLogin.jsp and badLoginWithExceptonObject:
BADLOGIN.JSP
<HTML><HEAD><TITLE>Login Failure</TITLE></HEAD>
<BODY bgcolor="#FF9900">
<H1></H1>
<font face="Arial" size="3">Sorry but you either entered an incorrect username
or password </font>
<P><font face="Arial" size="3">Try Again</font>
</BODY></HTML>
BADLOGINWITHEXCEPTIONOBJECT.JSP
<HTML><HEAD><TITLE>Check User Login Against Parameters</TITLE></HEAD>
<BODY bgcolor="#FF9900">
<%@ page isErrorPage = "true"%>
<P><font face="Arial" size="3">Error =</font> <%= exception.getMessage()%> <% PrintWriter writer = new PrintWriter(out); %>
<P><font face="Arial" size="3">Stack =</font> <% exception.printStackTrace(writer); %>
<P><font face="Arial" size="3">Try Again</font>
</BODY></HTML> -
Urgent Help required! - Storing the XML as String instead as a file
Hi,
I need urgent help on this.
I have an XML file. I have used org.w3c.dom to build dom and manipulate the XML file.
I have updated the values for some of the nodes and I have deleted some of the unwanted nodes.
I am able to save the output of the DOM as another XML file using
either transform class or XMLSerializer with OutputFormatter class.
But my requirement is to save the output of the DOM into a String instead of a file.
When I save it in String, I need to have the following XML decalration and DOCTYPE declration also with it.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Test SYSTEM "Test.dtd">
Can anyone pls help me in this??
Thanks in Advance. Expecting some inpputs pls....!
Regards,
Gayathri.hi,
i think this is what u want
public static String getXmlString(Document d) {
StringWriter strResponse = null;
try {
OutputFormat format = new OutputFormat(d);
strResponse = new StringWriter();
XMLSerializer serial = new XMLSerializer( strResponse, format );
serial.asDOMSerializer();
serial.serialize(d.getDocumentElement());
catch (Exception e) {
System.out.println(e.toString());
return strResponse.toString();
}HTH
vasanth-ct -
Urgent Help (Insert Jdev10.1.3.3.0)
Hi all,
I need urgent help. I want to simple insert, update process to custom table on R12.0.6 using Jdev10.1.3.3.0. My custom table have primary key. I follow the tutorial step by step. I can do the same thing R11i using Jdev9.0.3 on other platforms. Here I can also do cretae or update process with ADF. However here there is no IAS server. I have to use OAF. I check all data types length.
My code is:
in AM.Impl.Java
public void createEmployee()
OAViewObject vo = (OAViewObject)getHesAvivaVO1();
if (!vo.isPreparedForExecution())
vo.executeQuery();
Row row = vo.createRow();
vo.insertRow(row);
// Required per OA Framework Model Coding Standard M69
row.setNewRowState(Row.STATUS_INITIALIZED);
} // end createEmployee()
public void apply()
getTransaction().commit();
} // end apply()
In controller:
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
super.processRequest(pageContext, webBean);
if (!pageContext.isFormSubmission())
OAApplicationModule am = pageContext.getApplicationModule(webBean);
am.invokeMethod("createEmployee", null);
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
super.processFormRequest(pageContext, webBean);
OAApplicationModule am = pageContext.getApplicationModule(webBean);
if (pageContext.getParameter("Apply") != null)
am.invokeMethod("apply");
In EO impll.java XXNTC_HESAP sequence for primary key HES_MAP_ID
public void create(AttributeList attributeList) {
super.create(attributeList);
OADBTransaction transaction = getOADBTransaction();
Number hesap = transaction.getSequenceValue("XXNTC_HESAP");
setHesMapId(hesap);
Whatever I've tried I get the same error:
oracle.apps.fnd.framework.OAException: oracle.jbo.DMLException: JBO-26041: Failed to post data to database during "Insert": SQL Statement "INSERT INTO XXNTC_AS400_HESAP_MAPPING(AS400_HESAP_NO,SEGMENT2,SEGMENT3,CREATED_BY,LAST_UPDATED_BY,LAST_UPDATE_DATE,HES_MAP_ID) VALUES (?,?,?,?,?,?,?)".
at oracle.apps.fnd.framework.OAException.wrapperInvocationTargetException(Unknown Source)
at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(Unknown Source)
at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(Unknown Source)
at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(Unknown Source)
at oracle.apps.per.Avi1.webui.HesapMap1CO.processFormRequest(HesapMap1CO.java:62)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at OA.jspService(_OA.java:71)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)
## Detail 0 ##
java.sql.SQLException: ORA-00911: invalid character
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:185)
at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:633)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1161)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3001)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3074)
at oracle.jbo.server.OracleSQLBuilderImpl.doEntityDML(OracleSQLBuilderImpl.java:427)
at oracle.jbo.server.EntityImpl.doDML(EntityImpl.java:5740)
at oracle.jbo.server.EntityImpl.postChanges(EntityImpl.java:4539)
at oracle.apps.fnd.framework.server.OAEntityImpl.postChanges(Unknown Source)
at oracle.jbo.server.DBTransactionImpl.doPostTransactionListeners(DBTransactionImpl.java:2996)
at oracle.jbo.server.DBTransactionImpl.postChanges(DBTransactionImpl.java:2807)
at oracle.jbo.server.DBTransactionImpl.commitInternal(DBTransactionImpl.java:1971)
at oracle.jbo.server.DBTransactionImpl.commit(DBTransactionImpl.java:2173)
at oracle.apps.fnd.framework.server.OADBTransactionImpl.commit(Unknown Source)
at oracle.apps.per.Avi1.server.AviAMImpl.apply(AviAMImpl.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(Unknown Source)
at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(Unknown Source)
at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(Unknown Source)
at oracle.apps.per.Avi1.webui.HesapMap1CO.processFormRequest(HesapMap1CO.java:62)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at OA.jspService(_OA.java:71)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)
java.sql.SQLException: ORA-00911: invalid character
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:185)
at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:633)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1161)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3001)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3074)
at oracle.jbo.server.OracleSQLBuilderImpl.doEntityDML(OracleSQLBuilderImpl.java:427)
at oracle.jbo.server.EntityImpl.doDML(EntityImpl.java:5740)
at oracle.jbo.server.EntityImpl.postChanges(EntityImpl.java:4539)
at oracle.apps.fnd.framework.server.OAEntityImpl.postChanges(Unknown Source)
at oracle.jbo.server.DBTransactionImpl.doPostTransactionListeners(DBTransactionImpl.java:2996)
at oracle.jbo.server.DBTransactionImpl.postChanges(DBTransactionImpl.java:2807)
at oracle.jbo.server.DBTransactionImpl.commitInternal(DBTransactionImpl.java:1971)
at oracle.jbo.server.DBTransactionImpl.commit(DBTransactionImpl.java:2173)
at oracle.apps.fnd.framework.server.OADBTransactionImpl.commit(Unknown Source)
at oracle.apps.per.Avi1.server.AviAMImpl.apply(AviAMImpl.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(Unknown Source)
at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(Unknown Source)
at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(Unknown Source)
at oracle.apps.per.Avi1.webui.HesapMap1CO.processFormRequest(HesapMap1CO.java:62)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at OA.jspService(_OA.java:71)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)
Thanks.nope, its not the reason why you got that error.
You got the error in a particular SQL statement.
If something wrong with characters in the DBC file then your jdev would not have connected to the database in the first place.
If are not connected to the database, there is no way you can get any database errors.
You would have solved the problem either unknowingly or through different set of Data.
cos its really the problem with the data thats getting inserted.
--Prasanna -
Help with getting values from request. Very Strange!!
Hello,
My very strange problem is the following.
I have created three dynamic list boxes. When the user select
the first list box, the second becomes populated with stuff
from a database. The third becomes populated when the second
is selected. Now, I have used hidden values in order for
me to get the selected value from the first listbox. The
following code is my first listbox:
<SELECT NAME="resources" onChange="document.hiddenform.hiddenObject.value = this.option [this.selectedIndex].value; document.hiddenform.submit();">
<OPTION VALUE =""> Resource</OPTION>
<OPTION VALUE ="soil"> Soil </OPTION>
<OPTION VALUE ="water"> Water </OPTION>
<OPTION VALUE ="air"> Air </OPTION>
<OPTION VALUE ="plants"> Plants </OPTION>
<OPTION VALUE ="animals"> Animals </OPTION>
</SELECT>
I use the getRequest method to get the value of hiddenObject.
At this time I am able to get the value of hiddenObject to populate
the second list box.
But, when the user selects an item from the second list box
and the second form is also submitted,
I lose the value of hiddenObject. Why is this??
The code to populate my second listbox is the following:
<SELECT NAME ="res_categories" onChange="document.hiddenform2.hiddenObject2.value = this.options[this.selectedIndex].value; document.hiddenform2.submit(); ">
<OPTION VALUE ="" SELECTED> Category</OPTION>
Here I access a result set to populate the list box.
Please help!!Form parameters are request-scoped, hence the request.getParameter("hiddenObject"); call after the submission of the second form returns a null value because the hiddenObject parameter does not exist within the second request.
A solution would be to add a hiddenObject field to your second form and alter the onChange event for res_categories to read
document.hiddenform2.hiddenObject.value=document.1stvisibleformname.resources.option[document.1stvisibleformname.resources.selectedIndex].value;
document.hiddenform2.hiddenObject2.value = this.options[this.selectedIndex].value;
document.hiddenform2.submit();You will then come across a similar problem with your third drop-down if indeed you need to resubmit the form...
A far better approach would be to create a session scoped bean, and a servlet to handle these requests. Then when the servlet is called, it would set the value of the bean property, thus making it available for this request, and all subsequent requests within the current session. This approach would eliminate the need for the clunky javascript, making your application far more stable. -
Geting null values from request
hi!
i m producing this code through out.println() method in my page and then using java script
i am submiting this page to another page
<td width="56%"><textarea name="question_no_1"></textarea></td>
<input name="question_no_1_radio1" type="radio" value="radio"></td>
<td width="59%"> <textarea name="question_no_1_ans1"></textarea></td>
<input type="radio" name="question_no_1_radio2" value="radio"></td>
<td><textarea name="question_no_1_ans2"></textarea></td>
<input type="radio" name="question_no_1_radio3" value="radio"></td>
<td><textarea name="question_no_1_ans3"></textarea></td>
<input name="question_no_1_radio4" type="radio" value="radio"></td>
<td><textarea name="question_no_1_ans4"></textarea></td>
but when i submit it to the other page and try to retrieve value of parameter "question_no_1"
through the bellow statement it shows a null value but i have given a value previously by
typing a question in it
System.out.println("the Body Of The First Question Is "+request.getParameter("question_no_1"));
can anybody help me what is going on here.
also if i try to normaly submit first page (ie <form="form1" method="post" action="other_jsp_page.jsp"> ) then the statement in the next page gives me the correct value but
i have to submit the first paper through java script.
if u want to see full detail of my code then go to the following link
http://forum.java.sun.com/thread.jsp?thread=309254&forum=45&message=1237097
thanx in advanceOK, your problem is that you are not submmiting the values to the other page. When you do the
--> document.forms[0].submit();
in JavaScript, the form has to action defined
--> <form name="form1" method="" action="">
So, the page does nothing. The line following the submit just changes the location of the page, IT DOES NOT POST the values.
One solutions is the following:
1.- define an action for your form:
<form name="form1" method="POST" action="'save_paper.jsp">
2.- Then create a JavaScript function that validates the fields and simply return "true" if the form is correct, and false if there is a problem (just a little modification of the one you have).
3.- Then modify your submit button:
Instead of:
<input type="button" name="Save" value="Save" onClick="validateField()">
Try:
<input type="SUBMIT" value="Save" onclick="validateField();">
Maybe you are looking for
-
Problem in mapping fields of idoc type orders05.
I am passing value from Idoc in segment E1EDK14.and according to it biiling block should be populated.I am writting this in an exit. In the debuuger when I am running its showing the value. But its not coming in the output. I think the values of the
-
While wireless is now a necessity for me, I have to say I am disappointed in the MacBook's performance. My friends with iBooks are able to get WiFi quickly and their connections are reliable. My newer MacBook, however is inconsistent in the extreme a
-
Mountain Lion and Power PC application negation
Just downloaded Mountain Lion. Now I cannot use my "power PC' Applications like Excel or Word or Music Planet. Why? Help!
-
Hi I am getting an error while PGI "Account 400000 requires an assignment to a CO object" How to solve this ?
-
Photoshop Elements 11 Change harddrives on Mac now get Error 213:5
What's the solution?