JSP forward issue

I have a web application deployed on weblogic 8 server. I have a jsp (AddNewUser.jsp) which forwards to a servlet (CreateUserServlet.class) with the following code :
<jsp:forward page="/admin/CreateUser?userID=new"/>In the CreateUserServlet class, I have overriden init(config) as follows:
public void init(ServletConfig config)throws ServletException {
         super.init(config);
        context = config.getServletContext();
}In the doPost method, I have some debug statements as follows:
public void doPost(HttpServletRequest request, HttpServletResponse response) {
System.err.println("--------CreateUserServlet start------- ");
//initialization code here    
context.getRequestDispatcher("/WEB-INF/jsps/admin/createUser.jsp").forward(request, response);
}The flow of actions is :
1. User clicks on a link to AddNew.jsp which forwards to the CreateUserServlet
2. The servlet performs some initialization (not shown) and forwards to createUser.jsp page
3. The createUser.jsp page contains a form which the user fills and clicks "save".
4. The form calls another servlet which saves the new user to the database.
The problem now which I have is that the web application works perfectly on 4-5 test machines except for the client ( what luck huh?). For him this is what happens
1. He clicks on a link to AddNew.jsp, he gets forwarded to the createUser.jsp page (as expected..no problem here!)
2. He enters some data and clicks "save" and the new user gets saved to the database.(as expected..no problem here!)
3. Now, when he tries repeating by clicking on the link to AddNew.jsp page, the debug statement "--------CreateUserServlet start------- " does not get printed to the console!!(HERE IS THE PROBLEM!) but he still gets forwarded to the createUser.jsp page! This is creating a problem because my initialization code is being skipped.
So, the client is able to enter a new user the first time he visits the section but is not able to add thereafter.
Any clues please?

I wonder if what is happening is when he clicks the link to AddNew.jsp teh browser is pulling the page out of cache. That would explain why he gets the CreateUser form without hitting the CreateUserServlet.
It is easy enough to check by enabling the access logs for your server. Then when he clicks on the link check the log to see if the request was recieved on the server and teh responce code is 304
If it is a caching problem there are pleanty of examples of the HTML meta data tags to prevent cahcing on the forum if you search for them.

