Redirect a page with JSP

Hi there,
How do you redirect a page using JSP. For example I create a login screen and once a user click on the login button it goes to validate page and validate the userID and password. If the userID and password is correct I want to redirect to the application else redirect to a Fail login screen.
Thanks in advance with any help.
Nite()
null

Hi Slag,
Thanks for your help, it work. Now another problem is I am trying to write a code that validate the password and it didn't check the request.getParameter. Here are the following code:
<% if (request.getParameter("password") == null) { %>
<jsp:forward page="LoginFailed.jsp" />
<% } else { %>
<%@ include file="untitled1.jsp" %>
<%
%>
If I run the response page(current page) it work, it actually see it null and populate the LoginFailed.jsp page, but when I run the login page and it didn't check against the statement.
Thanks in advance,
Nite()
null

Similar Messages

  • How can I create a Login-page with jsp???

    Hello,
    I have to create a page with JSP code on the Netweaver Developer Studio.
    But I do not know how I do it.
    Can anyone tell me what to write in the portalapp.xml?
    An example would be very helpful.
    Thank you
    Greetings

    As you can see in the example:
    The portalapp.xml file (deployment descriptor) provides configuration information for your application, and defines the components and services in your application. For each component and service, you specify the implementing Java class and configuration information.
    For more information on the format of the portalapp.xml, see Deployment Descriptor (portalapp.xml).
    <application>
        <application-config>
            <property name="SharingReference" value="com.sap.portal.navigation.service, com.sap.portal.navigation.api_mimeservice, com.sap.portal.navigation.helperservice"/>
            <property name="Vendor" value="MY_COMPANY"/>
            <property name="SecurityArea" value="PERMISSION"/>
        </application-config>
        <components>
            <component name="SimpleNavigationExample">
                <component-config>
                    <property name="ClassName" value="MY_CLASS"/>
                    <property name="SecurityZone" value="no_safety"/>
                </component-config>
                <component-profile/>
            </component>
        </components>
        <services/>
    </application>
    You can only update in this example, your class name and other details:
    <property name="Vendor" value="sap.com"/>
    <property name="SecurityArea" value="MyCompany"/>
    <property name="ClassName" value="LOGINCLASS"/>
    <property name="SecurityZone" value="no_safety"/>
    Modify this portalapp.xml file as follows:
           1.      NAVIGATION SERVICE, so you must add references to the following portal applications that define these services:
            com.sap.portal.navigation.service
            com.sap.portal.navigation.api_mimeservice
            com.sap.portal.navigation.helperservice
           2.      In the <application-config> section, create the following properties that help to define the security zone for all components and services in this application:
    ○     Vendor: String identifying the company or organization that provided the application, for example, sap.com.
    ○     SecurityArea: String identifying the security area for the application, for example, NetWeaver.portal.
           3.      In the <component-config> section for the mySiteMap component, create the property SecurityZone to define the specific security zone for the component.
    For Permission, check this document:
    http://help.sap.com/saphelp_nw04s/helpdata/en/44/489e2df5ee4e35e10000000a1553f6/frameset.htm

  • Building HTML page with JSP from different applications

              Hi,
              we need to build a HTML page with 2 JSPs. If both JSP were in the same Application
              (Weblogic 8,1) there is no problem. But I have to use JSPs from differents web
              applications, each JSP is in different war files.
              How can I compose this page? How can I management the request object?
              thanks
              

    Your program print the whole jsp source code??
    This is your web server configuration problem.
    Your web server handle your jsp page like text file only.

  • Accessing form field on a page with JSP code on the SAME page

    Hello people,
    This is what i want to do...
    I need a profile form for my project wherein the user can update his profile.
    it has a username field. I want the username to be changeable at any point of time.
    if the user wishes to change his username he simply goes to the Change_Profile page (the one im talking about) and changes it.
    But the username should not conflict with the username that any other member might have already chosen
    so i put a button on the form right below the field "username" for the user to check for the username's availability.
    I want the following things to happen when the user types a username and clicks on this button (which is not a submit button)
    1. I want to access my MS SQL 2000 server database and check for all usernames accepted by that form
    2. I want to compare each with this username
    3. I want to show the result to the user on the very same page+*. that is "Username available" or "Username Taken"
    4. I want to show the result using an alert message from javascript+*
    help me if u can please.

    1. Don't do SELECT * FROM users for fun unless you want to list them all to the client.
    2. Use a WHERE clause in your query and just check if it returns zero rows or not.
    3. Let the servlet with the business logic forward the request to the same page using RequestDispatcher.
    4. Let the JSP print the Javascript code to the response based on a condition.

  • Linking to other pages with JSP

    Hi guys,
    I'm just getting my feet wet with creating Java portlets, so sorry if this question has been answered many times before and seems ridiculously simple.
    Say I have two pages in portal. Page A has JSP portlet 1. Page B has portlet 2, also JSP.
    What I want to do is create a link in portlet 1 on page A, clicking on which will navigate the browser to page B and pass a parameter (through the querystring?) to portlet 2.
    How do I go about doing this? If anyone has an answer, or a place i can find documentation about this, I would be thrilled.
    TIA

    Hi,
    The JPDK parameters & events sample does exactly the same thing. Register the event provider & add these portlets to your page. The provider.xml for event provider is located at %OC4J_PORTAL%/j2ee/home/applications/jpdk/jpdk/WEB-INF/providers/event
    Also go through the eventform.jsp & publicparam.jsp in the WEB-INF/htdocs/ folder. However, before starting with this, if you are not too familiar with the "Parameters and Events" concept, you should start from the document overview.parameters.events.html at %PDK_EXTRACT%/pdk/articles
    Hope this helps,
    Abhinav

  • Random blank pages with JSPs

    I've written several web applications, and I've never encountered this before. I have a servlet and several JSPs. As I continue to run the application as I am developing it, I am having problems where a page will be blank. What I see is a URL with the servlet context plus a parameter for the page name that should be going to the servlet. If I click the back button in the browser, and do the exact same thing again, that post request is sent to the servlet, processed correctly, and a new JSP is dispateched to present a web page. That is, when I can't predict it, a page does not render because it seems as though the post request does not actually reach the servlet but this does not happen most of the time. I can't figure out how to debug it, since it happens at random moments on random pages. I'm running on tomcat 5.1. Any suggestions for how to debug this? My log for the application (created by log4J) shows nothing, nor does catalina.out or current localhost log file. Thanks.
    Ken

    No I didn't decide to revert back, I just wanted to see if by going back I would get blank pages again. And I did. My wife's iPad is now on Google and is working fine, so that does seem to be the solution, despite BT's Chat advisor claiming that it could not possibly be their DNS server.
    Yeah, I will change the router's DNS if it's still OK in a few hours. I gave up with the BT HH a few days after installation when I got fed up of constant (hourly) WiFi dropouts. BT kindly sent me a replacement and that was even worse ; the HH really is junk, and I hate not having control over router settings anyway. I've always been happy with Linksys so went for an EA4500, which has been great. Oh, and I also have an old WRT54GS running DD-WRT as a wireless bridge to reach the parts of the house and garden that are out of range of the 4500.
    Finally, thanks for your help.

  • Finding full address of page with JSP

    Hi everyone,
    I'm trying to find a way to find the complete address of the current JSP page.
    My JSP pages are going to be hosted on different machines and I don't want to hard code anything. I'm sure there is a dead easy way to do this but I can't figure out how!!
    Thanks in advance,
    Chris

    out.println(request.getRemoteHost()+request.getRequestURI());
    will return the full address of your current page

  • How Use Multi Pages with JSP pages

    I have a lot of records, so i want to display from 10 to 10 and use a numeric menu in the botton of the page. the problem is how a make that with java code and html or java script.
    thanks for your help
    LeonMex. from M�xico City

    Search for pager taglibs. Ur solution lies there.
    Moreover u can refer www.jsptags.com , I am using the pager taglib from jsptags and it's quite easy to use.
    Hope that Helps.
    thanks and regards.

  • Rewrite a complete HTML page with all result inside with JSP

    i have generate a HTML page with JSP. Then by an action on a menu on the left frame,i have to rewrite this page with the data already seized, and more code inside(i.e complete the page).
    How can i do ?

    Use JavaScript to tell the other frame to reload or to go to another location. Generate the JavaScript if you're processing a request of the menu...

  • Why my page can't redirect under Struts with Javascript?

    I use Javascript in Struts,like follows:
    <script language="JavaScript">
    <!--
    function goURL(tmp){
    alert(tmp);
    document.forms[0].action="/log.do?action="+eval(tmp);
    document.forms[0].submit();
    -->
    </script>     
    <html:form method="post" action="log.do">
    <html:link page="/log.do?action=First">First Page</html:link>
    <html:select property="pageID" size="1" onchange="javascript:goURL(this.options[this.selectedIndex].value)">
    <option value="0">First</option>     
    <option value="1">Second</option>
    <option value="2">Third</option>     
    </html:select>
    </html:form>when click "First Page",I can redirect my page to log.do page,but when I change the value of select,I find my page don't redirect to the log.do page,why? I am puzzled with it! Anybody can tell me how to redirect my page with Javascript under Struts?
    Thanks

    Except for naming your function onEnterFrame (an AS2 term), the code works okay.

  • Set headers with jsp

    hi,
    i try to make a download page with jsp. here is my code:
    <%@ page import="java.io.*,javax.servlet.*,java.util.* "%>
    <%          
    String filename = "super.zip";
    response.setContentType("application/octet-stream");
    response.setHeader("Content-Disposition","attachment; filename=\""+filename+"\"");
    response.setHeader("Pragma","Public");
    //is it correct to set headers like this
           FileInputStream fis = null;
           BufferedInputStream bis = null;
           ByteArrayOutputStream baos = null;
           int aux;     
           try
                     File f = new File("c:\\" + filename);
                     fis = new FileInputStream(f);
                     bis = new BufferedInputStream(fis);
                     baos = new ByteArrayOutputStream();
                   while ((aux = bis.read())!=-1)
                        baos.write((byte)aux);
                   baos.writeTo(response.getOutputStream()); //is it correct to return the content to browser like this     
           finally
                   if (bis != null)
                        bis.close();     
    %>and the error i get is
    getOutputStream() has already been called for this response
    i need immediate help. i hope someone knows the answer. thanks...

    Hi,
    I had the same problem yesterday then I found the answer here:
    http://forum.java.sun.com/thread.jsp?forum=45&thread=373667
    The issue is that you can not have PrintWriter and OutputStream at
    the same time.
    Rachel

  • Migrate UIX pages to JSP

    Hi,
    We are trying to migrate UIX pages in our application to JSP pages. We will be keeping out service layer same but, just wanted to replace UIX page with JSP. Can someone guide me to useful information for this migration ? like ...is there any plugin available in JDeveloper or any other info regarding UIX to JSP migration
    Thanks,

    There seem to be some tool from ATG to convert JHTML to JSP:
    http://www.atg.com/en/pages/innovator/techtalk02.html
    From reading this site:
    http://www.dewpoint.com/education/3_1_2_atg.html
    It seems that there is a Dynamo JSP Tag library - you can import it into JDeveloper to make your development easier.
    JDeveloper doesn't have specific features realted to dynamo, just general features that help you work with JSP.

  • Problems with JSP in Firefox

    I have seen several references to this problem on this forum but no real solution on any of the pages I have found. My jsp, which right now is no more than a static HTML page with jsp as the extension so that I can add the java code later, will not display in firefox it only shows the source code when I go to my website. Some example code is below.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
         <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
         <title>
              Sichutech.com
         </title>
         <link rel="stylesheet" href="theme/NewMaster.css" type="text/css">
    </head>
    <body>
              <div class="spacer"> </div>
              <div id="banner" align="left">
                    <img src="images/logocropped.png">
              </div>
                        <br class="clearboth">
                        <div class="spacer"> </div>
                        <div id="row1col1" align="left">
                   <img src="images/home.png"><br>
                   <img src="images/mission.png"><br>
                   <img src="images/about.png"><br>
                   <img src="images/services.png"><br>
                   <img src="images/contactus.png">
              </div>
              <div id="row1col2" align="left">
                   <img src="images/worldwide.png"><br><br>
                   <p>
                        <b>Stand alone application development:</b><br><br>
                        We provide stand-alone application development for businesses of any size.
                        Our applications are developed in Java using best standards and practices.
                   </p>
                   <p>
                        <b>Web Development:</b><br><br>
                        We provide custom web development for businesses of any size. We use J2EE
                        technologies to develope all web applications. These technologies consist
                        of Java, Javascript, Java Beans, HTML, JSP, XML, and other technologies as
                        applicable.
                   </p>
                   <p>
                        <b>Questions:</b><br><br>
                        For a quote on a custom stand-alone or web application to meet your business
                        needs please contact us through the contact us page.
                   </p>
              </div>
              <br class="clearboth">
              <div class="spacer"> </div>
              <div id="footer">
                   Home 
                   Mission
                   About Us
                   Services
                   Contact Us
                   &#149;
                   Copyright &copy; Sichutech 2008 All Rights Reserved
              </div>
              <br class="clearboth">
         </body>
    </html>
    The website is up and running and displays fine in IE but not firefox. The site address is www.sichutech.com
    Any help is greatly appreciated.
    Thanks,
    Robert

    Here is what I see at the response headers:
    Date: Wed, 06 Aug 2008 02:37:52 GMT
    Server: Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.8b DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 mod_jk/1.2.25 mod_perl/2.0.4 Perl/v5.8.8
    Last-Modified: Mon, 04 Aug 2008 22:42:24 GMT
    Etag: "aa0088-602-453aa0d911400"
    Accept-Ranges: bytes
    Content-Length: 1538
    Content-Type: text/plain
    X-Antivirus: avast! 4
    X-Antivirus-Status: Clean
    200 OKNote the content type: it is text/plain instead of text/html. And FireFox interpreted it correctly as text/plain.

  • Suddenly getting "Firefox wants to redirect a page" ?

    Since Jan 1, when I go to certain sites (local news, for instance) I get a dropdown bar saying "Firefox wants to redirect this page" with an 'allow " button. And I click the allow or the X to stop it and guess what? It does it again. What's going on?

    See: [http://kb.mozillazine.org/Menu_differences Tools > Options] > Advanced > General : Accessibility : [ ] "Warn me when web sites try to redirect or reload the page"
    * [[Options window - Advanced panel#General_tab]]
    See also: http://kb.mozillazine.org/accessibility.blockautorefresh

  • Redirect page with POST method in JSTL

    how to redirect page with POST method in JSTL.
    below is the code that i make, but the page redirected with GET method,
    so, the URL shown as http://localhost:8080/tes2/coba2.jsp?nama=saya
    how to hide the parameter, so it didn't show at the URL..??
    anybody help me..??
    server1 -> coba1.jsp
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <html>
    <head>
    <title>coba1</title>
    </head>
    <body>
    <c:url value="http://localhost:8080/tes2/coba2.jsp" var="displayURL">
      <c:param name="nama" value="saya"/>
    </c:url>
    <c:redirect url="${displayURL}"/>
    </body>
    </html>server2->coba2.jsp
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    <html>
    <head>
    <title>coba2</title>
    </head>
    <body>
    <c:forEach items="${param}" var="currentParam">
            <li><c:out value="${currentParam.key}" />
                = <c:out value="${currentParam.value}" /></li>
          </c:forEach>
    </body>
    </html>

    There are other two way communications methods as well. One such would be:
    Server1Page1: Take response with parameters.  Use HttpURLConnection to make a request to DataInputServlet
                  on Server2 and send the parameters there with a POST operation
    Server2DataInputServer: Takes request with data in it and starts a new session.  Puts the data into the session and
                  returns the session id to the requester
    Server1Page1: Reads the response from the DataInputServer (the session id) and generates a sendRedirect to
                  Server2's display page using the session id.  Server1Page1 is now done.
    Server2Page1: Gets a request from the client with the session id, and pulls the parameters out of the session.  Then
                  can continue as normal.Server2Page1 can also do a quick refresh to itself not using the session id as well, which will keep the URL visible by the client relatively clean.

Maybe you are looking for

  • Help getting my xbox 360 to see my shared external drive

    I have an Xbox 360 that is hard wired to my Airport Extreme. I also have an external hard drive hard wired sharing on my network. I am trying to get the Xbox to see the shared drive so that I can view my content. I searched all over the internet tryi

  • Sequence settings for MPEG

    Hello Which is the best sequence settings in Premier Pro CS4 to work with MPEG files (720 x 480)? I wish someone can help me because there are no presets available for this format and my redering times are huge. Thank you in advance.

  • Date difference in APEX 4

    Dear APEX Expers, I am working on a small scale application, I have two date fields for employees leave form one is start_date, and other is end_date, first i want to make a check that is user enters end_date less then that of start_date then system

  • LIST OF PO'S PENDING FOR RELEASE

    Hi,    How to findout list po's to be released? Invoices( MIRO) that had manually chnged the amount and quantities during MIRO process?

  • IBooks is not working!

    My ibooks won't download any new books and keeps kicking me out of the app. It worked so good up until I updated ibooks about a year ago, why is it not working?