the easiest way is to create a <ajax> control which will be dynamically populated from the contents of the response
try
{
String sql_str=null;
sql_str=new String("INSERT INTO "+table+" VALUES('"+
<!-- lots of stuff goes here -->
")" );
}
insert_stmt = beginSimpleTransaction(sql_str);
if((response_string!=null)&&(insert_stmt==null) )
{
return "Jake Blues";
}
insert_stmt.execute();
}
catch ( java.sql.SQLException sqle )
{
if((sqle.getMessage().indexOf("PK")!=-1)||(sqle.getMessage().indexOf("Duplicate entry")!=-1))
{
insert_stmt.close();
conn.close(); //Close the insert handle
String return_from_update_response=null;
try
{ // we should be updating the record
return_from_update_response=updateSubmitWriType2(request,table,UNIQUE_ID,SOURCE,DESTINATION,TIMESTAMP,LOC_STATION,LOCATION_STATE,WRIMODE,TRIGGERTYPE,ENCRYPTSCHEME,DECRYPTSCHEME,MESSAGETYPE,CAR_USDOT_NO,IIT_CAR_NAME,TT_ID,TT_JURIS,TT_SELC,MDRIVER_LNAME,MDRIVER_FNAME,MDRIVER_PINID,MDRIVER_SDN,MDRIVER_24HRS,MDRIVER_MBU,CODRIVER_LNAME,CODRIVER_FNAME,CODRIVER_PINID,CODRIVER_SDN,CODRIVER_24HRS,CODRIVER_MBU,VT_GCW,VT_LIGHTING,VT_SFTY_BELT,TRANSPONDER_ID,ENCOUNTER_LAT,ENCOUNTER_LONG,GLOBALQUERYTYPE);
}
catch(Exception update_exception)
{
return "Jake Blues";
}
the next time mr healey's record is inserted you will see the error message "..Jake Blues.."
the SQLException allows us to either use SQLException.getMessage() or a custom message
the contents of the message are written by HttpServletResponse to the client
the client can then display those contents dynamically in a div tag or in any tag with jsp as I have done here in a td my jsp
<jsp:useBean id="axiomclient" scope="application" class="gov.fmcsa.wribosservice.client.AXIOMClient" />
<td width="77%" valign="center"><p><%=axiomclient.get_response_string()%> </p><p> </p></td>
this is a abbreivated form of what is currently implemented in code.. feel free to ping me offline for details
Martin Gainty
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.
> Date: Mon, 24 May 2010 09:22:00 -0700
> From: glassfish_at_javadesktop.org
> To: users_at_glassfish.dev.java.net
> Subject: EclipseLink - that's a little more information than I needed (in the log..)
>
> I've got a unique constraint on a couple of columns in a MySQL table which is accessed by a JSF/EJB/JPA app. When a user hits the constraint I detect the (soft) error and they get a nice little message on the screen to advise them on
> the error of their ways. What I'd like to do is to stop the vast amounts of output
> written to the server log for obvious reasons, I won't be able to spot the real
> problems from the "normal operation" situations. I'm aware of the log levels in
> admin console but would appreciate any advice on what exactly needs to be
> changed to get this under control.
>
> Thanks,
> Brendan.
>
> Here is just a mere few lines of output:
>
> WARNING: Local Exception Stack:
> Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.0.v20091127-r5931): org.eclipse.persistence.exceptions.DatabaseException
> Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'James-Healey' for key 'UNQ_players_0'
> Error Code: 1062
> Call: INSERT INTO players (email, dob, lastname, firstname, photo, birthcertificate, version, user) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
> bind => [james_at_james.com, 1998-08-12, Healey, James, null, null, 1, 1]
> Query: InsertObjectQuery(uk.co.sportquest.entities.Player[id=null])
> at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:324)
> at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:800)
> at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:866)
> at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:586)
> at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:529)
> at org.eclipse.persistence.internal.sessions.AbstractSession.executeCall(AbstractSession.java:914)
> at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:205)
> at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:191)
> at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.insertObject(DatasourceCallQueryMechanism.java:334)
> at org.eclipse.persistence.internal.queries.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:162)
> at org.eclipse.persistence.internal.queries.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:177)
> at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:461)
> [Message sent by forum member 'healeyb']
>
> http://forums.java.net/jive/thread.jspa?messageID=471223
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
_________________________________________________________________
Hotmail is redefining busy with tools for the New Busy. Get more from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2