Servlet Filters getting called twice
Hi,
I am debugging my way through a big project and I am noticing when a http requests comes in that some filters are being called twice.
I checked the web.xml and nothing funny there and I have checked the respective doFilter() implementations and nothing unusual there.
Any ideas?
Thanks.
Many reasons
1. Filters are chained - the code in doFilter() upto the call to chain.doFilter() is executed before the request reaches the destined endpoint (servlet/jsp).
Any code after the call to chain.doFilter() is executed after the endpoint (servlet/jsp) processes the request.
2. When the response is a redirect, it would cause the browser to send a new request transparently to the end user. This new request would also hit the filter as would be expected.
3. Filters can be used to intercept internal forwards and/or includes by indicating so in the web.xml. So when such an action happens a part of request processing, filters would be invoked.
cheers,
ram.
Similar Messages
-
Servlet doPost being called twice
Hello all,
I have a servlet that is being called twice. The servlet is used to direct the user to the next jsp. I have 4 JSPs that the user steps through to add a record to a database. The 1st JSP lists the records that they have and asks them to add, edit or delete. The servlet gets call to direct them to the next JSP that they enter the data (or update) on. It then calls a verification JSP so the user can verify the information before submitting it. If everything is fine they submit the data. This verification JSP calls the servlet that adds or updates the record in the database. The servlet then directs the user to a confirmation page that tells the user if the submit was successful or not.
Here is how the flow is:
servlet -->menu.jsp -->servlet -->add.jsp -->verification.jsp -->servlet -->confirmation.jsp
Everything is fine until the verification.jsp submits to the servlet. That's where the doPost gets called twice.
I have put System.outs in the servlet code to see how many times the doPost gets called. It gets called once for every JSP except the verification JSP. When the user submits the data, the servlet's doPost gets called twice therefore it tries to add the record twice.
Has anyone had this problem before? How do I fix it?
Any help would be greatly appreciated!!
TraceyHere is the output of the JSP that when submitted, calls the doPost twice:
<HTML>
<HEAD>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<TITLE>PreaPaid Legal Banner Verification</TITLE>
<script language="javascript">
function new_window(url){
link = window.open(url,"Link","toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width=650,height=450,left=50,top=50");
</script>
</HEAD>
<BODY>
<form name="myForm" action="/webapp/BannerTracker/BannerTrackingServlet" method="post">
<H3><font face="Arial">Banner Tracking Verification</font></H3>
<table BORDER=0 CELLSPACING=0 CELLPADDING=0 COLS=2 WIDTH=500><tr><td>
<font face="Arial" size=2>Below are the choices that you made for your image, size of the image and page to direct people to
when they click on your banner.
<br><br>If this is not what you would like, click the "Back" button to return to the Banner Selection page.
<br><br>You can click on the page link to view a sample of the age you have choosen.
</font></td></tr></table>
<P>
<font face="Arial" size=2>
<input type="hidden" name="cmd" value="doadd">
<input type="hidden" name="banname" value="yahoo">
<input type="hidden" name="banlogin" value="test">
<input type="hidden" name="banid" value="1">
<input type="hidden" name="bangname" value="difference">
<input type="hidden" name="bangsize" value="468x60">
<input type="hidden" name="banpage" value="go/test?:home">
<input type="hidden" name="session" value="PPL2P6LcONLiT45pSszZEb1GJ4HvRc5jQMDNPM8wCJ0rCZesD38oEZ4mC3KvCp8mDp00">
<input type="hidden" name="bangtype" value="gif">
<input type="hidden" name="banurl" value="<A HREF="http://www.prepaidlegal.com/go/test?banid=1&Assoc=test"><img src="http://www.prepaidlegal.com/html/buttonsdifference468x60.gif" border=0></A>">
<br><b>Banner name: </b>yahoo
<br><br><b>Page to be directed: </b>Your PPL Home Page
<br><br><b>Image selected: </b><img src=/html/buttons/difference468x60.gif >
<br><br><b>Copy the URL below to the banner source code.</b>
<br><br><img src="http://www.prepaidlegal.com/html/buttonsdifference468x60.gif " border=0>
</font>
<br><br>
<a><img src="/html/buttons/track_back.gif" border=0 onClick="window.history.back();"></a>
<input type=image src="/html/buttons/track_continue.gif" border=0 onClick="javascript:document.myForm.submit();">
</form>
</BODY>
</HTML>
Here is the doPost code from my servlet:
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
System.out.println("doPost called");
String next = "";
try
Command cmd = lookupCommand(req.getParameter("cmd"));
next = cmd.execute(req);
} catch (CommandException ce) {
req.setAttribute("javax.servlet.jsp.jspException", ce);
next = error;
} catch (SQLException se) {
req.setAttribute("javax.servlet.jsp.jspException", se);
next = error;
HttpSession mysession = req.getSession(true);
String session = String.valueOf(mysession.getAttribute("storedSession"));
if (session.equalsIgnoreCase("null"))
session = req.getParameter("session");
try
checkSession(session);
} catch (IOException ioe) {
System.err.println("Session exception: " + ioe.getMessage() + ".");
next = expire;
} else {
try
checkSession(session);
} catch (IOException ioe) {
System.err.println("Session exception: " + ioe.getMessage() + ".");
next = expire;
if ( session != null )
mysession.setAttribute("storedSession", session);
RequestDispatcher rd;
rd = getServletContext().getRequestDispatcher(jspdir + next);
rd.forward(req, res);
</code>
I hope this helps.
Tracey -
Why listener methods are getting called twice ?
Hi Group,
I have a doubt, i need to know logic behind it.
Lets consider, JComboBox,
For an item state change of JComboBox,
itemStateChanged method gets called twice.
Its similar with valueChanged getting called twice
on List Selection Event.
Why does it call twice ? Is there any way, I can
have invocation only once (except flagging mechanism)?
with regards,
vikram.http://java.sun.com/j2se/1.3/docs/api/java/awt/event/ItemListener.html
tells the following:
public void itemStateChanged(ItemEvent e)
Invoked when an item has been selected or deselected. The code written for this method performs the operations that need to occur when an item is selected (or deselected).
So the listener is notified for both items: losing and gaining selection.
If you are only interested in listening to either selection or deselection event you can check which was the cause for the method call by examing the ItemEvent parameter i.e. item_event.getStateChange() == ItemEvent.DESELECTED or ItemEvent.SELECTED and then decide whether you are interested in the event at all.
I don't know how to stop JComboBox from launching both select and deselected events. -
WDDOMODIFY is getting called twice.
Hi,
I am facing a problem where wddomodify is getting called twice when I am selecting a value from a drop down. While for other drop downs on the same view WDDOMODIFY is not even getting called. I would appreciate, if anyone of you can provide any info regarding the same.
Thanks,
VisheshDATA LO_ND_IMPORTING_CREATE TYPE REF TO IF_WD_CONTEXT_NODE.
DATA LO_EL_IMPORTING_CREATE TYPE REF TO IF_WD_CONTEXT_ELEMENT.
DATA LS_IMPORTING_CREATE TYPE WD_THIS->ELEMENT_IMPORTING_CREATE.
DATA LV_DOC_TYPE TYPE WD_THIS->ELEMENT_IMPORTING_CREATE-DOC_TYPE.
navigate from <CONTEXT> to <IMPORTING_CREATE> via lead selection
LO_ND_IMPORTING_CREATE = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_IMPORTING_CREATE ).
get element via lead selection
LO_EL_IMPORTING_CREATE = LO_ND_IMPORTING_CREATE->GET_ELEMENT( ).
get single attribute
LO_EL_IMPORTING_CREATE->GET_ATTRIBUTE(
EXPORTING
NAME = `DOC_TYPE`
IMPORTING
VALUE = LV_DOC_TYPE ).
DATA LO_ND_IF_EDITABILITY TYPE REF TO IF_WD_CONTEXT_NODE.
DATA LO_EL_IF_EDITABILITY TYPE REF TO IF_WD_CONTEXT_ELEMENT.
DATA LV_EDIT_SUB_TYPE TYPE WD_THIS->ELEMENT_IF_EDITABILITY-EDIT_SUB_TYPE.
DATA LV_EDIT_PARENT TYPE WD_THIS->ELEMENT_IF_EDITABILITY-EDIT_PARENT.
DATA LV_DROPDOWN TYPE REF TO CL_WD_DROPDOWN_BY_KEY.
DATA LV_INPUTFIELD TYPE REF TO CL_WD_INPUT_FIELD .
navigate from <CONTEXT> to <IF_EDITABILITY> via lead selection
LO_ND_IF_EDITABILITY = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_IF_EDITABILITY ).
get element via lead selection
LO_EL_IF_EDITABILITY = LO_ND_IF_EDITABILITY->GET_ELEMENT( ).
LO_EL_IF_EDITABILITY->GET_ATTRIBUTE( EXPORTING NAME = `EDIT_SUB_TYPE`
IMPORTING VALUE = LV_EDIT_SUB_TYPE ).
LO_EL_IF_EDITABILITY->GET_ATTRIBUTE( EXPORTING NAME = `EDIT_PARENT`
IMPORTING VALUE = LV_EDIT_PARENT ).
DATA LO_ND_FUNCTIONALITY TYPE REF TO IF_WD_CONTEXT_NODE.
DATA LO_EL_FUNCTIONALITY TYPE REF TO IF_WD_CONTEXT_ELEMENT.
DATA LS_FUNCTIONALITY TYPE WD_THIS->ELEMENT_FUNCTIONALITY.
DATA LV_OPTION_CHANGED TYPE WD_THIS->ELEMENT_FUNCTIONALITY-OPTION_CHANGED.
DATA LV_OPTION_SELECTED TYPE WD_THIS->ELEMENT_FUNCTIONALITY-OPTION_SELECTED.
navigate from <CONTEXT> to <FUNCTIONALITY> via lead selection
LO_ND_FUNCTIONALITY = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_FUNCTIONALITY ).
get element via lead selection
LO_EL_FUNCTIONALITY = LO_ND_FUNCTIONALITY->GET_ELEMENT( ).
get single attribute
LO_EL_FUNCTIONALITY->GET_ATTRIBUTE(
EXPORTING
NAME = `OPTION_CHANGED`
IMPORTING
VALUE = LV_OPTION_CHANGED ).
LO_EL_FUNCTIONALITY->GET_ATTRIBUTE(
EXPORTING
NAME = `OPTION_SELECTED`
IMPORTING
VALUE = LV_OPTION_SELECTED ).
DATA LO_EL_CONTEXT TYPE REF TO IF_WD_CONTEXT_ELEMENT.
DATA LS_CONTEXT TYPE WD_THIS->ELEMENT_CONTEXT.
DATA LV_SET_STATE TYPE WD_THIS->ELEMENT_CONTEXT-SET_STATE.
get element via lead selection
LO_EL_CONTEXT = WD_CONTEXT->GET_ELEMENT( ).
get single attribute
LO_EL_CONTEXT->GET_ATTRIBUTE(
EXPORTING
NAME = `SET_STATE`
IMPORTING
VALUE = LV_SET_STATE ).
IF LV_SET_STATE = 'X'.
IF LV_DOC_TYPE = 'ABC' AND LV_EDIT_SUB_TYPE IS INITIAL.
LO_EL_IF_EDITABILITY->SET_ATTRIBUTE(
NAME = `EDIT_SUB_TYPE`
VALUE = 'X' ).
LV_DROPDOWN ?= VIEW->GET_ELEMENT('DRPDWN_SUBTYPE_CHANGE').
CALL METHOD LV_DROPDOWN->SET_STATE
EXPORTING
VALUE = 01
ELSE.
LO_EL_IF_EDITABILITY->SET_ATTRIBUTE(
NAME = `EDIT_SUB_TYPE`
VALUE = '' ).
LV_DROPDOWN ?= VIEW->GET_ELEMENT('DRPDWN_SUBTYPE_CHANGE').
CALL METHOD LV_DROPDOWN->SET_STATE
EXPORTING
VALUE = 00
ENDIF.
IF LV_EDIT_PARENT IS INITIAL AND
( LV_DOC_TYPE = '123' OR LV_DOC_TYPE = 'qwerty').
LO_EL_IF_EDITABILITY->SET_ATTRIBUTE(
NAME = `EDIT_PARENT`
VALUE = 'X' ).
LV_DROPDOWN ?= VIEW->GET_ELEMENT('DRPDWN_PARENT_CHNG_DOCTYPE').
CALL METHOD LV_DROPDOWN->SET_STATE
EXPORTING
VALUE = 01
LV_INPUTFIELD ?= VIEW->GET_ELEMENT('IF_PARENT_CHNG_DOCNUM').
CALL METHOD LV_INPUTFIELD->SET_STATE
EXPORTING
VALUE = 01
ELSE.
LO_EL_IF_EDITABILITY->SET_ATTRIBUTE(
NAME = `EDIT_PARENT`
VALUE = '' ).
LV_DROPDOWN ?= VIEW->GET_ELEMENT('DRPDWN_PARENT_CHNG_DOCTYPE').
CALL METHOD LV_DROPDOWN->SET_STATE
EXPORTING
VALUE = 00
LV_INPUTFIELD ?= VIEW->GET_ELEMENT('IF_PARENT_CHNG_DOCNUM').
CALL METHOD LV_INPUTFIELD->SET_STATE
EXPORTING
VALUE = 00
ENDIF.
LO_EL_CONTEXT->SET_ATTRIBUTE( NAME = `SET_STATE`
VALUE = ' ' ).
ENDIF.
LO_EL_CONTEXT->GET_ATTRIBUTE(
EXPORTING
NAME = `SET_STATE`
IMPORTING
VALUE = LV_SET_STATE ).
IF LV_OPTION_CHANGED = 'X' AND LV_OPTION_SELECTED = 'C'.
DATA LO_ND_ZGGL TYPE REF TO IF_WD_CONTEXT_NODE.
DATA LO_EL_ZGGL TYPE REF TO IF_WD_CONTEXT_ELEMENT.
navigate from <CONTEXT> to <ZGGL_RICEFTOOL> via lead selection
LO_ND_ZGGL = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_ZGGL).
LO_ND_ZGGL->INVALIDATE( ).
get element via lead selection
LO_EL_ZGGL = LO_ND_ZGGL->GET_ELEMENT( ).
LO_ND_IMPORTING_CREATE->INVALIDATE( ).
LO_EL_IMPORTING_CREATE = LO_ND_IMPORTING_CREATE->GET_ELEMENT( ).
LO_EL_IMPORTING_CREATE->SET_ATTRIBUTE( NAME = `VISIBILITY_GROUP`
VALUE = '2' ).
LO_EL_IMPORTING_CREATE->SET_ATTRIBUTE( NAME = `VISIBILITY_TABLE`
VALUE = '1' ).
LO_EL_IMPORTING_CREATE->SET_ATTRIBUTE(
NAME = `ACTION_RDBTN`
VALUE = 'C' ).
LO_EL_IF_EDITABILITY->SET_ATTRIBUTE(
NAME = `EDIT_CREATE`
VALUE = ' ' ).
LO_EL_IF_EDITABILITY->SET_ATTRIBUTE(
NAME = `EDIT_DISPLAY`
VALUE = 'X' ).
LO_EL_FUNCTIONALITY->SET_ATTRIBUTE( NAME = `OPTION_CHANGED`
VALUE = ' ' ).
ENDIF. -
IBY_FD_EXTRACT_EXT_PUB getting called twice even for single payment
Hi All,
I am extending IBY_FD_EXTRACT_EXT_PUB for a custom field Batch Number which is sequence getting reset at 99. However the sequence is skipping 1 value each time payment is run.
On further analysis I found that IBY_FD_EXTRACT_EXT_PUB is getting called twice even when a single payment is made in Quick type. Has anybody experienced this?
Thanks,
AbbyI finally have my solution. I did it without the IBY_FD_EXTRACT_EXT_PUB extend function. I modified the etext outbound RTF template accordingly. Maybe it will give you a hint or direction to solve your situation. Good luck.
I created a level for grouping criteria as PaymentReferenceNumber/Payee/Address/AddressName, DocumentInternalIDSegment2, called InvoiceDetailLevel. The base level is OutboundPayment.
I then added a level (InvoiceDetailLevel) between OutboundPaymentInstruction and the DocumentPayable level.
Then in the syntax for the supplier number and the address I entered this in the Data column:
../../ OutboundPayment/Payee/SupplierNumber
and
../../ OutboundPayment/Payee/Address/AddressName
That did the trick and now it is working correctly on every line, looping back to get the proper information. -
Osr calls from bpel are getting called twice in case of error
Hi,
I have a child process that does simple cancatenation of input and a string and reply back.
I have deployed it and published its wsdl in OSR.
I created another bpel process parent that will call the child process through OSR.
When there is error in child process, the parent process is invoking the child process twice.
oracle weblogic server version : 10.3.4
OSR: 11.1.1.4
soa suite: 11.1.1.4
I'm not able to understand why the child process is getting called twice. Ideal scenario should be to raise an error and exit. Also if there are multiple calls like parent1 process have osr call to parent process and parent process have osr call to child process,repetition is happening in a 2x ratio.
Please provide some solution for this.
Thanks.Hi Vijay,
Fault management is not implemented explicitly.
Also, i do not observe this issue when there is no OSR i.e if I have direct wsdl call to child process other than OSR, this issue of repeating twice is not coming.
Is there any configuration changes required in OSR?
Thanks,
Indu -
DataAction prepareModel method getting called twice.
I have a DataAction subclass in which I have overridden the prepareModel() method, putting a System.out.println() into. I just discovered that this method is getting called twice per time that I run the DataAction. Why is this, and how do I change it so that it is only executed once?
BradHi:
The prepareModel method will get called each time your action is executed, ie before your page is displayed, and after a user submits a request.
If you dont want your code in the prepareModel method to be run when a user submits a request, you should check the event list. If the list is non-empty, then the user has submitted a request to your action.
The following code is taken from Steve Muench's ADFToyStore demo:
private boolean handlingEvents(DataActionContext ctx) {
List events = ctx.getEvents();
return (events != null) && (events.size > 0);
}in your prepareModel method, do the following:
protected void prepareModel(DataActionContext ctx) {
if(!handlingEvents(ctx)) {
// code for before the initial display of the page
} else {
// code to be executed before your event handlers get called
}HTH
Gareth -
JComboBox itemStateChanged gets called twice.
Hi i have a JComboBox whoes itemStateChanged gets called twice. I have taken a look at other post concerning this topic and non have worked for me . I will greatly appreciate it if someone can help me
here is the code !!!!!!!!!!
jComboBox3.addItemListener(new ItemListener(){
public void itemStateChanged(ItemEvent e) {
if(e.getStateChange() == e.SELECTED){
jComboBox3_dosomething(e);
thanks in advanceMaybe this thread will answer why it gets called twice:
http://forum.java.sun.com/thread.jsp?forum=57&thread=257226 -
Filters applied, called twice sometimes ...
Hi,
I have a small problem which give me headhache...
I'm using a filter to make pre (authentification) and post processing (output the webpage using a XSL transformation).
skeleton :
... doFilter ...
//authentification
chain.doFilter()
//transformation and display
When i'm aslink for a webpage (with a visitor account) there is no problem .., the webpage is displayed properly and the filter is called once ! perfect !
but after my authentification (put a variable containing information onto the session with
"sessionMgr.setSessionUser(session, user);") when I call the same webpage as before the webpage is displayed properly (that's a good point) but I saw in the tomcat console that after the end of the filter , the filter is called again with the same request or null sometimes .... GRRRRR
I read John Hunter article about filters and in its clickstream exampl is using this tips :
// Ensure that filter is only applied once per request.
if (request.getAttribute(FILTER_APPLIED) == null) {
request.setAttribute(FILTER_APPLIED, Boolean.TRUE);
HttpSession session = ((HttpServletRequest)request).getSession();
Clickstream stream = (Clickstream)session.getAttribute("clickstream");
stream.addRequest(((HttpServletRequest)request));
at the start of this filter ...
can I have more explanation about this stuff ...
I really don't understand why this happened ... it seems linked to the session management but I have no proof ...
I find out hard to debug and hard to explain so
THANKS A LOT FOR YOUR SUPPORT :)
see ya
Fran�ois (french guy so sorry for the english)hi there,
well your problem is interesting........
the solution that you have suggested in your problem regarding the use of FILTER_APPLIED, can be used but not as a long term solution.........
well one thing i can tell you that as i was also facing the same problem of filter called twice, let me explain you the basic behaviour of the filter that a filter is called just before processing any request and again before giving response back to the particulare request........
the next thing i can tell you is from your web.xml it is quite clear that you are mapping each request coming from dispatcher (your servlet) to your filter.......that means any request that points to dispatcher will go to the filter first and then to the actual servlet.
one more thing you are loading the servlet on startup........
just try to remove that code and then check..............
because what happens in this case is when you start your application at that time your servlet will be loaded.........check whether the filter is called at that time or not......i think it must be called.......
and when again a request will come the filter will be called..........this could be possible reasons your filter is called two times.........just try to delete the load on startup line from your web.xml for a while and then check..........
regards
Shishir -
User Exit EXIT_SAPFP50M_002 getting called twice
Hi,
I've created a custom infotype - 9002 & am doing processing in the user exit - EXIT_SAPFP50M_002 (as suggested [here|http://sapdev.co.uk/enhance/enhance_hrpbopai.htm]). Specifically, I'm inserting one more record into the infotype. To insert records, I'm making use of the FM - HR_INFOTYPE_OPERATION. This call is in a Z report & I'm invoking it through SUBMIT & RETURN.
My problem is that this FM is calling my exit (the one mentioned above) again! (I can see this as I've set a breakpoint in the include ZXPADU02) Since the data is same, all checks are getting passed & the same code is getting executed twice.
I'm trying to use SET & GET PARAMETER calls to prevent the second execution; which doesn't seem to be the best approach.
Is there any other way to circumvent the second call? Any help would be appreciated.
Thanks,
KKRDear KKR,
Hope you had a look at the Include LXPADF01 for the Sample Code for Infotype 0008.
Look at it it migh give you more clue of how to use the Function Exit EXIT_SAPFP50M_02.
Moreover if you have a look at the FM HR_INFOTYPE_OPERATION - you can see that there is a further check function HR_INFOTYPE_CHECKEXISTENCE which is being used which also calls your Function Exit - So this is the reason why your Function gets executed Twice.
I Hope this information helps you to some extent.
Encourage others to answer your queries by suitably rewarding them
Thanks
Venugopal -
Printing function gets called twice..!
The following is my class that prints a string array which sometimes goes into multiple pages.. The code in which i create the multiple pages is below this class.. the problem is each time i append a new page to the book the print function in the class PaintC is called twice.. so if I write some additional code inside the print function to edit the strings .. it ends up running twice and the formatting i try to do gets messed up.. !! do you guys know why this is happening..? Please help.. ive been trying to find out since a very long time..!!
The code in which i call this function is also shown below
CLASS FOR PRINTING
class PaintC
implements Printable {
String ad[];
public PaintC(String ac[]) {
System.out.println("Print Class Called 1");
this.ad = ac;
public int print(Graphics g, PageFormat pf, int pageIndex) throws
PrinterException {
System.out.println("Print Function Called 1");
Graphics2D g2 = (Graphics2D) g;
g.setFont(new java.awt.Font("Trebuchet MS", Font.PLAIN, 8));
int xo = 60;
int yo = 36;
for (int y = 0; y < 76; y++) {
try {
g2.drawString(ad[y], xo, yo);
yo += 9;
catch (Exception r) {
y = 76;
return Printable.PAGE_EXISTS;
CODE FOR CREATING MULTIPLE PAGES USING ABOVE CLASS
void dotheprint() {
PrinterJob printerJob = PrinterJob.getPrinterJob();
PageFormat format = new PageFormat();
Printable painter1;
format = printerJob.defaultPage(format);
Paper paper = format.getPaper();
paper.setImageableArea(60, 36, 500, 756);
format.setPaper(paper);
// try storing in a string array each line
Book bk = new Book();
String ab = jTATRRep.getText();
int i, j, lc = jTATRRep.getLineCount();
String ac[] = new String[lc + 3];
String ad[] = new String[78];
ac = ab.split("\n");
//System.out.println("Number of Lines = " + lc);
//setting up pages as string arrays..
// setting up first page
//Assuming 76 lines per page
for (i = 0; i < 76 && i < lc; i++) {
try {
ad[i] = ac;
catch (Exception ex) {
bk.append(new PaintC(ad), format);
ad = null;
// setting up second page if neccessary
// //System.out.println("Number of Lines /76= "+lc/76);
int pagec = lc / 76;
int modul = lc % 76;
int k;
if (modul > 0) {
pagec++;
// //System.out.println("Number of pages : "+pagec);
j = 76;
while (pagec > 1) {
ad = new String[76];
k = 0;
for (i = j; i < (lc - 1) && k < 76; i++) {
// //System.out.println("ac[i]= "+ac[i]);
ad[k] = ac[i];
k++;
bk.append(new PaintC(ad), format);
ad = null;
j += 76;
pagec--;
printerJob.setPageable(bk);
boolean doPrint = printerJob.printDialog();
if (doPrint) {
try {
System.out.println("Print Called 1");
printerJob.print();
System.out.println("Print Called 2");
catch (PrinterException exception) {
System.err.println("Printing error: " + exception);
CODE IN WHICH THE PRINT FUNCTION IS CALLED
void jBPrint_actionPerformed(ActionEvent e) {
dotheprint();
class ContactManager_jBPrint_actionAdapter
implements java.awt.event.ActionListener {
ContactManager adaptee;
ContactManager_jBPrint_actionAdapter(ContactManager adaptee) {
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e) {
adaptee.jBPrint_actionPerformed(e);You might want to check out the [url http://forum.java.sun.com/thread.jsp?forum=57&thread=500687&tstart=0&trange=15]crosspost in the swing forum before spending your time answering this question.
-
Faces Servlet no getting called when accessing JSF portlet
Hi,
I have a JSF web application and I am exposing the functionality of this JSF web application using native Weblogic Portal JSF portlets. I have configured this JSF web application as a simple producer and I am consuming these portlets in my portal using WSRP.
I have written a custom FacesServlet and configured it in the web.xml of the producer web application. When I access the pages in the producer web app like a normal web app, I see that my faces servlet is being called but when I consume these pages via the JSF portlet and view the portlets in the portal then the Faces servlet is not being called.
Is this normal behavior or is WSRP causing this problem or am I missing something. Your help is greatly appreciated.
Regards,
HiteshHi Hitesh,
What I was asking you to give a try was, configure the standard faces servlet for example if you are using JSF RI
the configuration will look like
<servlet>
<servlet-name>FacesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>100</load-on-startup>
</servlet>I am not very sure whether this can solve the problem.
Thanks
Sreeram
Edited by sreeram.jonnalagadda at 06/10/2008 4:46 AM -
MouseClicked getting called twice per a click. fix?
Ok I wrote a little graph drawing thingee. And I migrated from a jpanel to a japplet. I ran into a wierd behavior in that for every click on the applet two mouseClicked events were getting generated back to back. Since I was using double clicking as an input type that was really annoying. Anyway to kill click events so that doesnt happen?
The fixed applet is here (I know it flickers one thing at a time thanks):
http://members.cox.net/jeremiah.rounds/projects/GraphApplet/GraphConstruction.html
The "broken" code was:
public void mouseClicked(MouseEvent e) {
//check to see if were carrying something
if(carried != null){
carried.color = Color.BLACK;
xvertextree.insert(carried,(long)carried.xmin,(long)carried.xmax);
carried = null;
repaint();
//check to see if its a double click or a norma;
else if( System.currentTimeMillis() < lastclick + 300){
mouseDoubleClick(e);
lastclick = System.currentTimeMillis();
}That code would always generate a doubleclick call as it would put the current time in last click then immediately be recalled by the system. (debugged it 4 ways to sunday to be sure)
The fix was just to check to see if this recall was to fast to seem humanly possible and if it was then ignore it.
public void mouseClicked(MouseEvent e) {
//check to see if were carrying something
//applet seems to call this again fast so if its to fast skip it
if(System.currentTimeMillis() < lastclick + 20) return;
if(carried != null){
carried.color = Color.BLACK;
xvertextree.insert(carried,(long)carried.xmin,(long)carried.xmax);
carried = null;
repaint();
//check to see if its a double click or a norma;
else if( System.currentTimeMillis() < lastclick + 300){
mouseDoubleClick(e);
lastclick = System.currentTimeMillis();
}is there a better way? Suggestions. Do more of the same? Wierd? Normal?
Thanks.Maybe you get an event when the mouse button is both pressed and released? If so, you can add a check to only react when the button is released.
-
Css and javascript getting called twice in publish mode
Hi all,
We are facing an issue only on publish environment that our css and javascripts are loaded twice on publish.
On author it works fine.
Can someone give some clue?
Regards,
ShalluSallu,
Can you delete /var/classes and /var/clientlibs and try again ? Is it happening on all publish instance or few of them ?
Yogesh -
Controller Is Being Called Twice - Why???
I think this is going to be a complicated question to answer but I'll try to explain what's going on as best I can. The basic problem I'm having is that the controller class gets called twice for some reason (instead of once) and I have no idea why. I type in a URL in my browser that goes to a JSP page called �myJsp.jsp�. Basically all that page contains is this...
<tiles:insert definition =�my.tile� flush=�true�/>In my tiles-defs.xml file I have the following listing...<definition
name="my.tile"
path="SomeOtherJsp.jsp"
controllerClass="x.y.z.MyController">
</definition>
x.y.z.MyController.java makes some calls to a DAO to retrieve data. MyController.java then puts that data into the requestScope for the JSP below to access...
SomeOtherJsp.jsp has nothing special in it although it DOES contain a link to myJsp.jsp (and, somehow, it's like this link is being clicked even though I'm not clicking it).
<a href="myJsp.jsp?someParam=<c:out value="${requestScope.someValue}"/>">Click Here To Do Something</a>If anyone can help I'd greatly appreciate it. By the way, I spoke to someone else who mentioned that I should turn this kind of thing into a struts action instead of doing a deletion within a controller class. I am going to refactor my code to do this. However, I'm still curious to know the answer to my question. Maybe it will help me get a better understanding of exactly what's going on in the world of servlets. :)Hi Shiv, <br><br>
Yes I have placed System.out.println...and a debug point ...<br>
super.processRequest(pageContext, webBean);<br>
OAApplicationModule am = pageContext.getApplicationModule(webBean); <br>
// String personId="13477";<br>
// Serializable[] parameters = { personId };<br>
if (!pageContext.isFormSubmission()) { <br>
am.invokeMethod("createEmployeeRow", null);<br>
}<br>
//am.invokeMethod("initDetails",parameters);<br>
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!IN Process Request"); <br>
debug point is at String personID="13477"....<br><br>
Thanks<br>Soujanya
Maybe you are looking for
-
Siebel 8.1 integration with BI Publisher 11g
Hello, I'm currently trying to integrate BI Publisher reporting with Siebel 8.1 at work. We've followed the guide named " [BI Publisher for Siebel Applications Guide|http://download.oracle.com/docs/cd/E14004_01/books/Reports/ReportsTOC.html] ", which
-
Throwing MbeanException wrapping custom exception
Iam throwing a mbean exception which wraps a custom exception from mbean. Iam invoking this mbean from wlst(python script) and Iam trying to catch this MBeanException When i try to use the getCause method i get the following exception . "java.rmi.Unm
-
When i click on to get my email it doesn't go there and i get a passionup bar
-
I get apparently random crashes when running OpenGL-heavy apps like World of Warcraft and GLTron. I called Apple for this last June, and they ultimately acknowledged the problem. What I'm looking for here is any known work-around and whether anyone k
-
Won't finish downloading 7.4.2
I just bought the new ipod nano anhd have had the second gen for almost a year. Wehnever i try downloading the uns the regualr window comes up and i got through the download process but at the end it says " Itunuered unknown errors while downloading"