Re: urgent - data-source and container managed datasource

2004-03-16 Thread Shyam A
Hello,

I have configured my data source on OC4J standalone
version. Given below are snippets from the relevant
files:

In my data-sources.xml , I have
data-source
class=com.evermind.sql.DriverManagerDataSource
name=TestDS
location=jdbc/OracleCoreDS
xa-location=jdbc/xa/OracleXADS
ejb-location=jdbc/TestDS
connection-driver=oracle.jdbc.driver.OracleDriver
url=jdbc:oracle:thin:@servername:1521:test
username=username
password=password
min-connections=5 
max-connections=20
inactivity-timeout=30
/

I lookup this data source in a DatabaseServlet,
which is loaded on server startup, and intialize a
static variable in my DBConnection class, which
manages database connections.

I use the code below:
snip
InitialContext ic = new InitialContext();
DataSource ds =
(DataSource)ic.lookup(jdbc/TestDS);
..
DBConnection.dataSource=ds; //initializeDataSource in
the DBConnection class
   
snip

In my DBConnection class, I have methods like
openConnection(), closeConnection() et al to handle
connections from the data source.

snip
public Connection openConnection() 
   {
Connection con=null;
try
   {
   con = dataSource.getConnection();
   }   
 catch(Exception e)
{ 
  System.out.println(Error: Unable to get
connection  + e.getMessage());

}
return con;   
   }
snip

In order to load the DatabaseServlet on starup, I have
the following in the web.xml file:

servlet
servlet-namedatabase/servlet-name
   
servlet-classobs.application.DatabaseServlet/servlet-class
   
load-on-startup1/load-on-startup
  /servlet


HTH,
Shyam


--- Janice [EMAIL PROTECTED] wrote:
 Hi There,
 
 I'm getting ready to ship off my application and I'm
 trying to use the
 application server (standalone oc4j) to hold the
 data source information
 instead of having it in struts-config.xml.  Is this
 possible?
 
 When jDeveloper deploys to the server it builds me a
 data-sources.xml file
 which I presume is correct.  When I test the
 connection, its fine.
 
 In web.xml I entered:
 
   resource-ref
 res-ref-namejdbc/bartCoreDS/res-ref-name
 res-typejavax.sql.DataSource/res-type
 res-authContainer/res-auth
   /resource-ref
 
 Where jdbc/bartCoreDS matches the location entry
 of the data-source in
 data-sources.xml.
 
 Then I took out the data-sources from
 struts-config.xml.  I'm not terribly
 surprised that now my application can't find the
 database.  The problem is I
 don't know where to look for instructions on how to
 do this or if its even
 possible.  Is there a way to put a data-source
 configuration in
 struts-config.xml that tells it to look at the
 container, so that the
 username and password aren't in it??
 
 If I can provide more information, I will.  Time is
 running a bit short, so
 I'd really, really appreciate a quick response.
 
 Janice
 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Reporting + Struts

2004-03-11 Thread Shyam A
Niall,

Thanks for sharing your experience with Jasper
reports.
Looks like using iText will make things easier for me.

I noticed that I also missed a few posts on the same
thread.

Thanks,
Shyam