Similar Messages

  • Servlet to JSP forward issue

    I'm currently developing an app where I use a servlet as the controller and it forwards everything to a jsp for viewing. When I run the jsp as a standalone everything works fine, all of my javascript and css code. When I forward to it, all of my javascript code and css gets lost. Has anyone seen anything like this or have an explanation? Any help would be appreciated.
    Thanks,
    Mike

    Have you tried a different brower or view its textual response with telnet? there are some restricitons regarding servlet outputstream when forward is used (see Servlet spec 2.4 Section SVR.8.4, JSP Spec 2.0 section JSP.5.5). Any server log and stack trace and testcase will be helpful.

  • Jsp forward problem, I think.....

    I have a default.htm page that takes in a feild, EMP_NUM. Once the user
              hits the Submit button, I run a select statement(select.jsp) to see if that
              number exists. If it does then I forward the contents to correct.jsp, if the
              number doesn't exist then I forward to failed.jsp.
              Today is Tuesday, and last Friday I was working on this and everything
              worked fine, in fact perfect. I came in this morning to do some more
              testing, specifically catching errors in my try and catch, example - to make
              sure they enter in a number, and after I type in a number and hit the submit
              button, it trys to go to the next page, but displays nothing, the page is
              blank. Where has before, when everything was working fine on Friday, my
              correct.jsp page or my failed.jsp page would be displayed.
              From Friday to Tuesday I had not made any changes to my files. The only
              thing different, that I can think of, would be that on Friday I would have
              stoppped weblogic and this morning I started weblogic again. This is why I
              think this is a weblogic issue or syntax on my part. I have tried to restart
              my computer, restart weblogic, and I even deleted the .java files that
              weblogic creates and places in the weblogic/myserver/classfiles/jsp_servlets
              folder.
              Below is my source code.
              Please help!
              Thanks, jl.
              <% try {
              <%@ include file = "db_conn.jsp"%>
              <%
              // A Statement object is what sends your SQL statement to the db
              Statement stmt = conn.createStatement();
              // Retrieve the user id number from the previous form.
              int EMP_NUM = Integer.parseInt(request.getParameter("EMP_NUM"));
              //SQL prepared statement
              String selectEMP_NUM = "SELECT NAME, COMPANY_KEY FROM WTS_PROFILE WHERE
              EMP_NUM=?";
              PreparedStatement psEMP_NUM = conn.prepareStatement(selectEMP_NUM);
              psEMP_NUM.setInt(1, EMP_NUM);
              ResultSet rsEMP_NUM = psEMP_NUM.executeQuery();
              String NAME = "";
              int CompanyKey = 0;
              while (rsEMP_NUM.next()) {
              NAME = rsEMP_NUM.getString("NAME");
              CompanyKey = rsEMP_NUM.getInt("COMPANY_KEY");
              }// end of while
              psEMP_NUM.clearParameters();
              psEMP_NUM.close();
              conn.close();
              String sEMP_NUM = Integer.toString(EMP_NUM);
              String sCompanyKey = Integer.toString(CompanyKey);
              if (NAME.equals("")) {
              request.setAttribute("EMP_NUM", sEMP_NUM);%>
              <jsp:forward page="failed.jsp">
              <% }// end of if
              else {
              request.setAttribute("NAME", NAME);
              request.setAttribute("EMP_NUM", sEMP_NUM);
              request.setAttribute("CompanyKey", sCompanyKey);%>
              <jsp:forward page="creditcard.jsp">
              <% }// end of else
              }// end of try1
              catch(Exception e) {
              <% if(e.toString().equals("java.lang.NumberFormatException: ")) { %>
              <font face="Arial" size="2" color="red"><center><strong>Please enter in a
              EMPLOYEE ID NUMBER.<br><br></strong></font></CENTER>
              <%}// end of if
              %>
              </TD></TR></TABLE></DIV>
              <font color="red">"<%=e.toString()%>"</font>
              <%
              }// end of catch1
              %>
              

              Sounds like you have some debugging to do. If you didn't reinstall WLS and it worked fine before,
              then I doubt it is a WLS problem.
              Is your page really blank? Try show source in your browser? I think you have some mismatched
              <table> </table>. Try it in both IE and Netscape - one of them forgives you for mismatched table
              tags.
              Add some System.out.println() in your code to see what is being executed.
              "james lorenzen" <[email protected]> wrote:
              > I have a default.htm page that takes in a feild, EMP_NUM. Once the user
              >hits the Submit button, I run a select statement(select.jsp) to see if that
              >number exists. If it does then I forward the contents to correct.jsp, if the
              >number doesn't exist then I forward to failed.jsp.
              > Today is Tuesday, and last Friday I was working on this and everything
              >worked fine, in fact perfect. I came in this morning to do some more
              >testing, specifically catching errors in my try and catch, example - to make
              >sure they enter in a number, and after I type in a number and hit the submit
              >button, it trys to go to the next page, but displays nothing, the page is
              >blank. Where has before, when everything was working fine on Friday, my
              >correct.jsp page or my failed.jsp page would be displayed.
              > From Friday to Tuesday I had not made any changes to my files. The only
              >thing different, that I can think of, would be that on Friday I would have
              >stoppped weblogic and this morning I started weblogic again. This is why I
              >think this is a weblogic issue or syntax on my part. I have tried to restart
              >my computer, restart weblogic, and I even deleted the .java files that
              >weblogic creates and places in the weblogic/myserver/classfiles/jsp_servlets
              >folder.
              >
              >Below is my source code.
              >Please help!
              >Thanks, jl.
              >
              ><% try {
              > <%@ include file = "db_conn.jsp"%>
              ><%
              > // A Statement object is what sends your SQL statement to the db
              > Statement stmt = conn.createStatement();
              >
              > // Retrieve the user id number from the previous form.
              > int EMP_NUM = Integer.parseInt(request.getParameter("EMP_NUM"));
              >
              > //SQL prepared statement
              > String selectEMP_NUM = "SELECT NAME, COMPANY_KEY FROM WTS_PROFILE WHERE
              >EMP_NUM=?";
              > PreparedStatement psEMP_NUM = conn.prepareStatement(selectEMP_NUM);
              > psEMP_NUM.setInt(1, EMP_NUM);
              >
              > ResultSet rsEMP_NUM = psEMP_NUM.executeQuery();
              >
              > String NAME = "";
              > int CompanyKey = 0;
              > while (rsEMP_NUM.next()) {
              > NAME = rsEMP_NUM.getString("NAME");
              > CompanyKey = rsEMP_NUM.getInt("COMPANY_KEY");
              > }// end of while
              >
              > psEMP_NUM.clearParameters();
              > psEMP_NUM.close();
              > conn.close();
              >
              > String sEMP_NUM = Integer.toString(EMP_NUM);
              > String sCompanyKey = Integer.toString(CompanyKey);
              > if (NAME.equals("")) {
              > request.setAttribute("EMP_NUM", sEMP_NUM);%>
              > <jsp:forward page="failed.jsp">
              ><% }// end of if
              > else {
              > request.setAttribute("NAME", NAME);
              > request.setAttribute("EMP_NUM", sEMP_NUM);
              > request.setAttribute("CompanyKey", sCompanyKey);%>
              > <jsp:forward page="creditcard.jsp">
              ><% }// end of else
              >}// end of try1
              >catch(Exception e) {
              ><% if(e.toString().equals("java.lang.NumberFormatException: ")) { %>
              > <font face="Arial" size="2" color="red"><center><strong>Please enter in a
              >EMPLOYEE ID NUMBER.<br><br></strong></font></CENTER>
              ><%}// end of if
              >%>
              > </TD></TR></TABLE></DIV>
              > <font color="red">"<%=e.toString()%>"</font>
              ><%
              >}// end of catch1
              >%>
              >
              >
              

  • Can a .jsp contain more then one jsp:forward page

    Can a .jsp contain more then one jsp:forward page if it's conditional.
    ie. if condition true
    forward to pageA
    else
    forward to pageB?
    Thank you.

    gimbal2,
    Thanks for the response. I did try it and I got a
    compile error. I just realized that the error was
    regarding a different issue.
    JJIn that case, it would have been appropriate to post the actual problem.

  • Filter problem with jsp:forward

    Greetings,
    I was trying to implement compression filter in oc4j. Basically wrap a HttpResponseServletResponseWrapper using a GZipOutputStream for supported browsers. However whenever for eg: I have a.jsp which does jsp:forward page =b.jsp I can see in TCP monitor IllegalStateException response already committed. But I dont see any stack trace in server logs. The buffer size is 2048 and I am pretty sure it did not get filled up before the forward. I would appreciate if anybody has seen such behavior using wrapped response in OC4j(the same code works fine in tomcat and websphere). Also one thing I observed is that for every jsp:include the filter is being called (to handle this I create the wrapper if its not already there and maintain entry count into filter and decrement when I exit filter and finish gzip response when entry count become 0,which works fine). I believe that this is not a part of 2.3 spec.Even in 2.4 spec if the filter config in web.xml is not set to any value by default the filter is supposed to be in request scope. I really appreciate any pointers in resolving this

    I am pasting the stack trace for broken pipe exception. Please let me know if anybody knows the resolution. Please let me know if there is any other way to enable compression of jsp in oc4j in 9 version. The same code works in Jboss/tomacat websphere ! Also from the stack trace we can see that filter is being called for each forward and its not as per 2.3 servlet specification. Even in 2.4 by default the filter is supposed to work at request level.
    Also I have another question oc4j seems to be using hard coded value: if length is more than 100k or so it uses Transfer-Encoding chunked. Is there any clean way of disabling this behaviour for .js files? the reason is for some reason Internet explore does not cache the javascript files properly (sporadically ) when chunked response is used for javascript files.
    4/26/06 4:58 PM: com.evermind.server.http.HttpIOException: Broken pipe
    4/26/06 4:58 PM: at com.evermind.server.http.EvermindServletOutputStream.flush(EvermindServletOutputStream.java:286)
    4/26/06 4:58 PM: at java.io.FilterOutputStream.flush(FilterOutputStream.java:121)
    4/26/06 4:58 PM: at filters.gzip.GzipServletResponseStream.flush(GzipServletResponseStream.java:151)
    4/26/06 4:58 PM: at filters.gzip.GZipServletResponseWrapper.flushBuffer(GZipServletResponseWrapper.java:127)
    4/26/06 4:58 PM: at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:244)
    4/26/06 4:58 PM: at com.evermind.server.http.GetParametersRequestDispatcher.forward(GetParametersRequestDispatcher.java:189)
    4/26/06 4:58 PM: at com.evermind.server.http.EvermindPageContext.forward(EvermindPageContext.java:199)
    4/26/06 4:58 PM: at SecondPage.jspService(_SecondPage.java:83)
    4/26/06 4:58 PM: at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    4/26/06 4:58 PM: at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
    4/26/06 4:58 PM: at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
    4/26/06 4:58 PM: at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
    4/26/06 4:58 PM: at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    4/26/06 4:58 PM: at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
    4/26/06 4:58 PM: at filters.CookieFilter.processRequest(CookieFilter.java:522)
    4/26/06 4:58 PM: at filters.CookieFilter.validateRequest(CookieFilter.java:127)
    4/26/06 4:58 PM: at filters.CookieFilter.doFilter(CookieFilter.java:51)
    4/26/06 4:58 PM: at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
    4/26/06 4:58 PM: at filters.gzip.GZipFilter.doFilter(GZipFilter.java:176)
    4/26/06 4:58 PM: at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:556)
    4/26/06 4:58 PM: at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
    4/26/06 4:58 PM: at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:240)
    4/26/06 4:58 PM: at com.evermind.server.http.GetParametersRequestDispatcher.forward(GetParametersRequestDispatcher.java:189)
    4/26/06 4:58 PM: at com.evermind.server.http.EvermindPageContext.forward(EvermindPageContext.java:199)
    4/26/06 4:58 PM: at FirstPage.jspService(_FirstPage.java:131)
    4/26/06 4:58 PM: at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    4/26/06 4:58 PM: at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
    4/26/06 4:58 PM: at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
    4/26/06 4:58 PM: at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
    4/26/06 4:58 PM: at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    4/26/06 4:58 PM: at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
    4/26/06 4:58 PM: at filters.CookieFilter.processRequest(CookieFilter.java:522)
    4/26/06 4:58 PM: at filters.CookieFilter.validateRequest(CookieFilter.java:127)
    4/26/06 4:58 PM: at filters.CookieFilter.doFilter(CookieFilter.java:51)
    4/26/06 4:58 PM: at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
    4/26/06 4:58 PM: at filters.gzip.GZipFilter.doFilter(GZipFilter.java:176)
    4/26/06 4:58 PM: at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:556)
    4/26/06 4:58 PM: at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
    4/26/06 4:58 PM: at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
    4/26/06 4:58 PM: at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
    4/26/06 4:58 PM: at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
    4/26/06 4:58 PM: at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
    4/26/06 4:58 PM: at java.lang.Thread.run(Thread.java:479)

  • Home Hub 3 Port Forwarding Issue - Question to BT

    Question to BT
    Hello i have recently joined BT Infinity and have hit the issue of the Port Forwarding not working. My HH3 is on the following version of software. Will this version automatically upgrade to the latest version of firmware and will this fix my port forwarding issue?
    As i work in IT (Cisco Network Eng) i need to be able to access several devices/services at home and this is a real pain for me. If you think that this could drag on as some posts have indicated could you please let me know and i will either get a draytek or throw in a cisco 1841.
    Thank you
    Dean.
    Current firmware:
    V100R001C01B031SP09_L_B
    Last updated:
    Unknown

    requiem wrote:
    Question to BT
    Hello i have recently joined BT Infinity and have hit the issue of the Port Forwarding not working. My HH3 is on the following version of software. Will this version automatically upgrade to the latest version of firmware and will this fix my port forwarding issue?.........
    Thank you
    Dean.
    Current firmware:
    V100R001C01B031SP09_L_B
    Last updated:
    Unknown
    Hi Dean
    By the look of it you've got the type B version of the HH3 with current firmware.
    From http://bt.custhelp.com/app/answers/detail/a_id/13073
    The latest versions of the firmware are:
    BT Home Hub 3 – Software version 4.7.5.1.83.8.57.1.3 (Type A) or V100R001C01B031SP09_L_B
    Please Click On any Text in Blue as that automatically links to information.
    PC (NDEGR)

  • Quantum Gateway Port Forwarding issues

    This post can be removed.... the port forwarding worked once I set it up under "Advanced Settings -> Network Settings ->Port Forwarding" instead of "Firewall -> Port Forwarding"
    Hello,
    I am having an issue setting up port forwarding.  I have made several attempts to make port forward TCP 8096, but it continues not to work.  I had it working with no problems at my with my old router before we moved so I know it's not an issue with my computer firewall or antivirus and MediaBrowser is working fine on the local network. Is anyone else experiencing Port Forwarding issues?  Also when will DMZ be enabled on this gateway?
    Any help would be apprciated. I'm trying to setup MediaBrowser so I can schedule recordings when i'm not at home.
    Thanks!
    Armyb77
    This post can be removed

    See kayster contribution here.
    SYNOLOGY DS214 - Remote access via BT Home Hub
    There are some useful help pages here, for BT Broadband customers only, on my personal website.
    BT Broadband customers - help with broadband, WiFi, networking, e-mail and phones.

  • Is the jsp forward tag fails in iplanet application server sp2?

    11/Feb/2002 17:55:41:2] error: Exception: SERVLET-compile_failed: Failed in compiling template: /EinsWebTool/QueryScreen.jsp, Parse error in JSP parser. Missing endtag: /jsp:forward
    Exception Stack Trace:
    java.lang.Exception: Parse error in JSP parser. Missing endtag: /jsp:forward
    at java.lang.Throwable.fillInStackTrace(Native Method)
    at java.lang.Throwable.fillInStackTrace(Compiled Code)
    at java.lang.Throwable.<init>(Compiled Code)
    at java.lang.Exception.<init>(Compiled Code)
    at com.netscape.jsp.JSP.parseBlock(Compiled Code)
    at com.netscape.jsp.JSP.parseReqDisp(Unknown Source)
    at com.netscape.jsp.JSP.parseTag(Compiled Code)
    at com.netscape.jsp.JSP.parseNext(Compiled Code)
    at com.netscape.jsp.JSP.parseBlock(Compiled Code)
    at com.netscape.jsp.JSP.parse(Unknown Source)
    at com.netscape.jsp.JSP.compile(Unknown Source)
    at com.netscape.server.servlet.jsp.JSPCompiler.JSPtoJava(Unknown Source)
    at com.netscape.server.servlet.jsp.JSPCompiler.compileJSP(Compiled Code)
    at com.netscape.server.servlet.jsp.JSPCompiler.compileOrLoadJSP(Unknown Source)
    at com.netscape.server.servlet.jsp.JSPCompiler.compileInstance(Unknown Source)
    at com.netscape.server.servlet.jsp.JSPCompiler.compileInstance(Unknown Source)
    at com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callJspCompiler(Unknown Source)
    at com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callUri(Unknown Source)
    at com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callUriRestrictOutput(Unknown Source)
    at com.netscape.server.servlet.platformhttp.PlatformRequestDispatcher.forward(Unknown Source)
    at com.netscape.jsp.PageContextImpl.forward(Unknown Source)
    at jsp.APPS.EinsWebTool.Login._jspService(Compiled Code)
    at jsp.APPS.EinsWebTool.Login.service(Login.java:42)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown Source)
    at com.netscape.server.servlet.servletrunner.ServletRunner.callJSP(Unknown Source)
    at com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callJspCompiler(Unknown Source)
    at com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callUri(Unknown Source)
    at com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callUriRestrictOutput(Unknown Source)
    at com.netscape.server.servlet.platformhttp.PlatformRequestDispatcher.forward(Unknown Source)
    at com.netscape.server.servlet.jsp.JSPRunner.service(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown Source)
    at com.netscape.server.servlet.servletrunner.ServletRunner.execute(Unknown Source)
    at com.kivasoft.applogic.AppLogic.execute(Compiled Code)
    at com.kivasoft.applogic.AppLogic.execute(Compiled Code)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at com.kivasoft.thread.ThreadBasic.run(Compiled Code)
    at java.lang.Thread.run(Compiled Code)

    Hi,
    Yes, I was able to code this sucessfully and got it working. Here is the code I used...
    <%
    String fortune = (String) request.getAttribute("fortune_string");
    %>
    <HTML>
    <HEAD><TITLE>Fortune Sample Application</TITLE></HEAD>
    <BODY BGCOLOR=#FFFFFF>
    <H2>The Oracular Servlet greets you!</H2>
    <p>
    Your fortune is...
    <%= fortune%>
    <p>
    <p>
    <hr size=0>
    <p>
    <FONT SIZE=2>Sample Applications
    <jsp:forward page="/ias-samples/index.html">
    </jsp:forward>
    </BODY>
    </HTML>
    and I got it working. I believe the code is missing some tag, which I tried, but got error in KJS like...
    [15/Feb/2002 11:23:49:7] info: --------------------------------------
    [15/Feb/2002 11:23:49:7] info: jsp.APPS.fortune.fortune: init
    [15/Feb/2002 11:23:49:7] info: --------------------------------------
    Null text data??
    2002-02-15 11:24:16 - error-the file '\fortune.jsp' generated the following pars
    e exception: org.apache.jasper.compiler.ParseException: C:\iplanet\ias6\ias\APPS
    \fortune\fortune\fortune.jsp(17,0) Expected "param" tag with "name" and "value"
    attributes after the "params" tag.
    In your case, I suspect, either the parser is not able to convert the .jsp file appropriately, or some inappropriate tag. If this doesn't help please send me your code & I can help you on this regard.
    Regards
    Raj
    [email protected]

  • How to use TARGET in jsp:forward ???

    In a link I can use TARGET to display the page in another frame like this:
    <a href="http://localhost:8080/cars/Menu.jsp TARGET=FrameRight>Counties</A>
    Is it possible to do something similar when forwarding a page with the jsp:forward standard action??
    <jsp:forward page=SomePage" /">Would help me out if it was possible.</a>

    No. It is not possible, '<jsp:forward' is not meant for opening the page in a said location. It simply forwards the request to the target jsp. Then your taget JSP will take care of resonding to the request.
    If you want to open the page (jsp) in another frame, just stick on to the anchor tag and append your query string to the target jsp.
    <% String query = "?name=xxx&age=30&dept=22"; %>
    <a href="Target.jsp<%=query%> target="frameright">Counties</a>
    Sudha

  • Problem in jsp:forward

    hi,
    i have a jsp page from where i have to call my servlet.but it is mapped in xml by other name.so what should i do?can i call that servlet using named mapped into the xml.
    can i do this?
    <jsp:forward page="/servlet/web.xml mapping"></jsp:forward>
    it's urgent.
    so please help me.
    kamlesh solanki

    hey man,
    how u doin?
    your problem is quite funny. here in servlet configuration in the xml file there is what we call servlet mapping<servlet-mapping>.
    here is how we map a servlet to a kind of url:
    <servlet-mapping>
    <servlet-name>
    havet
    <servlet-name>
    <url-pattern>
    /havva.jspa
    </url-pattern>
    </servlet-mapping>
    nbow when calling this servlet using this url pattern it now behaves as if its in the main application directory just like where jsps are so u will forward to it like a jsp.
    thats the shizzy.
    ok call it like this now
    <jsp:forward page="havva.jspa" />
    or
    <jsp:forward page="havva.jspa"></jsp:forward>
    since u may be used to this style of calling the tag.
    stay cool and let me know if u had any problems.

  • jsp:forward ... tag in servlet doesn't work in 7.0

              I have a problem with <jsp:forward ... > command.
              I found a post in the newsgroups that this is a bug traced by
              CR078071 and I am stucked because of this problem. Please, send me a patch.
              

              I have a problem with <jsp:forward ... > command.
              I found a post in the newsgroups that this is a bug traced by
              CR078071 and I am stucked because of this problem. Please, send me a patch.
              

  • Jsp:forward failed with 'Response already committed'

    I got a "Response already commited" error when using logic:forward or jsp:forward inside a JSP page fragment that is part of a Struts Tiles layout.
    Here is the code fragment included in the layout.jsp.
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
    <logic:notPresent name="user" scope="session">
         <logic:forward name="login" />
    </logic:notPresent>
    Here is the error message:
    [ServletException in:/WEB-INF/tiles/verifyLogin.jsp] Exception forwarding for name login: java.lang.IllegalStateException: Cannot forward. Response already committed. (Servlet 2.3, SRV 8.4)'

    Jsp normally buffers output in a 8k buffer and write it to the output stream (i.e. "commits") it when:
    1) it is explicitly flushed
    2) the buffer overflow
    3) an jsp include is invoked
    My code is in a layout.jsp file which is referenced in a tiles-definition. The tiles definition is tiles:inserted in a top-level jsp file. I am not sure if tiles uses jsp:include or if there is a way to get jsp:foward to work in the layout.jsp.

  • Problem using jsp:forward in java script

    hi,
    when I use jsp forward tag inside java script i'm getting a problem that
    when the jsp is invoked it is getting forwarded to the page specified in the forward tag, without checking the if conditions. Following code may give you a better idea.
    <html>
    <script>
    function test()
    if(document.f.htemp.value=="true")
    alert("jus");
    else
    var s=document.f.htemp.value;
    alert(s);
    <jsp:forward page="success.jsp" />
    </script>
    <body>
    <form name="f" method=post>
    <input type=text name=htemp value="true">
    <input type=button onclick="test()">
    </form>
    </body>
    </html>
    please help me,thanks inadvance
    regards
    chandu

    What pgeuens means is that you can't mix javascript and jsp/java code in this way.
    ALL of the jsp/java code gets executed at the server end.
    This produces an HTML page (with embedded javascript) which gets sent to the client.
    The client then runs javascript code in response to events (onLoad, onClick, onChange etc etc)
    So in this case, the jsp:forward will always be executed, because as far as the server is concerned, the javascript is just template text.
    If you WANT to do a conditional forwarding on the server side you do it in java ie (horribly using scriptlet)
    <%
    if (testCondition){
    %>
      <jsp:forward>
    %<
    %>Or if you want to test what the client has entered client side, all you can do is submit the form, or navigate to a URL
    <script>
    function test()
    if(document.f.htemp.value=="true")
    alert("jus");
    else
    var s=document.f.htemp.value;
    alert(s);
    document.f1.action="success.jsp";
    document.f.submit();
    </script>You cannot run JSP code based on your javascript code.
    Java. Javascript. Not the same thing.
    Hope this helps,
    evnafets

  • Jsp:forward URL problem

    Hi,
    I have 2 pages X.jsp and Y.jsp
    The content of X.jsp is a simple
    // send an email here
    <jsp:forward page="Y.jsp">
    </jsp:forward>
    The content of Y.jsp is only "Mail is sent" message.
    The problem is that everytime page X is loaded,
    the browser displays Y.jsp content, but the URL in the Address box of the browser still displays X.jsp
    This leads me to reload problem, even though the page displays the "Mail is sent" message, the URL still shows X.jsp, and everytime the browser is reloaded, another mail is sent.
    How to make the URL change to Y.jsp ?
    TIA.

    Hi,
    I have 2 pages X.jsp and Y.jsp
    The content of X.jsp is a simple
    // send an email here
    <jsp:forward page="Y.jsp">
    </jsp:forward>
    The content of Y.jsp is only "Mail is sent" message.
    The problem is that everytime page X is loaded,
    the browser displays Y.jsp content, but the URL in the
    Address box of the browser still displays X.jsp
    This leads me to reload problem, even though the page
    displays the "Mail is sent" message, the URL still
    shows X.jsp, and everytime the browser is reloaded,
    another mail is sent.
    How to make the URL change to Y.jsp ?
    TIA.Thats the natural behavious of forward.
    One simple solution is not to use forward. You can use HTTP redirection rather than forward.
    Hope it helps.

  • Jsp:forward param not getting included in my query string

    Hi,
    On a particular JSP page, mine.jsp, I am forwarding to a servlet ...
    <jsp:useBean id="HotelResortDBBean" class="com.lvcva.database.HotelResortDBBean" scope="request" />
    <jsp:forward page="/meetings/meeting-venues/results">
         <jsp:param name="sqftRange" value="${empty param.meetingsqft ? -1 : param.meetingsqft}" />
    </jsp:forward>This forwards to a servlet, when I query "request.getQueryString", it comes up null. However, when I enter the URL, "mine.jsp?sqftRange=-1", the query string returns "sqftRange=-1" as expected. Can someone tell me what I'm doing wrong in the above that is causing the jsp:param to not be added to the query string?
    - Dave

    a forward does not create a new request, and thus the query string is not altered. If you want the query string to change, use a redirect in stead.
    note: even though the query string does not change, the new parameter IS added to the HttpServletRequest object, so you can still fetch the new parameter from it even with the forward.

Maybe you are looking for

  • AT EXIT-COMMAND in ABAP OO

    Hi everyone! I need to execute some instructions when user exit from the program. Something like AT EXIT-COMMAND in PAI. But i dont have any PAI module or declared flow logic in my screen definition, becouse screen is calling automaticly by abap, i c

  • How to get album art on your iPod nano. Read this.

    I have had problems getting artowrk on my nano from my computer but it was only because I didnt have USB 2.0 outlets on my computer. I used a different computer that had USB 2.0 and it worked fine. Just click the little button under your sources in i

  • IGoogle doesn't fit in window since I updated, reset zoom didn't help

    Also Google maps is missing print button. Other sites like Wells Fargo bank don't function correctly either.

  • N95-2: Cannot find pre-installed applications

    Hi I just purchased a N95-2 series phone. On my phone, the app manager shows Snakes, FIFA08 and asphalt 2 installed. However, these do not appear anywhere in n-gage games application.  Can someone tell me where I can find and access these games? Many

  • 8.1 missing bookmarks

    I just did the 8.1 update and all of my bookmarks in Safari are gone. How can I get these back?