Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 3rd, 2007, 02:02 AM
Registered User
 
Join Date: May 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default need help for jsp code

[size=3]Hi all

i need help for jsp code, am new to jsp and i want use <jsp: include> tag
i wrote the following code but its not working

<%@ taglib prefix="s" uri="http://java.sun.com/jsp/jstl/core" %>

<html>

<s:choose>

    <s:when test ="${param.schedule =='Sunday'}">

    <jsp:include page="mjwn/Sundayschedule.html"/>

    </jsp:include>

    <!-- <head> <title> Sunday Schedule </title></head>

        <body><h1> Sunday Schedule</body> -->

    </s:when>

        <s:when test ="${param.schedule =='Monday'}">

        <jsp:include page="Mondayschedule.html"/>

        </jsp:include>


    <!--<head> <title> Monday Schedule </title></head>

        <body><h1> Moday Schedule</body> -->

        </s:when>

            <s:when test ="${param.schedule =='Tuesday'}">

                <jsp:include page="Tuesdayschedule.html"/>

                </jsp:include>


    <!-- <head> <title> Tuesday Schedule </title></head>

            <body><h1> Tuesday Schedule</body> -->

            </s:when>

                <s:when test ="${param.schedule =='Wednesday'}">

                <jsp:include page="Wednesdayschedule.html"/>


                </jsp:include>

    <!-- <head> <title> Wednesday Schedule </title></head>

            <body><h1> Wednesday Schedule</body> -->

            </s:otherwise>

                <jsp:include page="Thursdayschedule.html"/>

                </jsp:include>


    <!-- <head> <title> Thursday Schedule </title></head>

            <body><h1> Thursday Schedule</body> -->

            </s:otherwise>

</s:choose>

</html>

and i have created a form and put the action= the jsp file name and method= get


thanks in advance

 [/size=5]

 
Old May 3rd, 2007, 07:49 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,
If you look at the following blocks

Quote:
quote:
...
    <jsp:include page="mjwn/Sundayschedule.html"/>

    </jsp:include>
...
        <jsp:include page="Mondayschedule.html"/>

        </jsp:include>
...
                <jsp:include page="Tuesdayschedule.html"/>

                </jsp:include>
...
                <jsp:include page="Wednesdayschedule.html"/>

                </jsp:include>
...
                <jsp:include page="Thursdayschedule.html"/>

                </jsp:include>
...
</html>

you've closed the <jsp:include ...> tag inline and again for the second time you've used closing tag for <jsp:include> [</jsp:include>]
remove the closing tags it'll work.

Use <jsp:include .../> or <jsp:include ...></jsp:include>

Regards,
Rakesh
 
Old May 4th, 2007, 03:06 AM
Registered User
 
Join Date: May 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks alot Rakesh
i have put the closing tag just once as this

<%@ taglib prefix="s" uri="http://java.sun.com/jsp/jstl/core" %>

<html>

<s:choose>

    <s:when test ="${param.schedule =='Sunday'}">

    <jsp:include page="mjwn/Sundayschedule.html"/>

    </jsp:include>

    <!-- <head> <title> Sunday Schedule </title></head>

        <body><h1> Sunday Schedule</body> -->

    </s:when>

        <s:when test ="${param.schedule =='Monday'}">

        <jsp:include page="Mondayschedule.html"/>


    <!--<head> <title> Monday Schedule </title></head>

        <body><h1> Moday Schedule</body> -->

        </s:when>

            <s:when test ="${param.schedule =='Tuesday'}">

                <jsp:include page="Tuesdayschedule.html"/>



    <!-- <head> <title> Tuesday Schedule </title></head>

            <body><h1> Tuesday Schedule</body> -->

            </s:when>

                <s:when test ="${param.schedule =='Wednesday'}">

                <jsp:include page="Wednesdayschedule.html"/>



    <!-- <head> <title> Wednesday Schedule </title></head>

            <body><h1> Wednesday Schedule</body> -->

            <s:otherwise>

                <jsp:include page="Thursdayschedule.html"/>



    <!-- <head> <title> Thursday Schedule </title></head>

            <body><h1> Thursday Schedule</body> -->

            </jsp:include>

            </s:otherwise>



</s:choose>

</html>

and its still not working


 
Old May 6th, 2007, 07:12 AM
Registered User
 
Join Date: May 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OOPs
sorry now i understood what u said

thanks alot Rakesh






Similar Threads
Thread Thread Starter Forum Replies Last Post
JSP code with Linux parry Pro JSP 1 September 4th, 2008 05:54 PM
call activex from jsp code missneg Pro JSP 0 May 3rd, 2006 03:27 AM
jsp code rama_santh JSP Basics 1 April 10th, 2006 06:01 AM
JSP code download? Raj_mhetre JSP Basics 1 January 9th, 2006 11:40 AM
code documentation in jsp allang JSP Basics 0 August 7th, 2005 08:34 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.