--- Niall Pemberton [EMAIL PROTECTED]
wrote:
 I sent this earlier, but it didn't seem to reach the
 list. A number of
 messages I sent never seemed to arrive (most do) -
 does anyone else find
 this?
 
 Niall
 - Original Message - 
 From: Niall Pemberton
 [EMAIL PROTECTED]
 To: Struts Users Mailing List
 [EMAIL PROTECTED]
 Sent: Thursday, March 11, 2004 12:51 PM
 Subject: [OT]Re: Reporting + Struts
 
 
 I looked briefly at Jasper reports. Its supposed to
 be good but I decided
 against using it.
 
 You have to set up a load of xml to create a report,
 doing it by hand would
 be very cumbersome - you have to use something like
 iReports to generate the
 XML. My users wanted a specific look for a report
 with alot of data accross
 the page and I struggled to do it in Jasper Reports
 - maybe simpler stuff it
 would be much better. Also I wanted pdf versions,
 but what it actually did
 was create an image and stuff it in a pdf file,
 rather than actually
 writing the data to the pdf file, which means you
 can't use facilities such
 as search. There were also other things I wanted to
 do in pdf, that I
 couldn't user Jasper
 
 I ended up ditching it and creating reports using
 iText to create pdf files
 directly.
 
  http://www.lowagie.com/iText/
 
 BTW, I wasn't doing it in a web environment and the
 pdf generation is slow,
 can take up to 30 seconds for a large report. I am
 going to be putting
 reporting into my webapp, but I'm thinking of doing
 it by the users
 submitting a request for a report, storing the
 request in a database, then
 have a separate machine which wakes up periodically
 (say every five
 minutes), checks the requests, generates the report
 and emails it out to the
 user. That way my webapp isn't affected by the
 report generation clogging up
 the CPU.
 
 Niall
 
 
 - Original Message - 
 From: Shyam A [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, March 10, 2004 7:57 PM
 Subject: Reporting + Struts
 
 
  Hi,
 
  I have a web application in which I need to
 generate
  reports on the fly, i.e., the user submits some
 report
  criteria on a web page and report has to be
 generated
  dynamically.
  I searched the archives and found that Jasper
 reports
  is a good tool to use, and there are some GUI
 tools
  available which will help in report design eg.
  iReports.
 
  I have a couple of questions:
 
  1. Is it advisable to use Struts for the reporting
  application? Or just a JSP/Servlet based
 application
  would suffice?
 
  2. Is there a big learning curve for using Jasper
  reports/IReports?
 
  I would appreciate it if somebody could share
 their
  experience in using the above mentioned tools.
 
  Thanks,
  Shyam
 
 
 
  __
  Do you Yahoo!?
  Yahoo! Search - Find what you're looking for
 faster
  http://search.yahoo.com
 
 

-
  To unsubscribe, e-mail:
 [EMAIL PROTECTED]
  For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 
 
 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reporting + Struts

2004-03-10 Thread Shyam A
Hi,

I have a web application in which I need to generate
reports on the fly, i.e., the user submits some report
criteria on a web page and report has to be generated
dynamically.
I searched the archives and found that Jasper reports 
is a good tool to use, and there are some GUI tools
available which will help in report design eg.
iReports.

I have a couple of questions:

1. Is it advisable to use Struts for the reporting
application? Or just a JSP/Servlet based application
would suffice?

2. Is there a big learning curve for using Jasper
reports/IReports?

I would appreciate it if somebody could share their
experience in using the above mentioned tools.

Thanks,
Shyam



__
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [OT] Database locking and deadlock

2004-03-09 Thread Shyam A
Hello Vijay,

Thanks for your mail. I know I can synchronize the
transactions using synchronized method in Java or
use semaphores. This will avoid the row-level locks,
but,I understand it may cause performance bottlenecks
when there are many concurrent users.
I always update the tables in the same order.So, there
is no question of cyclic issue. The issue here is
concurrent users may update the same rows of the
concerned table, and at some point, the database
cannot handle the updates, depending on the number of
users.

Do you think using a stored procedure for the
transaction will help?

Thanks,
Shyam

--- Balakrishnan, Vijay
[EMAIL PROTECTED] wrote:
 Hi Shyam,
 
 You can synchronise the whole transaction with the 2
 updates.That will take
 care of 1 of the issues.The other issue might be
 cyclic i.e are you updating
 table C first and then updating table A or B
 somewhere in your
 application.You will then have to make the updates
 in the same order i.e
 always update A first before C.This issue is a wild
 guess of mine-so I might
 be way off base here depending on row level locking
 etc.
 
 Vijay
 
 -Original Message-
 From: Shyam A [mailto:[EMAIL PROTECTED]
 Sent: Monday, March 08, 2004 6:36 PM
 To: Struts Users Mailing List
 Subject: Re: [OT] Database locking and deadlock
 
 
 Vic,
 
 Yes, I do get a deadly embrace or deadlock, as the
 row locks on the table multiply when they occur,
 holding up connections in the connection pool,
 eventually consuming all connections, and then all
 hell breaks loose.
 
 Were you referring to synchronizing with semaphores?
 
 I read somewhere that the Oracle database is
 supposed
 to handle deadlocks by rolling back one of the
 affected transactions. But the row locks seem to
 occur
 intermittently, possibly when there are large
 numbers
 of concurrent users.
 
 I cannot avoid the transaction as the database
 updates
 have to be done as one unit. An alternative that
 comes
 to mind is using a stored procedure for the update
 operations. Anyway, I need to do some research on
 passing Java objects to stored procedures.
 
 Thanks,
 Shyam
 
 
 
 --- Vic Cekvenich [EMAIL PROTECTED]
 wrote:
  Do you have a deadly embrace?
  Maybe just syncronise w/ semaphorse or the like.
  .V
  
  Shyam A wrote:
   Vic,
   
   Thanks again. I'm not in a position to switch to
   IBatis as my application is currently in use.
  Right
   now, I'm manually killing the user sessions
 which
  lock
   up the table in the database. My database is
  Oracle
   9i, and this problem seems to occur only with
  large
   numbers of concurrent users. In my DAO,I update
  three
   tables as part of a transaction - table A and/or
  table
   B (in loops), and table C. Commit operation is
  done
   only after all tables are updated successfully.
  So, it
   may be possible that the DBMS locks up rows of
  table A
   or B (before commit) and waits until it updates
  table
   C for the commit. Is this the cause of the
  problem?
   
   I've not been able to determine (using SQl Plus,
  TOAD
   ) which query is causing the row-level lock.
   
   Any ideas?
   
   Thanks,
   Shyam
   
   --- Vic Cekvenich [EMAIL PROTECTED]
  wrote:
   
  Is there a way you can reproduce this w/ iSQL
  
  
 

-
  To unsubscribe, e-mail:
  [EMAIL PROTECTED]
  For additional commands, e-mail:
  [EMAIL PROTECTED]
  
 
 
 __
 Do you Yahoo!?
 Yahoo! Search - Find what you're looking for faster
 http://search.yahoo.com
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [OT] Database locking and deadlock

2004-03-09 Thread Shyam A
Duncan,

Thanks for the suggestion. I was aware of that and did
consider the option. However, after consulting with my
DBA and doing some research, it seems the problem lies
with the number of concurrent transactions that can be
done on a table. This can be configured in the
INITRANS parameter for the table. It has been
increased from the default value of 1 to 5. We are
waiting to see if this fixes my problem.


Thanks,
Shyam

--- Duncan Mills [EMAIL PROTECTED] wrote:
  From a pure Oracle perspective I would program this
 more defensively
 e.g Do a select for update nowait before you issue
 the update to grab 
 the lock in advance. That way you'll get an oracle
 error (ora -54) if 
 another user has the row and you can handle it
 appropriately
 
 Duncan
 
 Shyam A wrote:
 
 Hi,
 
 I know the subject of my mail is off-topic but I
 hope
 somebody will be able to help me out with my
 problem.
 
 I experienced a wierd problem today when a deadlock
 occured in my database - Oracle 9i, and it locked
 up
 all connections in the connection pool on my server
 -
 OC4J (Oracle 9iAS). I have a connection pool, which
 is
 configured on my server- OC4J. It is intialized on
 server startup, using a Servlet. 
 
 
 I would like to verify if the code I use in my DAO
 may
 cause any deadlock condition. In my DAO, I use
 Update queries as part of a transaction. i.e, I
 turn
 off auto-commit, do my Update queries, and commit
 or
 rollback depending on the outcome of the queries.
 In one of the queries, I may need to update
 multiple
 rows of a table, and hence do the update operation
 in
 a loop (over a collection).
 
 Given below is the relevant portion of the code:
 
 snip
   //method that updates votes for candidates in an
 election
   public int updateVotes(BallotList ballotList)
   {
  int result=0;   //result of insert operation
 String query=;
 
  Ballot ballot=null;
  CandidateList candList=null;
  Candidate candidate=null;
  int currVote=0;
 
  int electionNo = ballotList.getElectionNo();
 
 try
 {
  
  for(int
 i=0;iballotList.getSize();i++)
   {
  ballot = ballotList.getBallot(i);
  candList = ballot.getCandidateList();
 
  for(int j=0;jcandList.getSize();j++)
  {
  candidate = candList.getCandidate(j);  
   
  
  //update votes for candidate
  if(candidate.getVote()  0)
  {
  //get current vote count and update
  currVote =

getCurrentVote(electionNo,candidate.getPostNo(),candidate.getPidm());
 
  currVote++;
  
  query = Update DZRCAND set DZRCAND_NUM_VOTE =
 +currVote+  + 
  where DZRCAND_ELCTN_NO = 
  +electionNo+  +
  and  DZRCAND_POST_NO =
 +candidate.getPostNo()+  +
  and DZRCAND_CAND_PIDM =
 +candidate.getPidm()+; 
  
  result += dbConnection.doUpdate(query);
  }
 
  }   //end of inner for loop
  
   }  //end of outer for loop  
  
 }
 catch(Exception e)
 {
 System.out.println(Exception in
 DZRCAND
 update for votes:  + e.getMessage());
  System.out.println(query: + query);
 }
 
  return result;
 
   }
 /snip
 
 
 Is there a possibilty of a deadlock occuring in the
 above code when there are mutliple users
 concurrently
 accessing the system.i.e, multiple users update
 multiple rows of the table at the same time
 
 Could somebody throw some light on this?
 
 My understanding is that deadlocks are
 automatically
 handled by the DBMS. Anyway, is there a way to
 prevent
 the possiblity of deadlocks in my program ?
 
 One more thing - in the code above and in other
 Select queries, I open and close the Connection
 from
 the connection pool. However, I do not close the
 Statement or ResultSet objects. Will this lead to
 problems ? My understanding is that closing the
 Connection object will free up all the associated
 resources.
 
 Any help/pointers/suggestions will be greatly
 appreciated.
 
 Thanks,
 Shyam
 
 __
 Do you Yahoo!?
 Yahoo! Search - Find what you’re looking for faster
 http://search.yahoo.com

[OT] Database locking and deadlock

2004-03-08 Thread Shyam A
Hi,

I know the subject of my mail is off-topic but I hope
somebody will be able to help me out with my problem.

I experienced a wierd problem today when a deadlock
occured in my database - Oracle 9i, and it locked up
all connections in the connection pool on my server -
OC4J (Oracle 9iAS). I have a connection pool, which is
configured on my server- OC4J. It is intialized on
server startup, using a Servlet. 


I would like to verify if the code I use in my DAO may
cause any deadlock condition. In my DAO, I use
Update queries as part of a transaction. i.e, I turn
off auto-commit, do my Update queries, and commit or
rollback depending on the outcome of the queries.
In one of the queries, I may need to update multiple
rows of a table, and hence do the update operation in
a loop (over a collection).

Given below is the relevant portion of the code:

snip
  //method that updates votes for candidates in an
election
  public int updateVotes(BallotList ballotList)
  {
int result=0;   //result of insert operation
String query=;

Ballot ballot=null;
CandidateList candList=null;
Candidate candidate=null;
int currVote=0;

int electionNo = ballotList.getElectionNo();

try
{   

 for(int i=0;iballotList.getSize();i++)
 {
ballot = ballotList.getBallot(i);
candList = ballot.getCandidateList();

for(int j=0;jcandList.getSize();j++)
{
candidate = candList.getCandidate(j);  
 

//update votes for candidate
if(candidate.getVote()  0)
{
//get current vote count and update
currVote =
getCurrentVote(electionNo,candidate.getPostNo(),candidate.getPidm());

currVote++;

query = Update DZRCAND set DZRCAND_NUM_VOTE =
+currVote+  + 
where DZRCAND_ELCTN_NO = 
+electionNo+  +
and  DZRCAND_POST_NO =
+candidate.getPostNo()+  +
and DZRCAND_CAND_PIDM =
+candidate.getPidm()+; 

result += dbConnection.doUpdate(query);
}

}   //end of inner for loop

 }  //end of outer for loop  

}
catch(Exception e)
{
System.out.println(Exception in DZRCAND
update for votes:  + e.getMessage());
System.out.println(query: + query);
}

 return result;

  }
/snip


Is there a possibilty of a deadlock occuring in the
above code when there are mutliple users concurrently
accessing the system.i.e, multiple users update
multiple rows of the table at the same time

Could somebody throw some light on this?

My understanding is that deadlocks are automatically
handled by the DBMS. Anyway, is there a way to prevent
the possiblity of deadlocks in my program ?

One more thing - in the code above and in other
Select queries, I open and close the Connection from
the connection pool. However, I do not close the
Statement or ResultSet objects. Will this lead to
problems ? My understanding is that closing the
Connection object will free up all the associated
resources.

Any help/pointers/suggestions will be greatly
appreciated.

Thanks,
Shyam

__
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [OT] Database locking and deadlock

2004-03-08 Thread Shyam A
Robert,

Thanks for your response. No, the update queries use a
single connection for which auto-commit is turned off.
Commit is done only if all the update queries are
successful.

Thanks,
Shyam

--- Robert Taylor [EMAIL PROTECTED] wrote:
 Is it possible that dbConnection.doUpdate() gets a
 new connection
 each time which could possibly use up (exceed max
 allowed) the connections in the pool.
 
 Just a guess.
 
 robert
 
  -Original Message-
  From: Shyam A [mailto:[EMAIL PROTECTED]
  Sent: Monday, March 08, 2004 4:32 PM
  To: [EMAIL PROTECTED]
  Subject: [OT] Database locking and deadlock
 
 
  Hi,
 
  I know the subject of my mail is off-topic but I
 hope
  somebody will be able to help me out with my
 problem.
 
  I experienced a wierd problem today when a
 deadlock
  occured in my database - Oracle 9i, and it locked
 up
  all connections in the connection pool on my
 server -
  OC4J (Oracle 9iAS). I have a connection pool,
 which is
  configured on my server- OC4J. It is intialized on
  server startup, using a Servlet.
 
 
  I would like to verify if the code I use in my DAO
 may
  cause any deadlock condition. In my DAO, I use
  Update queries as part of a transaction. i.e, I
 turn
  off auto-commit, do my Update queries, and
 commit or
  rollback depending on the outcome of the queries.
  In one of the queries, I may need to update
 multiple
  rows of a table, and hence do the update operation
 in
  a loop (over a collection).
 
  Given below is the relevant portion of the code:
 
  snip
//method that updates votes for candidates in an
  election
public int updateVotes(BallotList ballotList)
{
  int result=0;   //result of insert operation
  String query=;
 
  Ballot ballot=null;
  CandidateList candList=null;
  Candidate candidate=null;
  int currVote=0;
 
  int electionNo = ballotList.getElectionNo();
 
  try
  {
 
   for(int
 i=0;iballotList.getSize();i++)
   {
  ballot = ballotList.getBallot(i);
  candList = ballot.getCandidateList();
 
  for(int j=0;jcandList.getSize();j++)
  {
  candidate = candList.getCandidate(j);
 
  //update votes for candidate
  if(candidate.getVote()  0)
  {
  //get current vote count and update
  currVote =
 

getCurrentVote(electionNo,candidate.getPostNo(),candidate.getPidm());
 
  currVote++;
 
  query = Update DZRCAND set DZRCAND_NUM_VOTE
 =
  +currVote+  +
  where DZRCAND_ELCTN_NO = 
  +electionNo+ 
 +
  and  DZRCAND_POST_NO =
  +candidate.getPostNo()+  +
  and DZRCAND_CAND_PIDM =
  +candidate.getPidm()+;
 
  result += dbConnection.doUpdate(query);
  }
 
  }   //end of inner for loop
 
   }  //end of outer for loop
 
  }
  catch(Exception e)
  {
  System.out.println(Exception in
 DZRCAND
  update for votes:  + e.getMessage());
  System.out.println(query: + query);
  }
 
   return result;
 
}
  /snip
 
 
  Is there a possibilty of a deadlock occuring in
 the
  above code when there are mutliple users
 concurrently
  accessing the system.i.e, multiple users update
  multiple rows of the table at the same time
 
  Could somebody throw some light on this?
 
  My understanding is that deadlocks are
 automatically
  handled by the DBMS. Anyway, is there a way to
 prevent
  the possiblity of deadlocks in my program ?
 
  One more thing - in the code above and in other
  Select queries, I open and close the Connection
 from
  the connection pool. However, I do not close the
  Statement or ResultSet objects. Will this lead to
  problems ? My understanding is that closing the
  Connection object will free up all the associated
  resources.
 
  Any help/pointers/suggestions will be greatly
  appreciated.
 
  Thanks,
  Shyam
 
  __
  Do you Yahoo!?
  Yahoo! Search - Find what youre looking for
 faster
  http://search.yahoo.com
 
 

-
  To unsubscribe, e-mail:
 [EMAIL PROTECTED]
  For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED

Re: [OT] Database locking and deadlock

2004-03-08 Thread Shyam A
Vic,

Thanks for the pointer,but is there any way of
salvaging the current situation?.It seems the Update
operation is causing the DBMS to have row-level locks
on the table,eventually leading to deadlock.

Thanks,
Shyam

--- Vic Cekvenich [EMAIL PROTECTED] wrote:
 Of course you could switch to a popular DAO such as
 iBatis or Hiberante 
 and avoid the issue all together.
 There are JDBC forums on Sun.
 .V
 
 Shyam A wrote:
  Robert,
  
  Thanks for your response. No, the update queries
 use a
  single connection for which auto-commit is turned
 off.
  Commit is done only if all the update queries are
  successful.
  
  Thanks,
  Shyam
  
  --- Robert Taylor [EMAIL PROTECTED] wrote:
  
 Is it possible that dbConnection.doUpdate() gets a
 new connection
 each time which could possibly use up (exceed max
 allowed) the connections in the pool.
 
 Just a guess.
 
 robert
 
 
 -Original Message-
 From: Shyam A [mailto:[EMAIL PROTECTED]
 Sent: Monday, March 08, 2004 4:32 PM
 To: [EMAIL PROTECTED]
 Subject: [OT] Database locking and deadlock
 
 
 Hi,
 
 I know the subject of my mail is off-topic but I
 
 hope
 
 somebody will be able to help me out with my
 
 problem.
 
 I experienced a wierd problem today when a
 
 deadlock
 
 occured in my database - Oracle 9i, and it locked
 
 up
 
 all connections in the connection pool on my
 
 server -
 
 OC4J (Oracle 9iAS). I have a connection pool,
 
 which is
 
 configured on my server- OC4J. It is intialized
 on
 server startup, using a Servlet.
 
 
 I would like to verify if the code I use in my
 DAO
 
 may
 
 cause any deadlock condition. In my DAO, I use
 Update queries as part of a transaction. i.e, I
 
 turn
 
 off auto-commit, do my Update queries, and
 
 commit or
 
 rollback depending on the outcome of the queries.
 In one of the queries, I may need to update
 
 multiple
 
 rows of a table, and hence do the update
 operation
 
 in
 
 a loop (over a collection).
 
 Given below is the relevant portion of the code:
 
 snip
   //method that updates votes for candidates in
 an
 election
   public int updateVotes(BallotList ballotList)
   {
int result=0;   //result of insert operation
 String query=;
 
Ballot ballot=null;
CandidateList candList=null;
Candidate candidate=null;
int currVote=0;
 
int electionNo = ballotList.getElectionNo();
 
 try
 {
 
  for(int
 
 i=0;iballotList.getSize();i++)
 
 {
ballot = ballotList.getBallot(i);
candList = ballot.getCandidateList();
 
for(int j=0;jcandList.getSize();j++)
{
candidate = candList.getCandidate(j);
 
//update votes for candidate
if(candidate.getVote()  0)
{
//get current vote count and update
currVote =
 
 
 

getCurrentVote(electionNo,candidate.getPostNo(),candidate.getPidm());
  
currVote++;
 
query = Update DZRCAND set DZRCAND_NUM_VOTE
 
 =
 
 +currVote+  +
where DZRCAND_ELCTN_NO = 
  +electionNo+ 
 
 +
 
and  DZRCAND_POST_NO =
 +candidate.getPostNo()+  +
and DZRCAND_CAND_PIDM =
 +candidate.getPidm()+;
 
result += dbConnection.doUpdate(query);
}
 
}   //end of inner for loop
 
 }  //end of outer for loop
 
 }
 catch(Exception e)
 {
 System.out.println(Exception in
 
 DZRCAND
 
 update for votes:  + e.getMessage());
System.out.println(query: + query);
 }
 
  return result;
 
   }
 /snip
 
 
 Is there a possibilty of a deadlock occuring in
 
 the
 
 above code when there are mutliple users
 
 concurrently
 
 accessing the system.i.e, multiple users update
 multiple rows of the table at the same time
 
 Could somebody throw some light on this?


__
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [OT] Database locking and deadlock

2004-03-08 Thread Shyam A
Vic,

Thanks again. I'm not in a position to switch to
IBatis as my application is currently in use. Right
now, I'm manually killing the user sessions which lock
up the table in the database. My database is Oracle
9i, and this problem seems to occur only with large
numbers of concurrent users. In my DAO,I update three
tables as part of a transaction - table A and/or table
B (in loops), and table C. Commit operation is done
only after all tables are updated successfully. So, it
may be possible that the DBMS locks up rows of table A
or B (before commit) and waits until it updates table
C for the commit. Is this the cause of the problem?

I've not been able to determine (using SQl Plus, TOAD
) which query is causing the row-level lock.

Any ideas?

Thanks,
Shyam

--- Vic Cekvenich [EMAIL PROTECTED] wrote:
 Is there a way you can reproduce this w/ iSQL
 command line?
 I assume Sybase, since you said row-level.
 
 My guess is that it's not the sql, but your DAO
 logic somehow. It would 
 take you only a day or so to switch that one update
 to
 http://www.reumann.net/do/struts/ibatisLesson1
 
 .V
 
 Shyam A wrote:
  Vic,
  
  Thanks for the pointer,but is there any way of
  salvaging the current situation?.It seems the
 Update
  operation is causing the DBMS to have row-level
 locks
  on the table,eventually leading to deadlock.
  
  Thanks,
  Shyam
 
 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [OT] Database locking and deadlock

2004-03-08 Thread Shyam A
Vic,

Yes, I do get a deadly embrace or deadlock, as the
row locks on the table multiply when they occur,
holding up connections in the connection pool,
eventually consuming all connections, and then all
hell breaks loose.

Were you referring to synchronizing with semaphores?

I read somewhere that the Oracle database is supposed
to handle deadlocks by rolling back one of the
affected transactions. But the row locks seem to occur
intermittently, possibly when there are large numbers
of concurrent users.

I cannot avoid the transaction as the database updates
have to be done as one unit. An alternative that comes
to mind is using a stored procedure for the update
operations. Anyway, I need to do some research on
passing Java objects to stored procedures.

Thanks,
Shyam



--- Vic Cekvenich [EMAIL PROTECTED] wrote:
 Do you have a deadly embrace?
 Maybe just syncronise w/ semaphorse or the like.
 .V
 
 Shyam A wrote:
  Vic,
  
  Thanks again. I'm not in a position to switch to
  IBatis as my application is currently in use.
 Right
  now, I'm manually killing the user sessions which
 lock
  up the table in the database. My database is
 Oracle
  9i, and this problem seems to occur only with
 large
  numbers of concurrent users. In my DAO,I update
 three
  tables as part of a transaction - table A and/or
 table
  B (in loops), and table C. Commit operation is
 done
  only after all tables are updated successfully.
 So, it
  may be possible that the DBMS locks up rows of
 table A
  or B (before commit) and waits until it updates
 table
  C for the commit. Is this the cause of the
 problem?
  
  I've not been able to determine (using SQl Plus,
 TOAD
  ) which query is causing the row-level lock.
  
  Any ideas?
  
  Thanks,
  Shyam
  
  --- Vic Cekvenich [EMAIL PROTECTED]
 wrote:
  
 Is there a way you can reproduce this w/ iSQL
 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Life, the Universe and Everything (was: RE: [OT] RE: Memory usage)

2004-03-02 Thread Shyam A
+1

On action alone be thy interest,
Never on its fruits.
Let not the fruits of action be thy motive,
Nor be thy attachment to inaction.

- Bhagavad Gita (250 BC - 250 AD), Chapter 2

http://timesofindia.indiatimes.com/articleshow/8487868.cms



--- atta-ur rehman [EMAIL PROTECTED] wrote:
 +1
 
 ATTA
 
 On Mar 1, 2004, at 8:19 PM, Vic Cekvenich wrote:
 
 
  -Original Message-
  From: Chappell, Simon P
 [mailto:[EMAIL PROTECTED]
 
  4. I had the same frustrations that you have. I
 made the decision 
  that the
  best way to restore the balance of good in the
 universe, was to try to
  become the kind of tech lead that I would have
 wanted when I was a
  newbie/humble grunt.
 
  +1
  .V
 
 
 

-
  To unsubscribe, e-mail:
 [EMAIL PROTECTED]
  For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Action not forwarding to another Action

2004-03-02 Thread Shyam A
Use request.getAttribute(id).

hth,
Shyam

 Let me elaborate my question #3:
 If my .JSP has a html:form
 action=/app/UpdateOrder?id=30 ,  I know
 when I click a 'submit' button to get to an Action
 class, I can retrieve the
 id in my Action class by doing String id =
 Request.getParameter(id);
 But if my .jsp uses a link to pass the id such as
  a href=app/UpdateOrder.exec?id=30.. In
 other words, I get to the
 Action class through a 'link' rather than a
 'submit', can I still use 
 String id = Request.getParameter(id);  to
 retrieve the id?  I tried it
 and I can't find id from the Request object.
 
 
 -Original Message-
 From: Ramadoss Chinnakuzhandai
 [mailto:[EMAIL PROTECTED] 
 Sent: Monday, March 01, 2004 6:24 PM
 To: Struts Users Mailing List
 Subject: RE: Action not forwarding to another Action
 
 
 If Im not wrongif .exe is what you hv configured
 in web.xml then I see
 there is no reason why it is not picking up /
 
 possible reason could be...
 
 make sure that you are forwarding to Content which
 is mapped to
 /app/ListOfOrder.exe in your OrderMaintainAction
 
 1) Can someone also tell me if I have a Request
 attribute defined in 
 OrderMaintainAction, if the above redirection
 works, will I be able to 
 see the same Request attribute in
 OrderSearchAction?
 
 the same scenarion where I'm not able to get the
 value of request attribute
 which I set in my previous Action class then I set
 as session attribute and
 Im able to get that value in the other Action class
 where Im redirecting to.
 
 2) A general question: if formA is linked to formB
 through a 'link'.   If
 I
 click on the 'link' in formA, can I get to the
 passed parameter of 
 FormA by doing Request.geParameter(id) or I can
 only retrieve 'id' 
 throught a 'submit' rather than through a 'link'?
 
 I dont really understand your point but I assumed
 that you are passing a
 parameter from one form to another in such case if
 you are calling other
 page/calling action class by passing request
 parameter you could get those
 parameters on the other page/action class. 
 
 hth
 
 
 -Ramadoss
 
 
 
 
 
 
 -Original Message-
 From: Au-Yeung, Stella H
 [mailto:[EMAIL PROTECTED]
 Sent: Monday, March 01, 2004 5:51 PM
 To: '[EMAIL PROTECTED]'
 Subject: Action not forwarding to another Action
 
 
 Hi:
I have a similar problem that I can't invoke
 OrderSearchAction.exe from
 OrderMaintainAction.  I set a debug breakpoint at
 the beginning of
 OrderSearchAction and never get there.
 
 actionpath=/app/DeleteOrder
   
 type=com.cat.action.OrderMaintainAction
name=OrderFormBean
   scope=request
validate=false
 forward name=Content
 path=/app/ListOfOrder.exe redirect=true
 /
 forward name=ContentError
 path=/app/DeleteError.jsp/
 /action
 
 actionpath=/app/ListOfOrder
   
 type=com.cat.action.OrderSearchAction
name=OrderSearchFormBean
   scope=request
validate=false
 forward name=Content
 path=/app/ListOfOrder.jsp/
   forward name=ContentError
 path=/app/OrderError.jsp/
 
 /action
 
 I have two other questions:
 1) Can someone also tell me if I have a Request
 attribute defined in
 OrderMaintainAction, if the above redirection works,
 will I be able to see
 the same Request attribute in OrderSearchAction?
 2) A general question: if formA is linked to formB
 through a 'link'.   If I
 click on the 'link' in formA, can I get to the
 passed parameter of FormA by
 doing Request.geParameter(id) or I can only
 retrieve 'id' throught a
 'submit' rather than through a 'link'?
 
 Thanks for any help!
 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: A question on Struts taglib.

