Does DNS server cache forwarded request responses?
Hi,
Please excuse my ignorance. I am new to OSX Server and DNS. I setup OSX Server on my Mountain Lion system and configured the DNS server. It forwards requests which it cannot resolve to my service provider's DNS.
I am wondering if the responses to those forwarded requests are cached by the OSX Server so that the next time a request comes through they can be handled locally?
If they are, is there a way I can see what the DNS server has cached?
Thanks.
There are caches all over.
OS X client caches DNS responses.
See the command-line dscacheutil tool for poking around with that.
OS X Server DNS server also caches responses.
The BIND9 rndc tool is used for poking around in the ISC BIND9 DNS server, as is included with OS X Server.
sudo rndc -p 54 dumpdb -all
TCP port 54 is the management port used by default in the OS X Server version I've checked, where other installations of BIND9 will use TCP port 953 for that. To confirm the port, go have a look at the named.conf file for the "control" declaration. That file is usually either in /etc/named.conf, or it can be stored in /library/server/named in some OS X Server versions. Once the rndc command completes, go look in the directory where named.conf resides for the file named named_dump.db. That's a text file with the dump.
If you want to learn the innards of DNS as implemented by recent ISC BIND servers, acquire a copy of Cricket Liu's DNS and BIND book. The 5th edition was current, when last I checked.
Barring cases where the upstream provider offers DNS-based filtering or such, forwarding requests is usually an extra hop in the DNS translations that — unless you're hitting the same domains as other folks on your server — might not pay off. If the translation isn't in the ISP's DNS caches, then the usual series of queries of other root and authoritative DNS servers will ensue; you've added a hop.
If you do want to use a gonzo-scale DNS server as a forwarding server — I'd expect higher-scale and larger caches and likely also higher-availability than what most any other ISP is likely running — then Google DNS servers are available at 8.8.8.8 and 8.8.4.4.
Or just eliminate the forwarding servers.
Similar Messages
-
Servlets and forward(request, response)
I have a Servlet that is forwarding the request and response objects to one of two JSP's based upon a parameter in the request object. When opening a browser session and entering my servlet with the first parameter (opCorp=MBSUB) the /criteriaRM.jsp is displayed correctly. However, while still in the same browser session when re-entering the servlet with the parameter changed to opCorp=NEW the second JSP /criteriaPL.jsp is never called correctly - ie the page does not load. However, entering the application with a new browser session works fine (opCorp=NEW loads /criteriaPL.jsp in a brand new browser session) - so I know the second JSP is good and the forward syntax OK. Is there something I am missing? I am using the following code in my servlet
if (request.getParameter("opCorp").compareTo("MBSUB")==0) {
getServletConfig().getServletContext().getRequestDispatcher("/criteriaRM.jsp").forward(request, response);
} else {
getServletConfig().getServletContext().getRequestDispatcher("/criteriaPL.jsp").forward(request, response);
Any ideas would be much appreciated. Thanks!!Ok, your jsp isn't loded but what else does happen then ? Any exception thrown ? Page not found message ?...
-
Using forward(request, response) in Java Servlet
Hi
I need help on how to use the forward() method in a java servlet passing a List object and riderecting to another jsp.
when I use the following code;
request.getRequestDispatcher(path).forward(request, response);
I'm getting this message:
Content modified /content...
Status
200
Message
OK
Location
/content...
Parent Location
/content
Path
/content...
Referer
Thanks,Looking at your traces seems like you are forwarding during POST. Seems like issue with your component implementation missing with POST & proxy scripts. Please eloborate more on the exact steps you are following. Alternatively See if this helps.
org.apache.sling.api.wrappers.SlingHttpServletRequestWrapper req =
new org.apache.sling.api.wrappers.SlingHttpServletRequestWrapper(slingRequest) {
public String getMethod() {
return "GET";
String path = "/content/.../test.html";
javax.servlet.RequestDispatcher dispatcher = slingRequest.getRequestDispatcher(path);
dispatcher.include(req, slingResponse); -
We are running through a scenario where user1 is assigned to role1 and run a report and after couple minutes user1 is assigned to role2 and run the same report, in 2nd run i see an error in saw log, even though there is presentation server cache that was generated by user1 is previous run it s not shared to the same user if his roles is chnaged, Is this expected behaviour ? by the way we dont have any row level security jut object level
[2014-01-20T08:11:54.000-07:00] [OBIPS] [ERROR:31] [] [saw.views.dashboard] [ecid: 2f571434fbbd5490:72a3494e:14398c832ad:-8000-0000000000daa36e,0:1] [tid: 1545778944] Invalid request ID (ml75inai8rfs23tn9ih04bh236). The request you are attempting to access has either expired or is from a previous logon.[[
File:reportquerycache.cpp
Line:68
Location:
saw.views.dashboard
saw.httpserver.processrequest
saw.rpc.server.responder
saw.rpc.server
saw.rpc.server.handleConnection
saw.rpc.server.dispatch
saw.threadpool.socketrpcserver
saw.threads
SessionID: hjhbcvfak396tc89uuu550g8bgv75v2rshv2oeq
Thanks for your help
SrixThe variable DISABLE_CACHE_HIT is used to enable or disable Oracle BI Server result cache hits and not the presentation server cache. So the behavior seems to be correct. You can manage the presentation server cache settings in hte instanceconfig.xml file. Refer to the documentation below to understand the parameters you can configure: ( http://docs.oracle.com/cd/E21764_01/bi.1111/e10541/querycaching.htm#i1218900 )
-
Why does DNS server entry in ipconfig break point-to-point ethernet?
My application uses a panel pc as the user interface for a cRIO controlling a medical device. The panle pc and cRIO communicate using shared variables. During development, both devices (panel pc and cRIO) were on our company network. Curiously, when I connected them point-to-point with a crossover cable, they refused to communicate when running their LabVIEW application code. Pings from the panel pc to cRIO were successful. Much troubleshooting ensued.
Long story short, the fix was to simply delete the DNS server IP entry from both the panel pc and the cRIO ipconfig tables (see attached pic for the WinXP version of this table). If either of them had our company's DNS server IP address fillied in, my LabVIEW application would fail.
This leads me to suspect that there is something in my LabVIEW executables that wants to touch the company network. Apparently, if there is a DNS server entry in the ipconfig table, this something thinks it has a chance to "phone home" and it tries to do so. When this happens on the panel pc end of the crossover cable, the machine acts like it's locked up, but the task manager shows the CPU to be ~98% idle.
If there is no entry for a DNS server, I guess this something realizes that there is no way to "phone home", so it doesn't try and my application works great. Since the application works with no DNS server table entry, I think my crossover cable is working correctly.
Does anyone have any idea what this something might be?
Jeff
Climbing the Labview learning curve!
Sanarus Medical
Pleasanton, CA
Attachments:
IPform.gif 12 KBYou've hit the nail on the head Ben. For point to point communications, the IP addresses should be fixed, therefore there is no need for DNS. If a DNS is configured, the NIC (Network Interface Card) drivers will try to contact it.
In my test system, I need DNS for the test computer, but I am communicating with a dedicated Spectrum Analyzer over TCP/IP. So I added a second NIC. The main NIC is configured for DNS and all that jazz. The second NIC (plugged into PCI slot) is configured with a hard coded address, no DNS, no Gateway, nothing else. I connect that NIC to the spectrum analyzer using a crossover cable. The analyzer is configured with a hard coded address also. Now my computer can get on our company network, and the spectrum analyzer is isolated from the network, so it can't catch any viruses, etc., and it still talks to the computer. When using a configuration such as this, it is best to use a dedicated address for the 2nd NIC and spectrum analyzer in the range of 192.168.100.0 to 254
- tbob
Inventor of the WORM Global -
NB200-13J - No response from DNS server and Gateway
Hi
I have netbook NB200-13J with XP SP3. Its impossible to connect in the internet wireless and the error messages are
THERE IS NO RESPONSE FROM DNS SERVER
THERE IS NO RESPONSE FROM DEFAULT GATEWAY
The connection with ethernet cable is ok withe the reltek adpter also the wirless adpter atheros ar9285 is enble, working properly and the signal from the modem router is strong.Hi abk55,
From which program you receive this error message?
Have you tried another browser, e. g. Firefox or Opera?
I assume it has something to do with your WLAN card or WLAN settings if the LAN cable works properly. So you should try updating the WLAN driver from the Toshiba website.
Try also to disable the MAC address filter and use another encryption. -
How to add a new parameter to a forwarded request?
Hi all,
I have a RequestDispatcher that forwards my request into a servlet. However, if some processing error happens I would like to include another parameter (an error message) in my request being forwarded. Oh, yes, I don't want it to be via GET, but via POST.
So, this
getServletContext().getRequestDispatcher("/ProcServlet?message=nonononononon").forward(request, response);will not serve for my purposes. Also, I don't want to go into directly writing my new parameter into the outputstream... is there another way to do that via the Servlet/JSP API?
Thank you all in advance,
Filipe Fedalto???
-
Trouble forwarding request from a servlet to a JSP in OAS 4.0.8.1 on NT
The OJSP release notes state that:
"Servlets and JSP cannot coexist as the same application" and "Requests cannot be passed between two separate applications."
Does this mean that my attempts to use the
the servlet RequestDispatcher to forward a request to a JSP are futile? If so, is this a problem that will be fixed in the future? I would like to use this feature!
This is the code (based on a sample from Sun's JSWDK 1.0.1) that doesn't work:
servletToJsp.java
import javax.servlet.*;
import javax.servlet.http.*;
public class servletToJsp extends HttpServlet {
public void doGet (HttpServletRequest request,
HttpServletResponse response) {
try {
getServletConfig().getServletContext().getRequestDispatcher("/jsp/jsptoserv/hello.jsp").forward(request, response);
} catch (Exception ex) {
ex.printStackTrace ();
I am able to use the <jsp:forward page="/servlets/servletToJsp" /> directive to go from a JSP page to a servlet (across two OAS Applications) and I also can forward a request via the dispatcher from one servlet to another in the same OAS application.
Any help in this area would be appreciated. Thanks.I'm using OAS 4.0.8.1
You mean servlet to JSP does not work and JSP to servlet works for you????Yes - but I've only tried very simply examples.
That's different from my understanding. If you are using OAS 4081, both cases should not work.
The problem you mentioned will be fixed in future release of OAS.That's good to know - thanks!
null -
WRVS4400N causes my DNS server to time out
Folks,
I have a Fedora 11 box running behind a WRVS4400N router. From the box, standard network functionality such as ping, telnet, browsing, etc. works just fine. The problem is using the DNS server (Bind9) on the box. When this DNS server makes a request to external root servers, the connection just times out.
As you may know, when a DNS request is made by Bind, the destination port is 53 and the source port could be anything from 1024 to 60000.
I used tcpdump to trace the network packets. A UDP packet to port 53 of external root server is sent but the reply never comes back.
I replace the Linksys router with another DLink router, things start to work fine. When I trace the network packets, I see that the reply is coming through. This leads me to believe that there is something wrong with my Linksys router.
I am running the latest firmware on the router. I also did a factory reset to make sure that it is in a clean state.
Has anyone else seen such a problem? How did you fix it?
Thank you in advance for your help.
Regards,
Peterdid you try port forwarding? you may forward the port that will work for your DNS servers.
-
what does this mean?
org.apache.jasper.JasperException: Cannot forward after response has been committed
I can't find an explanation of the error in general on the web? I am using dispatcher.,forward?
<%@ page import="java.io.*" %>
<%@ page import="javax.servlet.*" %>
<%@ page import="javax.servlet.http.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.text.*" %>
<%@ page import="javax.xml.parsers.DocumentBuilderFactory" %>
<%@ page import="javax.xml.parsers.*" %>
<%@ page import="org.w3c.dom.Document" %>
<%@ page import="org.w3c.dom.DOMException" %>
<%@ page import="org.w3c.dom.Element" %>
<%@ page language="java" import=".*" %>
<jsp:useBean id="manageAddressBook" scope="session" class=".ManageAddressBook" />
<%! .AddressBook ab; %>
<%! //String addJSP = "http://localhost:8080/examples/jsp//display.jsp"; %>
<%! String addJSP = "Add.jsp"; %>
<%! String displayJSP = "display.jsp"; %>
<%! boolean noPrev = false; %>
<% String displayPage = "display.jsp";
String addPage = "Add.jsp";
String loginPage = "login.jsp";
Enumeration enum = request.getParameterNames();
AddressBook ab;
String lastPageVar = request.getParameter("lastPageVar");
String button = (String)request.getParameter("submit");
if (lastPageVar == null)
lastPageVar = "";
//Figure out what the dispatcher needs to do
String actionVar = request.getParameter("actionVar");
if (actionVar == null)
actionVar = "";
//check login status
Object loginObj = session.getAttribute("isLoggedIn");
boolean isLoggedIn;
if (loginObj != null)
isLoggedIn = ((Boolean) loginObj).booleanValue();
else
isLoggedIn = false;
if (lastPageVar.equals("")){
session.setAttribute ("fromDispatcher", new Boolean(true));
session.setAttribute("firstCall", new Boolean(false));
callWebPage(request,response,session,loginPage);
else
session.setAttribute("firstCall", new Boolean(false));
//if (!(isLoggedIn))
// callWebPage(request,response,session,loginPage);
if (lastPageVar.equals("LOGIN_PAGE")){
String username = (String)request.getParameter("username");
String password = (String)request.getParameter("password");
isLoggedIn = checkLogin(username,password);
Boolean isLoggedInObj = new Boolean(isLoggedIn);
session.setAttribute ("isLoggedIn", isLoggedInObj);
if (isLoggedIn)
callWebPage(request,response,session,displayPage);
else
callWebPage(request,response,session,loginPage);
if (lastPageVar.equals("DISPLAY_PAGE")){
if (button.equals("logout"))
callWebPage(request,response,session,loginPage);
if (button.equals("next") || button.equals("previous"))
callWebPage(request,response,session,displayPage);
else
callWebPage(request,response,session,addPage);
if (lastPageVar.equals("ADD_PAGE")){
if (button.equals("logout"))
callWebPage(request,response,session,loginPage);
//if save or cancel, then just save or cancel and return to display screen.
if (button.equals("save")){
manageAddressBook.edit(request);
callWebPage(request,response,session,displayPage);
if (button.equals("Add"))
callWebPage(request,response,session,displayPage);
else
ab = (AddressBook)session.getAttribute("currAddressBook");
if (button.equals("Delete")) {
ab = (AddressBook)session.getAttribute("currAddressBook");
manageAddressBook.setDelete(ab);
callWebPage(request,response,session,displayPage);
if (button.equals("cancel"))
callWebPage(request,response,session,displayPage);
%>
<%-- JSP FUNCTIONS --%>
<%!
public boolean checkLogin(String username, String password) {
if (username.equals("mypage") && password.equals("guesswho"))
return true;
else
return false;
void callWebPage( HttpServletRequest request,HttpServletResponse response,HttpSession session,String webPage)
throws ServletException, IOException {
//verifies from dispather
session.setAttribute ("fromDispatcher", new Boolean(true));
RequestDispatcher dispatch = request.getRequestDispatcher( webPage );
dispatch.forward(request,response);
%>Its like this.. after you dispatch the request by the method call [callWeb...], the dispatcher would dispatch the request to that page and after the page is dispatched and response has been sent, the execution continues on this JSP, ie from the line after the call to the [callWeb..] function.. All you need to do to avoid this exception is,
a) put a return; statement after the call to the function.
Or
b) structure your code in such a way that after the call to the [callWeb..] function, the execution would not continue;
I would prefer the first condition though along with structuring the code in such a way that you need not have that many calls to the function. Instead have a String dest variable, which would change and make a call in the end
Cheers
-P -
CSS: How does DNS Scripted Keepalive (ap-kal-dns) work?
Hello everyone,
I have a question about how does DNS Scripted Keepalive (ap-kal-dns) work on CSS 11503.
According to the "Using the CSS Scripting Language",
http://www.cisco.com/en/US/partner/docs/app_ntwk_services/data_center_app_services/css11500series/v7.50/configuration/administration/guide/Scripts.html
it says
Since we just want to see if the DNS server is alive we will send a simple DNS Query. This query is hard coded in hexadecimal and sent raw to the DNS server.
and
Receive some unexplained response. We don't care what it is because an unstable DNS server or a non-existent one would probably not send ! us any data back at all.
but it also says
Failure Upon: 1. Not resolving the host's IP from the domain name
And according to the "How to Configure the CSS to Load Balance DNS Servers and Use the DNS Scripted Keepalives",
http://www.cisco.com/en/US/partner/products/hw/contnetw/ps789/products_configuration_example09186a00801d015a.shtml
it says
The script is hard-coded to resolve www.cisco.com. It does not matter if the DNS server can resolve this address or not, as long as a DNS response comes back that the service is alive. This keepalive is only testing if a DNS server can respond to a query, not if it can resolve a specific name. The script queries from the CSS to DNS internal servers keep track of the availability of the DNS servers.
but it also says
Access to Internet Domain Name System Root Servers is required for successful implementation of DNS scripted keepalives.
So I am confused whether DNS server has to resolve the host's IP address correctly for DNS query received from CSS or just needs to reply any response but not need to resolve it.
I would like to recap about my question.
Q1: Does DNS Scripted Keepalive (ap-kal-dns) send DNS query with cisco.com as DNS name by default?
Q2: Does DNS server has to resolve IP address of cisco.com or just need to respond for DNS query with any response but not need to resolve IP address of cisco.com?
I understand I should get capture data and see how DNS scripted keepalive works, but I can not prepare lab environment to do it at the present.
Your information would be appreciated.
Best regards,
Shinichiyes the query is for www.cisco.com and the script expect a reponse that contains the word cisco.
Gilles. -
Clearing Request / Response Objects
Hi,
I have a File Upload Screen where I have validated for the File Content Length to be within 3 MB. Now I call the MultiPartRequest Reusable Object provided by Jason Hunter from a Servlet. Now as long as the file (which I am uploading) size is less than 3 MB, the Screen seems to be very fast. The Problem that I face is as follows:
I am trying to upload a file of 5 MB file size. Since my validation is in the Reusable MultiPartRequest Object, an Exception is thrown out of this Object and caught in the Servlet.
Scenerio 1:
Now from the Servlet I was using RequestDispatcher to forward to the Error Page. Since when I forward like this, the same request Object is send back to the Client which increases the response time. For me the Screen crashes due to Browser Time out.
Scenerio 2:
Now from the Servlet I tried using response.sendRedirect to the Error Page. Still the response time is more but comparatively less than the Scenerio 1.
My Question:
1. Is there a way to clear the contents of the Request and Response Object so that the response time to the client is reduced?
2. I think what I am asking is not possible. But still taking a chance is not a mistake. Is there a way to create a new Request or Response Object? I believe we (as an application developer) have no control over this as the Application Server will have control over this.
Any help or tips would be appreciated.
Thanks and regards,
Pazhanikanthan. PHi,
Thanks for your response. I do agree it is not the problem with the Multipart Classes.
Kindly see the following URL for the differences between RequestDispatcher.forward () and response.sendRedirect ().
http://www.theserverside.com/discussion/thread.jsp?thread_id=742
Here they say that "the request and response objects remain the same both from where the forward call was made and the resource which was called." Is this wrong?
More over I found that MultipartParser doesnt improve the performance very drastically over the MultipartRequestObject ...
Please find attached the time I have calculated in between the time I forward / redirect in Servlet to the time when the response is painted in the Screen.
Using Send Redirect Method (in Seconds)
=======================================
MultipartParser.java
170.156
MultipartRequestObject.java
172.422
Using requestDispatcher.forward () (in seconds)
==============================================
MultipartParser.java
Browser Times out
MultipartRequestObject.java
Browser Times out
Here is my code:
public void doPost(HttpServletRequest request,HttpServletResponse response)
throws ServletException, IOException
HttpSession objSession = request.getSession(true);
String strFilePath = "D:\\uploads";
String strFilename = "";
MultipartRequestObject clsMulti;
MultipartParser clsMultiParser;
try
System.out.println ("Action is :" + request.getParameter ("hdAction"));
if (request.getParameter ("hdAction") == null)
clsMultiParser = new MultipartParser (request, 1*1024*1024);
Part objPart = clsMultiParser.readNextPart ();
if (objPart != null)
FilePart objFilePart = (FilePart) objPart;
System.out.println ("The File Name is : " +objFilePart.getFileName ());
objFilePart.writeTo (new File (strFilePath + File.separatorChar + objFilePart.getFileName ()));
clsMulti = new MultipartRequestObject (request, strFilePath, 1*1024*1024);
Enumeration enumFiles=clsMulti.getFileNames();
while(enumFiles.hasMoreElements())
String strName=(String)enumFiles.nextElement();
strFilename = clsMulti.getFilesystemName(strName);
catch(Exception expGeneral)
System.out.println ("" + new java.util.Date () + "----" + expGeneral.getMessage ());
objSession.setAttribute ("MESSAGE", expGeneral.getMessage ());
try
System.out.println (1);
RequestDispatcher dispatcher = this.getServletContext().getRequestDispatcher("/Upload.jsp");
System.out.println (2);
java.util.Date dt1 = new java.util.Date ();
System.out.println (dt1.getTime ());
dispatcher.forward(request, response);
System.out.println (3);
java.util.Date dt1 = new java.util.Date ();
System.out.println (1);
System.out.println (dt1.getTime ());
response.reset ();
System.out.println (2);
response.sendRedirect ("Upload.jsp");
System.out.println (3);
return;
catch (Exception e)
e.printStackTrace ();
For testing pupose I have commented some part of the code.
Thanks and regards,
Pazhanikanthan. P -
In 5.6 do you know how I can forward a request within a servlet that contains query string parameters.
This does not work:
RequestDispatcher rd = request.getRequestDispatcher("/content/geometrixx/en?message=Test");
rd.forward(request, response);See discussion here: http://sling.markmail.org/thread/6b3e3sxe2c6plkcj
-
Forwarding requests on to non-java pages from servlet.
I have designed a web application using a form of single controller pattern.
I have a number of JSPs.
Each of these JSP's has a form element which if submitted got to a single servlet (Controller)which then forwards on the request to a different class based on the paramter passed. For example this form would call the SubmitFeedback class.
<form name="feedbackform" method="post" action="<%=request.getContextPath()%>/controller">
<input type="hidden" name="action" value="SubmitFeedback"/>
<input type="hidden" name="page" value="feedback.jsp">
<tr><td><input type="submit" name="go" value="Go"/></td></tr>
</table>
</form>After the class has done its processing it returns what page to go next to the Controller class and this forwards the request on. to the next jsp
String nextPage = createAction(request.getParameter(PARAM_ACTION)).handleRequest(this,request, response, request.getParameter(PARAM_PAGE));
request.getRequestDispatcher(nextPage).forward(request, response);
return;This is all fine but now I have a sitation where after the user submits the form I want do some processing then forward them onto another page which is not part of my system, nor java. But the RequestDispatcher is only for the current Context within a Servlet Container.
Could someone explain how I do this, what am Im missing please.i am not a JavaScript expert, so I can't be sure this is everything, but:
1) The javascript has to be put inside a <script></script> block (you also had an extra close bracket):
<script type="text/javascript">
<!--
function validateAccept() {
toReturn=true;
if (form.accept.checked==false) {
alert("You must select at least one checkbox to search");
toReturn=false;
return toReturn;
//-->
</script>The script block is usually put in the head section also, but that is not necessary.
2) I would call this function from the onsubit event of the form rather than the onclick of the submit button
<form name="form" action="..." method="post" onsubmit="return validateAccept();">
//...3) You will need to identify the form that you want to use inside the function. Just using the name form won't work, it has to be retrieved from a certain context. The easiest thing is to pass it in as a parameter:
<script type="text/javascript">
<!--
function validateAccept(form) {
<form name="form" action="..." method="post" onsubmit="return validateAccept(this);"> -
Forward Request giving java.lang.IllegalStateException
Hi Friends,
I am using RequestDispatcher to forwrd my request from one servlet to another
Here's the code
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class TryServlet extends HttpServlet
public void service(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc:odbc:con";
Connection con= DriverManager.getConnection(url,"scott","tiger");
Statement stmt=con.createStatement();
ResultSet rst=stmt.executeQuery("select * from Projects");
response.setContentType("text/html");
PrintWriter out=response.getWriter();
while (rst.next())
String firstname=rst.getString("PIN");
String lastname=rst.getString("ProjectTitle");
out.println("<p> Name:"+firstname+" "+lastname+"");
con.close();
RequestDispatcher rd=getServletContext().getNamedDispatcher("HelloServlet");
rd.forward(request,response);
return;
catch(Exception e)
e.printStackTrace();
I m getting the error
java.lang.IllegalStateException: Cannot forward after response has been committed
i need to include the two rows of tables before i forwad the request to HelloServlet
What needs to be done?
thanx
PoojaDon't spread the generation of output over several servlets. Your first servlet should retrieve the data and your second servlet should display the data.
Store the data retrieved as a request attribute before forwarding:
// Data.java
public class Data {
public String _firstname;
public String _lastname;
public data(String firstname, String lastname) {
_firstname = firstname;
_lastname = lastname;
return;
// TryServlet.java
public class TryServlet extends HttpServlet
List list = new ArrayList();
while (rst.next()) { // store data in list
String firstname=rst.getString("PIN");
String lastname=rst.getString("ProjectTitle");
Data data = new data(firstname, lastname);
list.add(data);
con.close();
request.setAttribute("list", list); // store list in request
RequestDispatcher rd=getServletContext().getNamedDispatcher("HelloServlet");
rd.forward(request,response); // list is forwarded as well
return;
}In HelloServlet, you get the request's attribute and display the data:
List list = (List)request.getAttribute("list"); // retrieve list from request
Iterator it = list.iterator();
while (it.hasNext()) { // retrieve data from list and display
Data data = (Data)it.next();
out.println("<p>Name: " + data._firstname + " " + data._lastname + "</p>");
}Btw, for displaying the data, a JSP will do better.
Two Bears.
Maybe you are looking for
-
PDF files to create a new book in iBooks Author
Is it wise to use ready PDF files to create a new book in iBooks Author? I have a music book with lot's of images that whas previously published as a physical book. I have it all as ready PDF files with illustrations. Should I copy paste all texts an
-
How to automate the process of vendor invoice verificaiton from SAP
My client to scan the Invoice (once it is received from vendor), upload it in SAP, the User will look at the Invoice in SAP and then perform Invoice Verification in MIRO. The Process mechanics is 1.Plant Manager will receive the Invoice physically by
-
SPA3102 - Line 1 - Outgoing VOIP calls fail
I recently reset my SPA3102. After configuring Line 1; I am able to receive VOIP & PSTN calls on the analog phone attached but unable to make outgoing VOIP calls, I can only make outgoing calls via PSTN. My dial plan is as follows: (xx.|<#9,xx.<:@gw0
-
I've been having problems with my computer restarting whenever I tried to use Chrome or play any games. I found out that the reason for this was that the DIsk % on the Task Manager showed 100% usage. After some time, it'd crash and give the Critical
-
Hi guys, I am using Oracle 10g. One of this days I made a script to be run in sqlplus. It work very well on a table with 1000 rows, but in a table with 31000000 don't...do you know why? declare cursor cursor_clean is select table_A_eid from table_A w