Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: helping hand required

  1. #1
    Member
    Join Date
    Mar 2011
    Posts
    72
    My Mood
    Cheerful
    Thanks
    14
    Thanked 1 Time in 1 Post

    Default helping hand required

    i'm developing a web app using struts and jsp. jsp are for presentation and struts as controller.
    what i need is to redirect to a page soon after the request is completed.
    E.g. if user wants to change his password then next page should display a confirmation message and now page must be redirected (to the home or somthing else as needed by situation) here in this example it must be the page where the change password link is selected.
    the best example to discribe what i want is whenever we post or reply to some thread then a message is displayed and we are redirected to the same therad again, jsut like this i want to implement in my app.
    please suggest me how to implement it??
    what i tried :
    <jsp:forward -- this happens at sever i want to display a message and then move to another page!!
    even i tried to use scriptlet response.sendRedirect("someUrl"); but i think using scriptlet in jsp is not good practice!!

    beans are used to retrive data from browser.

    please help


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,262
    Thanks
    176
    Thanked 821 Times in 764 Posts
    Blog Entries
    5

    Default Re: helping hand required

    Using HTML (which is I presume what your web app spits out), use the meta tag to redirect a user. An example:
    Tryit Editor v1.4

  3. The Following User Says Thank You to copeg For This Useful Post:

    arvindbis (October 7th, 2011)

  4. #3
    Member
    Join Date
    Mar 2011
    Posts
    72
    My Mood
    Cheerful
    Thanks
    14
    Thanked 1 Time in 1 Post

    Default Re: helping hand required

    that was really helpful! but the problem is that i'm using struts-tiles to create pages. every time i want to display a page i just create that page and then insert layout page into that and provides the necessary details which are needed to name sections to be displayed!
    here is the layout.jsp
    <%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
    <%@taglib prefix="tiles" uri="http://struts.apache.org/tags-tiles" %>
     
    <html>
        <head>
            <title>Rainbow Entertainment<tiles:getAsString name="subtitle"/></title>
        </head>
        <body bgcolor="white">
        <center><table border="0" cellspacing="0" cellpadding="0" width="860">
                <tr height="71">
                    <td align="center" valign="center" width="160" height="71">
                        <img src="<c:url value="/images/rainbow_Entertainment.jpg"/>"
                             alt="Rainbow Entertainment logo">
                    </td>
                    <td bgcolor="#CCCCFF" align="center" valign="center" width="700" height="71">
                        <c:set var="subtitle"><tiles:getAsString name="subtitle"/></c:set>
                        <jsp:include page="/WEB-INF/layout/banner.jsp">
                            <jsp:param name="subtitle" value="${subtitle}"/>
                        </jsp:include>
     
                    </td>
                </tr>
                <tr valign="top">
                    <td bgcolor="#CCCCFF" width="160" align="left">
                        <jsp:include page="/WEB-INF/layout/navigation.jsp"/>
                    </td>
                    <td width="700" align="left">
                        <div style="margin-top: 0.1in;margin-left: 0.1in;margin-bottom: 0.1in;margin-right: 0.1in">
                            <tiles:insert attribute="body" />
                        </div>
                    </td>
                </tr>
                <tr>
                    <td width="160"></td>
                    <td align="right" width="700">
                        Copyright  2011 Rainbow Entertainment
                    </td>
                </tr>
            </table></center>
     
     
        </body>
    </html>

    do tell me what changes i should do to fulfill the requirement as described in Ist post??

  5. #4
    Member
    Join Date
    Mar 2011
    Posts
    72
    My Mood
    Cheerful
    Thanks
    14
    Thanked 1 Time in 1 Post

    Default Re: helping hand required

    now i created a new layout page where the head has that meta tag there. i insert this layout when i need refresh the page !!!
    do tell me if there is any other way to achive this instead of this!

  6. #5
    Member
    Join Date
    Mar 2011
    Posts
    72
    My Mood
    Cheerful
    Thanks
    14
    Thanked 1 Time in 1 Post

    Default Re: helping hand required

    i just don't understand that
    in my app if i click a link once it works fine but if it is clicked twice then an error page is displayed stating that resource not found, the most intresting thing is that the path to resource in error message was never provided in the link!!
    E.g link is set to "views/admin/home.jsp" then it works for the first time but if it is clicked twice then then error genrated will show "views/admin/views/admin/home.jsp" not found!!
    if really confused why this is happening!!
    please hep!!
    regards

Similar Threads

  1. New to Java....still learning...Help Required
    By muraduk in forum What's Wrong With My Code?
    Replies: 2
    Last Post: August 12th, 2010, 03:15 PM
  2. BUmp* **Anyone knows the proces of hand detection algorithm?
    By Cross`17 in forum Algorithms & Recursion
    Replies: 1
    Last Post: May 21st, 2010, 05:11 PM
  3. Help Required
    By javajim in forum Java Networking
    Replies: 0
    Last Post: March 4th, 2010, 08:48 AM
  4. calendar javascript required
    By sagar13 in forum Paid Java Projects
    Replies: 0
    Last Post: February 4th, 2010, 11:57 PM
  5. Help required Please
    By nandhini in forum AWT / Java Swing
    Replies: 1
    Last Post: December 4th, 2009, 08:55 AM