2004-02-24 Thread Shyam A
You can use the indexId attribute of logic:iterate
tag...
http://jakarta.apache.org/struts/doc-1.0.2/struts-logic.html#iterate

HTH,
Shyam

--- Au-Yeung, Stella H [EMAIL PROTECTED]
wrote:
 A question on Struts taglib.
 Can someone tell me how to reference the index of
 each element so I can
 pass it as a parameter with the a href path
 string?
 
 For example I have the following code, I want to
 print out 'partNumber' and
 'partDescription' and a a href' with index of each
 element'.
 
   logic:iterate id=parts

collection=%=ShopWorkOrderFormBean.getShopWorkOrder().getPartList()%

type=com.cat.sdl.fdd.dataBean.shopWorkOrder.PartBean/td
 tr
   td class=formCellbean:write name=parts
 property=partNumber/nbsp;/td
   td class=formCellbean:write name=parts
 property='partDescription'
 /nbsp;/td
   td class=formCell
a

href=app/fdd/shopWorkOrder/UpdatePart.exec?index=How
 to
 reference the index here
   img src=images/iconEdit.gif/anbsp;
 
 /td/tr
 /logic:iterate
 
 Thanks in advance!
 
 Stella
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.
http://antispam.yahoo.com/tools

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Must have action=..... in html:form tag?

2004-02-23 Thread Shyam A
Just a suggestion. Not sure if I'm right...
Instead of using onSubmit() event of your html:form,
why don't you call the Javascript when the user
clicks/submits the associcated HTML component -
Create/Update button, and set the action
accordingly.

HTH,
Shyam

--- Au-Yeung, Stella H [EMAIL PROTECTED]
wrote:
 But I don't always want
 /app/fdd/shopWorkOrder/fromCreateShopWorkOrder to
 be my action all the time.   I want the action for
 the form to be dynamic
 and depends on the form field whichAction.  That's
 why I created the
 javascript function submitForm(frm) to pick the
 action dynamically.  In
 other words, I have action mapping in my
 struts-config.xml file for both
 path
 /app/fdd/shopWorkOrder/fromCreateShopWorkOrder and
 /app/fdd/shopWorkOrder/fromUpdateShopWorkOrder. 
 But I want whichever one
 to be chosen to be dynamically. So  how I do that
 all within the
 html:form tag?
 
 -Original Message-
 From: Hubert Rabago [mailto:[EMAIL PROTECTED] 
 Sent: Monday, February 23, 2004 4:58 PM
 To: Struts Users Mailing List
 Subject: RE: Must have action=. in html:form
 tag?
 
 
 I never said anything close to what you're asking
 me.
 All I said is choose one of your two possible
 outcomes (doesn't matter which
 one), take the path that you gave it in the
 struts-config.xml, then use that
 in your html:form.  
 Let's say you have the ff entry in your
 struts-config:
 
 action path=/fromCreateShopWorkOrder ...
 name=theForm
 forward .../
 /action
 
 then in your html:form, specify that action:
 
 html:form action=/fromCreateShopWorkOrder 
method=post 
onSubmit=return
 submitForm(document.theForm)
 ...
 /html:form
 
 You do have action's associated with
 fromCreateShopWorkOrder and
 fromUpdateShopWorkOrder, right?
 
  - Hubert
 
 
 --- Au-Yeung, Stella H [EMAIL PROTECTED]
 wrote:
  Hubert:
  Can you elaborate that In othe words, how do I
 do everything that 
  the function submitForm() does to dynamically pick
 an action all 
  within the html:form tag?
  
  -Original Message-
  From: Hubert Rabago [mailto:[EMAIL PROTECTED]
  Sent: Monday, February 23, 2004 4:36 PM
  To: Struts Users Mailing List
  Subject: Re: Must have action=. in
 html:form tag?
  
  
  Specify the Action associated with
 fromCreateShopWorkOrder or 
  fromUpdateShopWorkOrder in the html:form
 attribute.
  
  --- Au-Yeung, Stella H [EMAIL PROTECTED]
 wrote:
   Hi:
   My html:form tag doesn't allow me to skip an
 'action' attribue.   If
  you
   look at my code below, I move the assignment of
 the 'form action'  
   to
   the javascript function so which action to take
 is dynamically depends 
   on the form element 'whichAction'.  But the
 compiler insist I have to 
   have the 'action' property right inside the
 html:form tag.  But that
  doesn't allow
   me to choose the action dynamically.   Does
 anyone have any suggestion?
   
   script language = Javascript
   function submitForm(frm)
   {
  var whichAction=frm.elements(whichAction)
   
  if (whichAction == create)
  {
 document.theForm.action =
   /app/fdd/shopWorkOrder/fromCreateShopWorkOrder;
  }
  else
  {
 document.theForm.action = 
   /app/fdd/shopWorkOrder/fromUpdateShopWorkOrder;
  }
   
  return true;
   }
   /script
   
   
   jsp:useBean id=ShopWorkOrderBean
 scope=request

  

class=com.cat.sdl.fdd.formBean.shopWorkOrder.ShopWorkOrderForm/
   html:form name=theForm method=post
 onSubmit=return
   submitForm(document.theForm)
   
   
   I got the following error with the above code:
   Parsing of JSP File
 '/app/fdd/shopWorkOrder/CreateTLFPart.jsp' 
   failed:
   /app/fdd/shopWorkOrder/CreateTLFPart.jsp(28):
 required attribute
 'action'
   not specified for tag 'form'
   probably occurred due to an error in
   /app/fdd/shopWorkOrder/CreateTLFPart.jsp line
 28:
   html:form name=theForm method=post
 onSubmit=return
   submitForm(document.theForm)
   
   
   
   
  


   -
   To unsubscribe, e-mail:
 [EMAIL PROTECTED]
   For additional commands, e-mail:
 [EMAIL PROTECTED]
   
  
  
  __
  Do you Yahoo!?
  Yahoo! Mail SpamGuard - Read only the mail you
 want. 
  http://antispam.yahoo.com/tools
  
 

-
  To unsubscribe, e-mail:
 [EMAIL PROTECTED]
  For additional commands, e-mail:
 [EMAIL PROTECTED]
  
 

-
  To unsubscribe, e-mail:
 [EMAIL PROTECTED]
  For additional commands, e-mail:
 [EMAIL PROTECTED]
  
 
 
 __
 Do you Yahoo!?
 Yahoo! Mail SpamGuard - Read only the mail you want.
 http://antispam.yahoo.com/tools
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED

RE: Must have action=..... in html:form tag?

2004-02-23 Thread Shyam A
Well, as the others said DispatchAction is the way to
go.

Since, you already have two separate Actions defined,
I thought it may be worthwhile to give my idea a try.

What I meant was, instead of a submit button
html:submit, use a normal button input
type=button. You can display a create or update
button based on the previous screen, i.e.

logic:equal name=formName property=whichAction
value =create
input type=button name=Create
onClick=submitForm 
/logic:equal

logic:equal name=formName property=whichAction
value =update
input type=button name=Update
onClick=submitForm 
/logic:equal

Then, in your submitForm() Javascript, check for which
button is clicked, or check for whichAction as you're
doin now, and set the action accordingly. (Sorry, I'm
not an expert in Javascript!)

HTH,
Shyam


--- Au-Yeung, Stella H [EMAIL PROTECTED]
wrote:
 Shyam:
 I am not sure what you mean, can you elaborate that?
 The current form only has one 'submit' button. 
 After the user fills in data
 on the current form, I want the data to be submitted
 to the DB and then
 automatically be taken back to the 'previous'
 screen.  This previous screen
 can be a 'Create main screen' or an 'Update main
 screen'.   I use a hidden
 field 'whichAction' to remember which is the
 'previous' screen.   So when
 the user submits the input data on the cuurrent
 form, that's when the
 javascript submitForm() function decides which
 screen
 (/app/fdd/shopWorkOrder/fromCreateShopWorkOrder or
 /app/fdd/shopWorkOrder/fromUpdateShopWorkOrder) to
 return to.
 
 Example:
 
 Create Main screen    use 'theForm' to input
 data    return
 back to Create main
 
 Update Main screen  - use 'theForm' to input
 data    return
 back to Update main
 
  (this screen 'theForm' is
 where I decide
   which precious screen to
 return
   to based on the hidden
 field whichAction.
   That's why form action
 has to be dynamic
 
 My user only wants ONE submit button on theForm
 and the application
 should be smart enough to return to the correct
 'previous' page.
 
 
 
 
 -Original Message-
 From: Shyam A [mailto:[EMAIL PROTECTED] 
 Sent: Monday, February 23, 2004 5:31 PM
 To: Struts Users Mailing List
 Subject: RE: Must have action=. in html:form
 tag?
 
 
 Just a suggestion. Not sure if I'm right...
 Instead of using onSubmit() event of your
 html:form,
 why don't you call the Javascript when the user
 clicks/submits the associcated HTML component -
 Create/Update button, and set the action
 accordingly.
 
 HTH,
 Shyam
 
 

__
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.
http://antispam.yahoo.com/tools

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: preview form

2004-02-16 Thread Shyam A
Maybe you can use a read-only text field to display
the selected value of the drop-down on your preview
page. You can get the label of the drop down in your
action class for Preview , and then set the form
bean property for the same. Also, use logic:equal on
your JSP to check for the user action, and display
drop-down or text field accordingly.

HTH,
Shyam

P.S.
Wonder if the 'newbie' has come of age?;)

--- Janice [EMAIL PROTECTED] wrote:
 Hi Gang,
 
 I have a form that the client would like to be
 'previewed' before users can
 submit.  The plan is to have a form with a button
 that takes the user to the
 exact same form, but with all the form elements set
 to readonly.  From there
 the user can go back to the editable form or can
 submit.
 
 At least that's the plan.  I'm open to other
 suggestions, especially of the
 'best practices' variety.
 
 I would have liked to display the form information
 on a non-form looking
 page, but the problem I have is the drop-downs which
 have a very different
 value from label.  I don't want the preview to
 display something like:
 person: 12353
 instead of
 person: Jane Doe
 
 So I guess I need the drop-downs, unless you all
 have a workaround?
 
 My immediate problem is that html:select / doesn't
 support readonly...
 what else can I do?
 
 TIA,
 JJ
 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



problem with indexed properties

2004-02-13 Thread Shyam A
Hello,

I'm trying to use indexed propeties in my form bean
(ActionForm) to handle an array of text fields
generated dynamically. Initially, I used a String[] to
hold the text field values, and had a problem when
validation errors occured in my validate() method,
i.e, the values of the text fields were not retained.

To work around that, I'm trying indexed properties,
but it has not helped my cause, only added to my
woes:(

With indexed properties, I don't seem to get the
values of the textfields in the form bean(I get a
NullPointerException on form submission). Also, the
values in the textfields are not retained on
validation errors.
When my JSP is displayed initially, I seem to get some
null/junk entries in the text fields.

I used the sample code from
http://marc.theaimsgroup.com/?l=struts-userm=104815589928698w=2
for my form bean.

So, in my ActionForm, I have

#
private List candList = new ArrayList(); //previoulsy
was String[]

public List getCandList() 
   {
  return candList;
   }

public void setCandList(List aCandList) 
   {
  candList = aCandList;
   }


public String getCandList(int index) 
   {
  while(index = candList.size()){

candList.add(new String());

}   
  return (String) candList.get(index);
   }


 public void setCandList(int index,String aCand) 
   {
  candList.set(index,aCand);
   }

-

I do not set candList=null in the reset() method.

In my Action class (DispatchAction), I have two
methods - get() and submit() corresponding to get
and submit requests on my JSP. In the get() method,
I tried populating the candList in my form bean with
dummy values, corresponding to the number of text
fields(obtained from database).

In my JSP, I use

html:text property=candList size=25
maxlength=25 indexed=true/

within a logic:iterate tag for a collection (of
business entities).


-
I guess there may be something wrong with the
getters/setters in my ActionForm, as my form bean
doesn't seem to get the user entered values in the
text fields.
Am I missing something in the reset() method?

Could somebody tell me what I'm doing wrong.

I'm not sure if the candList in my form bean should be
populated with dummy values in the get() method of my
Action class.

I tried in vain to find some good examples of form
beans with indexed properties..most of the examples
are for DynaActionForm, and I'm really strutting in
the dark:(

Any help/pointers will be greatly appreciated.


Thanks,
Shyam



__
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Array of text fields generated dynamically - struggling with indexed properties

2004-02-12 Thread Shyam A
Hello,

I'm trying to use indexed propeties in my form bean
(ActionForm) to handle an array of text fields
generated dynamically. Initially, I used a String[] to
hold the text field values, and had a problem when
validation errors occured in my validate() method,
i.e, the values of the text fields were not retained.

To work around that, I'm trying indexed properties,
but it has not helped my cause, only added to my
woes:(

With indexed properties, I don't seem to get the
values of the textfields in the form bean(I get a
NullPointerException on form submission). Also, the
values in the textfields are not retained on
validation errors.
When my JSP is displayed initially, I seem to get some
null/junk entries in the text fields.

I used the sample code from
http://marc.theaimsgroup.com/?l=struts-userm=104815589928698w=2
for my form bean.

So, in my ActionForm, I have

#
private List candList = new ArrayList(); //previoulsy
was String[]

public List getCandList() 
   {
  return candList;
   }

public void setCandList(List aCandList) 
   {
  candList = aCandList;
   }


public String getCandList(int index) 
   {
  while(index = candList.size()){

candList.add(new String());

}   
  return (String) candList.get(index);
   }


 public void setCandList(int index,String aCand) 
   {
  candList.set(index,aCand);
   }

-

I do not set candList=null in the reset() method.

In my Action class (DispatchAction), I have two
methods - get() and submit() corresponding to get
and submit requests on my JSP. In the get() method,
I tried populating the candList in my form bean with
dummy values, corresponding to the number of text
fields(obtained from database).

In my JSP, I use

html:text property=candList size=25
maxlength=25 indexed=true/

within a logic:iterate tag for a collection (of
business entities).


-
I guess there may be something wrong with the
getters/setters in my ActionForm, as my form bean
doesn't seem to get the user entered values in the
text fields.
Am I missing something in the reset() method?

Could somebody tell me what I'm doing wrong.

I'm not sure if the candList in my form bean should be
populated with dummy values in the get() method of my
Action class.

I tried in vain to find some good examples of form
beans with indexed properties..most of the examples
are for DynaActionForm, and I'm really strutting in
the dark:(

Any help/pointers will be greatly appreciated.


Thanks,
Shyam

--- Hubert Rabago [EMAIL PROTECTED] wrote:
 I don't have the code with me right now, but I
 learned to solve this with the
 sample code from:

http://www.developer.com/java/other/article.php/2233591
 
 On your html:text, you need to use the name and
 property attributes, and
 set indexed=true.
 
 This is an excerpt from the article.
 c:forEach var=lines
 items=${purchaseOrderBeanForm.map.lines} 
   TRTDhtml:text indexed=true name=lines
 property=partNumber//TD
   TDhtml:text indexed=true name=lines
 property=quantity//TD
   TDhtml:text indexed=true name=lines
 property=price//TD/TR
 /c:forEach
 
 You can also look at the nested tags and the
 tutorials from
 keyboardmonkey.com.
 
 --- Shyam A [EMAIL PROTECTED] wrote:
  Hubert, 
  Thanks again for your mail. I have not tried using
  mapped properties, instead I stuck to my original
 idea
  of using an array of text fields/hidden fields
 with
  corresponding String[] in my form bean.
  
  I have a problem with validating the array of text
  fields,i.e., if there is a validation error, the
  values entered in the text fields are not
 retained.
  
  Given below is the message I posted to
 'struts-user'.
  
  Do you think using indexed properties will help
 solve
  my problem? If yes, could you send a sample?
  
  Hope it is not a bother.
  
  Thanks,
  Shyam
  
 
 
  Hi,
  
  I use a String[] in my form bean to handle a
 dynamic
  array of text fields.
  
  In my ActionForm, I have
  
  private String[] candList;
  
  public String[] getCandList()
  {
  return candList;
  }
  
  public void setCandList(String[] aCandList)
  {
  candList = aCandList;
  }
  
  
  
  In my JSP, I use
  
  html:text property=candList size=25
  maxlength=25/ 
  
  within a logic:iterate tag.
  
  My problem is that when a validation error occurs
 in
  the validate() method of my form bean, the text
 fields
  are populated with junk values. The text fields do
 not
  retain the user entered values. However, the user
  entered values can be printed out in the
 validate()
  method.
  
  How do I work around this problem?
  
  Any help, suggestions/pointers will be greatly
  appreciated.
  
  Thanks,
  Shyam
  
  


__
Do you Yahoo!?
Yahoo! Finance: Get

Re: Array of text fields generated dynamically - validation problem

2004-02-08 Thread Shyam A
Hi,

I use a String[] in my form bean to handle a dynamic
array of text fields.

In my ActionForm, I have

private String[] candList;

public String[] getCandList()
{
return candList;
}

public void setCandList(String[] aCandList)
{
candList = aCandList;
}



In my JSP, I use

html:text property=candList size=25
maxlength=25/ 

within a logic:iterate tag.

My problem is that when a validation error occurs in
the validate() method of my form bean, the text fields
are populated with junk values. The text fields do not
retain the user entered values. However, the user
entered values can be printed out in the validate()
method.

How do I work around this problem?

Any help, suggestions/pointers will be greatly
appreciated.

Thanks,
Shyam



--- Shyam A [EMAIL PROTECTED] wrote:
 Hi,
 
 I have a scenario in my Struts application, where I
 have an array of text fields grouped by category on
 a
 JSP, and these are generated dynamically.
 
 eg.
 Category A
 text field 1
 text field 2
 text field 3
 
 Category B
 text field 1
 text field 2
 
 
 
 
 The issue here is how to handle the values of the
 text
 fields in my form bean. What I plan to do is to have
 a
 String array for the text fields, and also a
 corresponding array of hidden fields, to identify
 the
 category.
 
 Is this the best way to handle this situation?
 
 Any help/suggustions/pointers will be greatly
 appreciated.
 
 Thanks,
 Shyam
 
 
 __
 Do you Yahoo!?
 Yahoo! Finance: Get your refund fast by filing
 online.
 http://taxes.yahoo.com/filing.html
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Unable to redirect to error page in declarative Exception handling

2004-01-29 Thread Shyam A
Hi,

I use declarative Exception handling for my Struts
application in 2 places - struts-config.xml and
web.xml.

I use the following in my Struts-config.xml:

##
 global-exceptions
exception
key=error.exception
type=java.lang.Exception  
handler=dsap.application.action.DsapExceptionHandler
path=/error.jsp/

 /global-exceptions

###
In my Exception Handler class, I use - 
return new ActionForward(ae.getPath()) to redirect to
the error page.

Also,I have an error page defined in my web.xml
as follows:

error-page
 
exception-typejava.lang.Exception/exception-type 
  location/error.jsp/location
 /error-page


The error page, error.jsp is directly under the
application directory like the other JSPs.

However, my application is not redirected to the error
page - error.jsp, when there is an Exception like
NullPointerException.

Could somebody tell me what I'm doing wrong.

Any help would be greatly appreciated.

Thanks,
Shyam




__
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Configuring Struts applications on OC4J (Oracle 9i AS)

2004-01-23 Thread Shyam A
Hi,

I'm working on Struts applications that are deployed
on OC4J (Oracle 9i AS 1.0.2.2). 
I have deployed my applications under the directory
OC4J/home/applications directory and access those
using the default OC4J listener on port .

i.e, http://hostname:/appName/index.jsp.

Now, I need to modify my URL to include another
directory called test/prod.

eg: http://hostname:/test/appName/index.jsp

I have tried modifying the OC4J configuration files in
the OC4J/home/config directory to match the new
directory structure but it doesn't seem to work.

Does anybody have any experience working with OC4J?

Any help/pointers will be greatly appreciated.

Thanks,
Shyam



__
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[OT] Mailing large number of recipients

2003-12-04 Thread Shyam A
Hi,

I have a Struts application in which I need to send
email notification to a large number of recipients
based on a user action. Currently, I use the Java Mail
API and send emails from my application. I use a
single email with all recipients in the BCC field.

Although, this approach works reasonably well for
small numbers (around 100), it doesn't seem suitable
for mailing very large number of recipients (in the
order of 1000's). I'm not sure if the mailing process
can be done at the backend with Oracle 9i database,
using a stored procedure or a trigger.

Any ideas/suggestions/pointers will be greatly
appreciated.

Thanks,
Shyam

__
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [OT] Mailing large number of recipients

2003-12-04 Thread Shyam A
Kirk,

Thanks a lot for your suggestions. I will look into
JMS.
In my current approach, the process of sending the
mail is time consuming.I'm concerned that sending an
email to 1000's of recipients from my application
(using JMS, Thread etc) would clog my application
server (OC4J) and slow down its operation, which is
why I was wondering if it could be done at the
backend-Oracle 9i.

Thanks,
Shyam

--- Kirk Wylie [EMAIL PROTECTED] wrote:
 Shyam A wrote:
 
  Hi,
  
  I have a Struts application in which I need to
 send
  email notification to a large number of recipients
  based on a user action. Currently, I use the Java
 Mail
  API and send emails from my application. I use a
  single email with all recipients in the BCC
 field.
  
  Although, this approach works reasonably well for
  small numbers (around 100), it doesn't seem
 suitable
  for mailing very large number of recipients (in
 the
  order of 1000's). I'm not sure if the mailing
 process
  can be done at the backend with Oracle 9i
 database,
  using a stored procedure or a trigger.
 
 What specifically is taking a long time? Is it the
 generation of the 
 email, or its sending? Because most email servers
 should make sending 
 such a message quite quick as they're doing the
 actual caching and 
 sending to multiple recipients.
 
 But in general, you might look into JMS for this
 type of thing (i.e. 
 some way to background process an operation),
 since it's the standard 
 J2EE way to do asynchronous event management like
 this.
 
 An alternative which is a little messier, but is
 probably quicker to do, 
 is to have a thread-based operation which you kick
 off in your Action 
 class immediately before returning from
 execute(...). It would then 
 create and send the email. In this case you would
 return control to the 
 user (who's the one who caused the mass email to
 kick off) immediately, 
 and background-process the emails. The major
 problems here are:
 1) There are better ways to do this (i.e. JMS
 and/or message driven beans)
 2) You're potentially creating a large number of
 threads if this is 
 happening on a regular basis. But if it is, that's
 even more reason to 
 use JMS or a commercial bulk emailing system (where
 bulk != spam)
 3) You can't provide immediate feedback to the user
 about the status of 
 the mail job because it's happening in the
 background.
 4) Because it's not transactional (unlike JMS), you
 might lose the 
 email if there's a failure.
 
 Kirk Wylie
 M7 Corporation
 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [OT] Mailing large number of recipients

2003-12-04 Thread Shyam A
Kirk, Brice and Elio,

Thanks a lot for pointing me in the right direction. I
really appreciate it!

Shyam

--- Kirk Wylie [EMAIL PROTECTED] wrote:
 Shyam A wrote:
 
  Kirk,
  
  Thanks a lot for your suggestions. I will look
 into
  JMS.
  In my current approach, the process of sending the
  mail is time consuming.I'm concerned that sending
 an
  email to 1000's of recipients from my application
  (using JMS, Thread etc) would clog my application
  server (OC4J) and slow down its operation, which
 is
  why I was wondering if it could be done at the
  backend-Oracle 9i.
 
 No doubt, there's a way to do it using PL/SQL or
 some type of 
 server-side Java in O9i, but then we're getting so
 far OT that I 
 wouldn't have the first idea on how you would do
 that.
 
 But using something like JMS would actually allow
 much better 
 scalability on your application as a whole:
 1) The DB is usually the most overloaded part of a
 major application, 
 and your DBAs will probably be MOST unhappy if they
 find out you're 
 sending bulk email on your database server.
 2) If you start overloading the database server, the
 whole application 
 will slow down anyway, as well as any other
 applications running on the 
 database server. Not such a great idea.
 3) The application server tier is much more
 naturally horizontally 
 scalable, meaning it's easier to setup a horizontal
 cluster of idential 
 application server nodes (either in a true cluster
 or just as a 
 load-balanced farm).
 4) If you really have this one problem (which is
 that this one task is 
 really computational), JMS is the way to go, because
 you can setup a 
 separate application server instance with ONLY that
 queue processing 
 ocurring on it and thus offload all the work from
 the rest of the system.
 
 #4 is the kicker with the JMS approach. In essence
 you're creating a 
 mail server (har har) which only does this one task.
 
 But I think that Brice has the right idea here: it
 sounds like what you 
 really need is a better email server. There's no
 excuse for a mail 
 server that isn't horribly overburdened or remote
 taking a long time to 
 respond to a large batch email like this. If yours
 is (perhaps because 
 you're using your corporate email server as a bulk
 SMTP gateway), ask 
 your IT staff if you can setup a postfix (my
 favorite for this stuff) or 
 sendmail system on a cheap Linux box to do SMTP
 gateway for you, because 
 they'll handle this without even a murmur.
 
 Kirk Wylie
 M7 Corporation
 
 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: request.setAttribute

2003-11-28 Thread Shyam Krishnan
Why you are putting it into the request yaar??
U can put it into the session..

Regards,
Shyam




Honza Spurný [EMAIL PROTECTED] 
11/28/03 05:10 PM
Please respond to
Struts Users Mailing List [EMAIL PROTECTED]


To
[EMAIL PROTECTED]
cc

Subject
request.setAttribute






Hi there,

I have small problem with adding some objects to the request. I need to
store quite huge object into request variable

MyObject o = new MyObject();
o.setObjectName(name);
request.setAttribute(myObejct, o);

These are correct steps how to make it, aren't they? But the object 
MyObject
is really huge. Is it possible, tak the huge objects are not store into
request variable? Because when I store there object that surely exists, 
and
then I call

MyObject o2 = (MyObject)request.getAttribute(o);
if (o2 == null) System.out.println(NULL);
else System.out.println(o.getObjectName());

I always get NULL on output.

Can be there problem with the size of such object?

Thanks
Sporak


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Lazy questions on this list

2003-11-20 Thread Shyam A
Well, a list meant exclusively for newbies doesn't
serve the purpose as we will miss the expert advice
and words of wisdom of the experienced Struts gurus on
this list!!

Shyam,
(eternally newbie!)


--- Linda Coleman [EMAIL PROTECTED] wrote:
 Would it be possible to create a newbie list? As a
 newbie I would much 
 rather read  post messages on a list targeted to
 people just starting out.
 A lazy question to experienced developer could be a
 valid newbie question...
 
 L:)
 
 
 Paul McCulloch wrote:
 
 Is it my imagination or are the number of downright
 lazy requests to this
 list getting worse?
 
 If the only replies any lazy questions ever got was
 http://www.catb.org/~esr/faqs/smart-questions.html
 then maybe people would
 get the point. Has anyone got any other ideas about
 how we can reduce the
 amount of lazy and totally off-topic posts to the
 list?
 
 
 Paul
 
 
 
 **
 Axios Email Confidentiality Footer
 Privileged/Confidential Information may be
 contained in this message. If you are not the
 addressee indicated in this message (or responsible
 for delivery of the message to such person), you may
 not copy or deliver this message to anyone. In such
 case, you should destroy this message, and notify us
 immediately. If you or your employer does not
 consent to Internet email messages of this kind,
 please advise us immediately. Opinions, conclusions
 and other information expressed in this message are
 not given or endorsed by my Company or employer
 unless otherwise indicated by an authorised
 representative independent of this message.
 WARNING:
 While Axios Systems Ltd takes steps to prevent
 computer viruses from being transmitted via
 electronic mail attachments we cannot guarantee that
 attachments do not contain computer virus code.  You
 are therefore strongly advised to undertake anti
 virus checks prior to accessing the attachment to
 this electronic mail.  Axios Systems Ltd grants no
 warranties regarding performance use or quality of
 any attachment and undertakes no liability for loss
 or damage howsoever caused.
 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 
   
 
 
 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Lazy questions on this list

2003-11-20 Thread Shyam A
Well, a newbie like me is happy as long as I know I'm
not fishing in troubled waters:)

--- Larry Meadors [EMAIL PROTECTED] wrote:
 I agree.
 
 At the same time I do not think that How do I
 deprecate a method? or
 What is JSTL? kinds of questions should be
 answered with anything more
 involved than a link or reference to google.
 
 Remember the parable about giving a man a fish vs.
 teaching him how to
 fish? As long as these questions are answered, they
 will continue to be
 asked. 
 
 Larry
 
  [EMAIL PROTECTED] 11/20/03 10:03 AM 
 Well, a list meant exclusively for newbies doesn't
 serve the purpose as we will miss the expert advice
 and words of wisdom of the experienced Struts gurus
 on
 this list!!
 
 Shyam,
 (eternally newbie!)
 
 
 --- Linda Coleman [EMAIL PROTECTED] wrote:
  Would it be possible to create a newbie list? As a
  newbie I would much 
  rather read  post messages on a list targeted to
  people just starting out.
  A lazy question to experienced developer could be
 a
  valid newbie question...
  
  L:)
  
  
  Paul McCulloch wrote:
  
  Is it my imagination or are the number of
 downright
  lazy requests to this
  list getting worse?
  
  If the only replies any lazy questions ever got
 was
 
 http://www.catb.org/~esr/faqs/smart-questions.html
  then maybe people would
  get the point. Has anyone got any other ideas
 about
  how we can reduce the
  amount of lazy and totally off-topic posts to the
  list?
  
  
  Paul
  
  
  
  **
  Axios Email Confidentiality Footer
  Privileged/Confidential Information may be
  contained in this message. If you are not the
  addressee indicated in this message (or
 responsible
  for delivery of the message to such person), you
 may
  not copy or deliver this message to anyone. In
 such
  case, you should destroy this message, and notify
 us
  immediately. If you or your employer does not
  consent to Internet email messages of this kind,
  please advise us immediately. Opinions,
 conclusions
  and other information expressed in this message
 are
  not given or endorsed by my Company or employer
  unless otherwise indicated by an authorised
  representative independent of this message.
  WARNING:
  While Axios Systems Ltd takes steps to prevent
  computer viruses from being transmitted via
  electronic mail attachments we cannot guarantee
 that
  attachments do not contain computer virus code. 
 You
  are therefore strongly advised to undertake anti
  virus checks prior to accessing the attachment to
  this electronic mail.  Axios Systems Ltd grants no
  warranties regarding performance use or quality of
  any attachment and undertakes no liability for
 loss
  or damage howsoever caused.
  
  
 

-
  To unsubscribe, e-mail:
  [EMAIL PROTECTED]
  For additional commands, e-mail:
  [EMAIL PROTECTED]
  
  

  
  
  
  
 

-
  To unsubscribe, e-mail:
  [EMAIL PROTECTED]
  For additional commands, e-mail:
  [EMAIL PROTECTED]
  
 
 
 __
 Do you Yahoo!?
 Free Pop-Up Blocker - Get it now
 http://companion.yahoo.com/
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Array of html:checkbox / html:multibox not retaining state after validation

2003-11-18 Thread Shyam A
Hi,

I have a scenario where I have an array of checkboxes
along with other data displayed in a table format on a
JSP. I have to keep track of which checkbox is checked
or unchecked when a user submits the form. I use the
validate() method of my ActionForm to do validation.
However, the values of the checkboxes are not retained
when a validation error occurs.

I have tried the following in vain:

a. Array of html:checkbox
   I have used a boolean array for the form data type
corresponding to the checkbox. Also, I set all the
values of the boolean array to false in the reset()
method.

b. Array of html:multibox
In this case, I have a String array for the form
data type, and the array is not populated initially.
The value of the html:multibox is obtained from a
bean stored in the session, i.e

html:multibox property=formProperty
value=%=someValue%
/html:multibox

which is inside a logic:iterate loop.

Also, in the reset method of the form, I set the value
of the String array to null (this has worked for me
in the past). I'm not sure how to set the array length
to 0. 

Unfortunately, both of the above approaches don't help
in retaining the states of the checkboxes when a
validation error occurs.

I also tried using Javascript to populate a hidden
variable with the values of the checkboxes on form
submission, and setting the checkbox array with the
hidden variable array when a validation error occurs.
This didn't work either.

Could somebody tell me what I'm doing wrong?

Any help/pointers will be greatly appreciated.

Thanks,
Shyam








__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [OT] Handling database connection exceptions

2003-11-17 Thread Shyam A
Wendy,

Thanks for your mail. I don't know if you fully
understood where I'm coming from! As I said, the
database connection is accessed from a Data Access
class (read model), which is called from my
DispatchAction class. Since the exception is not
caught in my DispatchAction class (the methods throw
Exception), it is propagated to my JSP's. It doesn't
mean my JSP's directly access the database!

Anyway, thanks for your help.

Shyam


--- Wendy Smoak [EMAIL PROTECTED] wrote:
  I have a Database servlet configured in web.xml,
 which
  intialises a connection pool on Server startup.
  However, if the data source is unavailable, I get
 a
  Null Pointer exception on my JSPs, which is
  propagated from my Data Access class.
 
 IMO, the problem is that you're accessing the
 database from the JSP.
 And this, in a Struts webapp?!  The view has no
 business talking to the
 model.
 
 If you move the data access to the Action, then you
 can catch the error
 and gracefully forward to an error page.
 
 Meanwhile, you can define error pages in web.xml so
 that your users
 don't see the stack trace.  For example, I have
 this:
error-page
  

exception-typejavax.servlet.ServletException/exception-type
  

location/WEB-INF/jsp/exceptionServlet.jsp/location
/error-page
 which gives the user an apology and a phone number
 to call.
 
 -- 
 Wendy Smoak
 Applications Systems Analyst, Sr.
 Arizona State University, PA, IRM 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [OT] Handling database connection exceptions

2003-11-17 Thread Shyam A
Richard,

Thanks for your mail. I am pretty sure I don't access
the database in my JSP's. I also use the errorPage
attribute for all my JSP's, however, it does not
handle Null Pointer exceptions that occur due to
problems with database connection.

Given below is the Exception trace...it occurs when I
try to logon to my application when my database is
down. Btw, I use an Action class for processing user
login. (I use DispatchAction class for all other
operations)

##
500 Internal Server Error
java.lang.NullPointerException
at
obs.business.UserLogin.checkLogin(UserLogin.java:192)
at
obs.application.LoginController.checkLogin(LoginController.java:37)
at
obs.application.action.LoginAction.perform(LoginAction.java:91)
at
org.apache.struts.action.Action.execute(Action.java:415)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:465)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:523)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:211)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
at com.evermind[Oracle9iAS (1.0.2.2) Containers for
J2EE].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:501)
at com.evermind[Oracle9iAS (1.0.2.2) Containers for
J2EE].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:170)
at com.evermind[Oracle9iAS (1.0.2.2) Containers for
J2EE].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:576)
at com.evermind[Oracle9iAS (1.0.2.2) Containers for
J2EE].server.http.HttpRequestHandler.run(HttpRequestHandler.java:189)
at com.evermind[Oracle9iAS (1.0.2.2) Containers for
J2EE].util.ThreadPoolThread.run(ThreadPoolThread.java:62)

###

As you would notice above, the Exception is propagated
from a class in the model - UserLogin.
I noticed that the UserLogin class catches only
SQLException, which is why I guess the NullPointer
exception is propagated to my Action class. Again, the
perform() method of the Action class throws
Exception but does not catch it.

What do you think would be a graceful solution to this
problem? Pardon my ignorance!

Thanks,
Shyam


--- Yee, Richard K,,DMDCWEST
[EMAIL PROTECTED] wrote:
 Shyam,
 Where in your JSP does the NullPointerException
 occur? Is it in a method
 call in a scriptlet? If so, your JSP is still
 indirectly accessing the
 database. What Wendy suggested was that the the
 database access class be
 invoked from your DisplactAction class and the
 results be put in a
 collection and set as an attribute in the request.
 That way, any problems
 with getting the data would be caught in your Action
 class and then you
 could forward to an error page.
 
 Otherwise, why can't you just specify an error page
 using the errorPage
 attribute in your JSP's [EMAIL PROTECTED] ... tag?
 
 -Richard
 
 -Original Message-
 From: Shyam A [mailto:[EMAIL PROTECTED] 
 Sent: Monday, November 17, 2003 3:10 PM
 To: Struts Users Mailing List
 Cc: [EMAIL PROTECTED]
 Subject: RE: [OT] Handling database connection
 exceptions
 
 
 Wendy,
 
 Thanks for your mail. I don't know if you fully
 understood where I'm coming from! As I said, the
 database connection is accessed from a Data Access
 class (read model), which is called from my
 DispatchAction class. Since the exception is not
 caught in my DispatchAction class (the methods throw
 Exception), it is
 propagated to my JSP's. It doesn't mean my JSP's
 directly access the
 database!
 
 Anyway, thanks for your help.
 
 Shyam
 
 
 --- Wendy Smoak [EMAIL PROTECTED] wrote:
   I have a Database servlet configured in web.xml,
  which
   intialises a connection pool on Server startup.
   However, if the data source is unavailable, I
 get
  a
   Null Pointer exception on my JSPs, which is
   propagated from my Data Access class.
  
  IMO, the problem is that you're accessing the
  database from the JSP.
  And this, in a Struts webapp?!  The view has no
  business talking to the
  model.
  
  If you move the data access to the Action, then
 you
  can catch the error
  and gracefully forward to an error page.
  
  Meanwhile, you can define error pages in web.xml
 so
  that your users
  don't see the stack trace.  For example, I have
  this:
 error-page
   
 

exception-typejavax.servlet.ServletException/exception-type
   
 

location/WEB-INF/jsp/exceptionServlet.jsp/location
 /error-page
  which gives the user an apology and a phone number
  to call.
  
  --
  Wendy Smoak
  Applications Systems Analyst, Sr.
  Arizona State University, PA, IRM

RE: [OT] Handling database connection exceptions

2003-11-17 Thread Shyam A
Richard,

I use Struts 1.1.Thanks for your help...I finally
found what I was looking for.

Shyam

--- Yee, Richard K,,DMDCWEST
[EMAIL PROTECTED] wrote:
 Shyam,
 Are you using Struts 1.0 or 1.1? It seems that you
 are using Struts 1.0. If
 not, then you can combine my suggestion with what
 Vic suggested and define
 an exception handler for your
 DatabaseUnavailableException instead of
 catching it in the perform() method. This would
 enable all of your pages to
 handle this the condition where your data access
 layer can't connect to a
 database.
 

http://jakarta.apache.org/struts/userGuide/building_controller.html#exceptio
 n_handler
 
 -Richard
 
 
 -Original Message-
 From: Yee, Richard K,,DMDCWEST
 [mailto:[EMAIL PROTECTED] 
 Sent: Monday, November 17, 2003 4:07 PM
 To: 'Struts Users Mailing List'
 Subject: [OT] Handling database connection
 exceptions
 
 
 Shyam,
 This problem is not happing in your JSP. According
 to your stack trace, it
 happens in

obs.business.UserLogin.checkLogin(UserLogin.java:192)
 which is
 being called in your LoginAction.perform().
 
 I think you should translate the
 NullPointerException generated in your
 checkLogin method to a more meaningful exception
 (ie.
 DatabaseUnavailableException) and catch it in your
 perform() method. You can
 then redirect to an error page from there.
 
 -Richard
 
 
 
 500 Internal Server Error
 java.lang.NullPointerException
   at

obs.business.UserLogin.checkLogin(UserLogin.java:192)
 
 -Original Message-
 From: Shyam A [mailto:[EMAIL PROTECTED] 
 Sent: Monday, November 17, 2003 3:53 PM
 To: Struts Users Mailing List
 Cc: [EMAIL PROTECTED]
 Subject: RE: [OT] Handling database connection
 exceptions
 
 
 Richard,
 
 Thanks for your mail. I am pretty sure I don't
 access
 the database in my JSP's. I also use the errorPage
 attribute for all my JSP's, however, it does not
 handle Null Pointer exceptions that occur due to
 problems with database connection.
 
 Given below is the Exception trace...it occurs when
 I
 try to logon to my application when my database is
 down. Btw, I use an Action class for processing user
 login. (I use DispatchAction class for all other
 operations)
 
 ##
 500 Internal Server Error
 java.lang.NullPointerException
   at

obs.business.UserLogin.checkLogin(UserLogin.java:192)
   at

obs.application.LoginController.checkLogin(LoginController.java:37)
   at

obs.application.action.LoginAction.perform(LoginAction.java:91)
   at

org.apache.struts.action.Action.execute(Action.java:415)
   at

org.apache.struts.action.RequestProcessor.processActionPerform(RequestProces
 sor.java:465)
   at

org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
   at

org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
   at

org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:523)
   at

javax.servlet.http.HttpServlet.service(HttpServlet.java:211)
   at

javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
   at

javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
   at com.evermind[Oracle9iAS (1.0.2.2) Containers for

J2EE].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.j
 ava:501)
   at com.evermind[Oracle9iAS (1.0.2.2) Containers for

J2EE].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDis
 patcher.java:170)
   at com.evermind[Oracle9iAS (1.0.2.2) Containers for

J2EE].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:
 576)
   at com.evermind[Oracle9iAS (1.0.2.2) Containers for

J2EE].server.http.HttpRequestHandler.run(HttpRequestHandler.java:189)
   at com.evermind[Oracle9iAS (1.0.2.2) Containers for

J2EE].util.ThreadPoolThread.run(ThreadPoolThread.java:62)
 
 ###
 
 As you would notice above, the Exception is
 propagated
 from a class in the model - UserLogin.
 I noticed that the UserLogin class catches only
 SQLException, which is why I guess the
 NullPointer exception is
 propagated to my Action class. Again, the
 perform() method of the Action class throws
 Exception but does not catch it.
 
 What do you think would be a graceful solution to
 this
 problem? Pardon my ignorance!
 
 Thanks,
 Shyam
 
 
 --- Yee, Richard K,,DMDCWEST
 [EMAIL PROTECTED] wrote:
  Shyam,
  Where in your JSP does the NullPointerException
  occur? Is it in a method
  call in a scriptlet? If so, your JSP is still
  indirectly accessing the
  database. What Wendy suggested was that the the
  database access class be
  invoked from your DisplactAction class and the
  results be put in a
  collection and set as an attribute in the request.
  That way, any problems
  with getting the data would be caught in your
 Action
  class and then you
  could forward to an error page.
  
  Otherwise, why can't you just specify an error
 page
  using the errorPage
  attribute

simple question

2003-11-13 Thread Shyam A
Hi,

Is there any Struts tag for an expression like

%= request.getAttribute(attributeName)%

where the attribute is a String.

Thanks,
Shyam

__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



indexId attribute of logic:iterate tag

2003-11-13 Thread Shyam A
Hi,

I have a JSP page in which I display the results of a
database query in a table format using logic:iterate
tag for a bean. I want to display the number of the
table row using the indexId attribute of the
logic:iterate tag. The index starts from 0 but I
want to display the records starting from 1. I have
been unsuccessful at my initial attempts in
manipulating the indexId to work the way I want.

Any suggestions?

Thanks,
Shym 

__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Passing parameters between forms

2003-10-14 Thread Shyam A
Carey,

Thanks for your mail. I knew about the option you
suggested and mentioned it in my mail.

quote:

I know I can save the foo attribute into session in
Action A class and access it in Action B, or set the
scope of Form A to session in struts-config and access
Form A from Action B.

unquote:

However, the disadvantage of this option is that I
need to use session scope for the forms, which I would
like to avoid.

I also know it is possible to pass the form attribute
as a request parameter as follows:

html:link page=Action B?parameter=value

But, this allows the user to see the parameters being
passed. I would rather use buttons for the link and
post the form.

Do you have any suggestions/comments?

Thanks,
Shyam


--- Carey Nation [EMAIL PROTECTED] wrote:
 I have some vague memory (perhaps completely wrong)
 that the forms are
 stored wherever they are stored using the names that
 you specify in
 struts-config.  It may not be the nicest way to do
 this, but I'm pretty sure
 that, given session scope on your forms, you can do
 something like
 (FormA)forma = session.getAttribute(FormA);
 
 HTH,
 Carey
 
 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 


__
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Passing parameters between forms

2003-10-13 Thread Shyam A
Hi,

I have a scenario where I need to pass parameters
between forms.i.e, I have two forms, Form A and Form B
with the same attribute foo. The value of foo is
set in Form A. Also, I have a link from the JSP page
corresponding to Form A to the action corresponding to
Form B,i.e,  

In form A, I have

html:form action=/Action A
html:text property=foo/
...

html:link forward=Action B
bean:message key=key/
/html:link
/html:form

I'm unable to access the foo property in Action B
class using 
String foo = ((Form B) form).getFoo() as foo is not
in scope.

I know I can save the foo attribute into session in
Action A class and access it in Action B, or set the
scope of Form A to session in struts-config and access
Form A from Action B.

Is there a better way to do this?

Any help/suggestions would be greatly appreciated.

Thanks,
Shyam


__
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Forwarding to URL from DispatchAction class - any takers?

2003-08-14 Thread Shyam A
Hi,

I have tried in vain to find a solution to my issue
and didn't find anything useful in the mailing list
archives.

So, I'm posting it again. Could somebody help?

Here goes
 
I have an application that is accessed from another
application and I need to return a user to the
original application when the user logs out/times
out of my application.
 
I always get a HTTP - Bad Request error when I try
to forward to a URL from my DispatchAction class. I
have tried defining the URL path as a global forward
in my struts-config:

forward   name=login path=http://...; /,

and used the following code in the Action class
methods:
 
 return (servlet.findForward(login));
 
Also, I get the same result if I define the URL as a
constant and use the code below:

 return (new ActionForward(Constants.URL));
 
The reason I guess is that the ActionForward object
uses a relative path and inserts a / at the
beginning of the URL.

I have also tried in vain using
response.sendRedirect(URL).

response.sendRedirect() does not redirect the user to
the URL, instead control goes to the next statement in
my DispatchAction class method.

I'm not sure if this is an Application Server issue...
I use OC4J, the application server that comes with
Oracle9iAS (1.0.2.2).

Is there any solution to this problem? 
 
Any help would be greatly appreciated.
 
Thanks,
Shyam


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [newbie]: forwarding to a URL from Action class - 2nd post

2003-08-14 Thread Shyam A

Hello,

Thanks for your mail. I have defined the path for the
URL in the global forwards :

forward   name=login 
path=http://xxx.edu:8025/pls/TEST/twbkwbis.P_WWWLogin/

As I mentioned, the ActionForward object adds a / to
the path and the browser returns a HTTP - Bad
Request error message.

Is there a way to solve this problem??


Thanks,
Shaym

--- Sachin [EMAIL PROTECTED] wrote:
 Actually your forwards should be part of your
 mapping object
 
 but you are trying to pass forward with matching of
 it in
 struts-config.xml..
 
 So it oyu should define it in global forwards so
 that mapping will get That
 URL...
 
 Thanks
 Sachin
 
 -Original Message-
 From: Shyam A [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, August 06, 2003 9:49 PM
 To: [EMAIL PROTECTED]
 Subject: [newbie]: forwarding to a URL from Action
 class
 
 
 Hi,
 
 I have an application that is accessed from another
 application and I need to return a user to the
 original application when the user logs out/times
 out
 of my application.
 
 I always get a HTTP - Bad Request error when I try
 to forward to a URL from my DispatchAction class. I
 have tried defining the URL in my struts-config and
 used the following code in the Action class methods:
 
 return (servlet.findForward(login));
 
 Also, I get the same result if I define the URL as a
 constant and use the code below:
 
 return (new ActionForward(Constants.URL));
 
 The reason I guess is that the ActionForward object
 uses a relative path and inserts a / at the
 beginning of the URL.
 
 Any help would be greatly appreciated.
 
 Thanks,
 Shyam
 
 
 __
 Do you Yahoo!?
 Yahoo! SiteBuilder - Free, easy-to-use web site
 design software
 http://sitebuilder.yahoo.com
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 
 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[newbie]: forwarding to a URL from Action class

2003-08-14 Thread Shyam A
Hi,

I have an application that is accessed from another
application and I need to return a user to the
original application when the user logs out/times out
of my application.

I always get a HTTP - Bad Request error when I try
to forward to a URL from my DispatchAction class. I
have tried defining the URL in my struts-config and
used the following code in the Action class methods:

return (servlet.findForward(login));

Also, I get the same result if I define the URL as a
constant and use the code below:

return (new ActionForward(Constants.URL));

The reason I guess is that the ActionForward object
uses a relative path and inserts a / at the
beginning of the URL.

Any help would be greatly appreciated.

Thanks,
Shyam


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[newbie]: forwarding to a URL from Action class - any takers?

2003-08-11 Thread Shyam A
Hi,
 
I have an application that is accessed from another
application and I need to return a user to the
original application when the user logs out/times
out of my application.
 
I always get a HTTP - Bad Request error when I try
to forward to a URL from my DispatchAction class. I
have tried defining the URL path as a global forward
in my struts-config:

forward   name=login path=http://...; /,

and used the following code in the Action class
methods:
 
 return (servlet.findForward(login));
 
Also, I get the same result if I define the URL as a
constant and use the code below:

 return (new ActionForward(Constants.URL));
 
The reason I guess is that the ActionForward object
uses a relative path and inserts a / at the
beginning of the URL.

I have also tried in vain using
response.sendRedirect(URL).

response.sendRedirect() does not redirect the user to
the URL, instead control goes to the next statement in
my DispatchAction class method.

I'm not sure if this is an Application Server issue...
I use OC4J, the application server that comes with
Oracle9iAS (1.0.2.2).

Is there any solution to this problem? 
 
Any help would be greatly appreciated.
 
Thanks,
Shyam
 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[newbie]: Accessing labelProperty in html:options

2003-07-21 Thread Shyam A
Hi,

I'm using the html:options tag to populate a
drop-down list from a collection.

My code is as follows:

html:select property=termCode
onchange=submitForm(this.form) html:options
collection=termList property=value
labelProperty=label/
/html:select

The property termCode is a string in my ActionForm
class. I would like to access the selected value in
the drop-down, i.e, labelProperty in my ActionClass.
I'm not sure how it is done.

Any help would be greatly appreciated.

Thanks,
Shyam

__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [newbie]: Accessing labelProperty in html:options

2003-07-21 Thread Shyam A
Amit,

Sorry, I overlooked your code and missed something. I
need to access both the termCode (property) and
name(labelProperty) in my action class.
Is there a way to do it?

Thanks,
Shyam

--- Amit Kirdatt [EMAIL PROTECTED] wrote:
 To access the selected value in your action class
 
 ((MyCodeForm)anActionForm).getTermCode()
 
 --Amit
 
 -Original Message-
 From: Amit Kirdatt 
 Sent: Monday, July 21, 2003 5:17 PM
 To: 'Struts Users Mailing List'
 Subject: RE: [newbie]: Accessing labelProperty in
 html:options 
 
 
 Do the following:
 
 html:select property=termCode
 onchange=submitForm(this.form) 
   html:options collection=termList
 property=label
 labelProperty=label/
 /html:select
 
 
 
 -Original Message-
 From: Shyam A [mailto:[EMAIL PROTECTED]
 Sent: Monday, July 21, 2003 3:04 PM
 To: [EMAIL PROTECTED]
 Subject: [newbie]: Accessing labelProperty in
 html:options 
 
 
 Hi,
 
 I'm using the html:options tag to populate a
 drop-down list from a collection.
 
 My code is as follows:
 
 html:select property=termCode
 onchange=submitForm(this.form)
 html:options
 collection=termList property=value
 labelProperty=label/
 /html:select
 
 The property termCode is a string in my ActionForm
 class. I would like to access the selected value in
 the drop-down, i.e, labelProperty in my ActionClass.
 I'm not sure how it is done.
 
 Any help would be greatly appreciated.
 
 Thanks,
 Shyam
 
 __
 Do you Yahoo!?
 SBC Yahoo! DSL - Now only $29.95 per month!
 http://sbc.yahoo.com
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 
 This e-mail, including attachments, may include
 confidential and/or
 proprietary information, and may be used only by the
 person or entity to
 which it is addressed. If the reader of this e-mail
 is not the intended
 recipient or his or her authorized agent, the reader
 is hereby notified that
 any dissemination, distribution or copying of this
 e-mail is prohibited. If
 you have received this e-mail in error, please
 notify the sender by replying
 to this message and delete this e-mail immediately.
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 
 This e-mail, including attachments, may include
 confidential and/or
 proprietary information, and may be used only by the
 person or entity to
 which it is addressed. If the reader of this e-mail
 is not the intended
 recipient or his or her authorized agent, the reader
 is hereby notified that
 any dissemination, distribution or copying of this
 e-mail is prohibited. If
 you have received this e-mail in error, please
 notify the sender by replying
 to this message and delete this e-mail immediately.
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: newbie question - setting form parameter in Javascript

2003-07-12 Thread Shyam A
Mark,
 
Thanks a lot for your mails. I have used action as a form bean property and not as a 
parameter in struts-config. Unfortunately, the Javascript function doesn't seem to 
work...it does not set the value of the ActionForm property, action. 
 When I tried to print out the value of the action property in my ActionClass,
I got a null value.
 
I tried the following code in my Action class and I got a null value.
String action = ((ActionForm) form).getAction();
 
Wonder if I have missed something.
 
Shyam

Mark Lowe [EMAIL PROTECTED] wrote:
Its better that this is posted to the list as well, after all its a 
good question and hopefully an adequate answer.


function lookup(form) {
form.elements['action'].value = lookup;
form.submit();
}
//--






...



 [input] 





//struts config

name=myForm redirect=false parameter=action /


The only thing you'd have to watch would be if the client didn't 
support javascript then you'd lose lookup, this would make a case for 
having action as a form bean property and have some relevantly named 
form elements in noscript tags. If lookup isn't mission critical then i 
guess you could let this slide.



On Friday, July 11, 2003, at 08:44 PM, Shyam A wrote:

 Mark,
  
 Thanks for your mail. I understand that DispatchAction class includes 
 multiple execute methods for different actions. However, I still have 
 some doubts.
  
 You mentioned using tags in JSP:
  
 

 
 Are these used instead of using Submit buttons ?
 i.e use and in conjunction instead 
 of  ?  Can 
 be used for a drop- down?
  
 I guess my problem is still unresolved. As I mentioned in my earlier 
 mail, I have a drop-down associated with an ActionForm property crn 
  .
 
None  
 
   
 I would like to trigger an action called Lookup when the drop-down 
 is clicked .i.e, associate the clicking of the drop-down with the 
 action property of the ActionForm class. I don't know how to set the 
 action property of the ActionForm class  when the drop-down is 
 selected, based on which appropriate method of the DispatchAction 
 class would be executed.
  
 Any help would be greatly appreciated.
  
 Thanks,
 Shyam
  
  


 Mark Lowe wrote:
 check out dispatch actions..

 you can have multiple execute methods with dispatch action ...

 Your Action class extends DispatchAction instead of action (check the
 docs)

 public final ActionForward submit(
 ActionMapping mapping,
 ActionForm form,
 HttpServletRequest request,
 HttpServletResponse response)

 throws Exception {
 ...
 }

 public final ActionForward lookup(
 ActionMapping mapping,
 ActionForm form,
 HttpServletRequest request,
 HttpServletResponse response)

 throws Exception {
 ...
 }

 in struts config the parameter attibute need to know the name of the
 parameter your about to send, the value of which is your execute method
 name..


 scope=request parameter=action
 ...

 and then in jsp






 HTH Mark


 On Friday, July 11, 2003, at 08:00 PM, Shyam A wrote:

  James,
 
  Thanks for your mail. I guess I need to elaborate a little bit. My
  HTML form can be submitted in 2ways.
  1. Clicking the Submit button.
  2. Clicking the drop-down
 
  Clicking the drop-down triggers a different action than clicking the
  Submit button.
  Selecting a value in the drop-down would submit the form and populate
  some of the other fields in the form. This is done before the 
 Submit
  button is clicked. So, I need to distinguish the action of clicking
  the drop-down from clicking the Submit button and I called it
  Lookup.
 
  Both actions would be identified with a single property in the
  ActionForm class - action.
 
  eg:
 
 
  I would like to set this action property value to Lookup on
  clicking the drop-down using Javascript. I guess a hidden field would
  not serve the purpose as I already have action property defined for
  the Submit button.
 
  Look forward to your help/suggestions.
 
  Thanks,
  Shyam
 
  James Mitchell wrote:
 
  You will need to create a hidden field named action, with a value 
 of
  Lookup:
 
 
 
  My question to you iswhy Lookup? What does that have to do with
  your
  form?
 
 
  Here's a sample:
 
 
  function submitForm(form) {
  form.action.value=Lookup;
  form.submit();
  return true;
  }
 
 
 
  [input]
  Test Test2
 
 
 
  On Friday 11 July 2003 14:15, Shyam A wrote:
  Hi,
 
  I have an HTML form with Submit and Cancel buttons, and a drop down
  list,
  which when clicked submits the form. I use Javascript to submit the
  form
  when the dropdown list is clicked. I have a property called action
  defined in my ActionForm class that identifies the Submit and Cancel
  buttons in the HTML form. When the drop-down is clicked, I would 
 like
  to
  set the value of this action property to Lookup.
 
  My Javascript function is given below:
 
  
 
 
  function submitForm(form)
  {
  form.action.value=Lookup;
  form.submit();
  return true;
  }
  #
 
  and I

newbie question - setting form parameter in Javascript

2003-07-11 Thread Shyam A
Hi,
 
I have an HTML form with Submit and Cancel buttons, and a drop down list, which when 
clicked submits the form. I use Javascript to submit the form when the dropdown list 
is clicked.
I have a property called action defined in my ActionForm class that identifies the 
Submit and Cancel buttons in the HTML form. When the drop-down is clicked, I would 
like to set the value of this action property to Lookup.
 
My Javascript function is given below:
 


SCRIPT language=JavaScript
function submitForm(form)
{
form.action.value=Lookup;
form.submit();
return true;
}
#
 
and I invoke this function in my HTML form as shown below:
 
#
 html:select property=crn onclick=submitForm(this.form)
   html:option value=Test selectedTest/html:option   
   /html:select 
###
 
But, the value of the property action is not set to Lookup.
 
Any help would be greatly appreciated.
 
Thanks,
Shyam


-
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

Re: newbie question - setting form parameter in Javascript

2003-07-11 Thread Shyam A
James,
 
Thanks for your mail. I guess I need to elaborate a little bit. My HTML form can be 
submitted in 2ways.
1. Clicking the Submit button.
2. Clicking the drop-down
 
Clicking the drop-down triggers a different action than clicking the Submit button.
Selecting a value in the drop-down would submit the form and populate some of the 
other fields in the form. This is done before the Submit button is clicked. So, I 
need to distinguish the action of clicking the drop-down from clicking the Submit 
button and I called it Lookup.
 
Both actions would be identified with a single property in the ActionForm class - 
action.
 
eg:
 html:submit property=action value=Submit/ 
 
I would like to set this action property value to Lookup on clicking the drop-down 
using Javascript. I guess a hidden field would not serve the purpose as I already have 
action property defined for the Submit button.
 
Look forward to your help/suggestions.
 
Thanks,
Shyam

James Mitchell [EMAIL PROTECTED] wrote:

You will need to create a hidden field named action, with a value of 
Lookup:



My question to you iswhy Lookup? What does that have to do with your 
form?


Here's a sample:


function submitForm(form) {
 form.action.value=Lookup;
 form.submit();
 return true;
}



 [input] 
 Test Test2



On Friday 11 July 2003 14:15, Shyam A wrote:
 Hi,

 I have an HTML form with Submit and Cancel buttons, and a drop down list,
 which when clicked submits the form. I use Javascript to submit the form
 when the dropdown list is clicked. I have a property called action
 defined in my ActionForm class that identifies the Submit and Cancel
 buttons in the HTML form. When the drop-down is clicked, I would like to
 set the value of this action property to Lookup.

 My Javascript function is given below:

 


 function submitForm(form)
 {
 form.action.value=Lookup;
 form.submit();
 return true;
 }
 #

 and I invoke this function in my HTML form as shown below:

 #
  
Test

 ###

 But, the value of the property action is not set to Lookup.

 Any help would be greatly appreciated.

 Thanks,
 Shyam


 -
 Do you Yahoo!?
 SBC Yahoo! DSL - Now only $29.95 per month!

-- 
James Mitchell
Software Developer/Struts Evangelist
http://www.struts-atlanta.org
678-910-8017
AIM:jmitchtx



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

 


-
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

[newbie]: Remving Form Bean from scope

2003-06-03 Thread Shyam Anand
Hi,

I'm not sure about the purpose of removing a form bean
from scope in an ActionClass after submitting a form,
as shown below:

##
 // Remove the obsolete form bean
if (mapping.getAttribute() != null) {

if (request.equals(mapping.getScope()))
   
request.removeAttribute(mapping.getAttribute());
else
   
session.removeAttribute(mapping.getAttribute());
#

What will happen if the form bean is not removed from
scope?  Does it affect concurrent access of the
corresponding web page in anyway?

Could somebody throw some light on the topic?

Thanks,
Shyam



__
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]