Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JSP
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Jeanne Boyarsky
Ron McLeod
Sheriffs:
Paul Clapham
Liutauras Vilda
Devaka Cooray
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
JSP
include directive doesn't work
anarkali perera
Ranch Hand
Posts: 237
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
here is my one
jsp
file
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!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>Insert title here</title> </head> <body> <jsp:useBean id="one" class="MyServlet.MyBean" scope="session"/> <jsp:setProperty name="one" property="name" param="name"/> <jsp:setProperty name="one" property="age" param="age" /> <jsp:setProperty name="one" property="address" param="address" /> <%@ include file="include.jsp" %> <br/> name is <jsp:getProperty property="name" name="one"/> </body> </html>
here is my include jsp file
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!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>Insert title here</title> </head> <body> INCLUDE JSP ${param.address} </body> </html>
but it doesn't print the address value as expected?
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
I like...
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
${sessionScope.one.address}
try this in your include.jsp and let me know if it doesnt work
also read this
ElOrJstlNotWorkingAsExpected
anarkali perera
Ranch Hand
Posts: 237
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
this is my form.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <body> <form action="bean.jsp" method="get"> <table> <tr>name<input type="text" name="name"></tr> <tr>address<input type="text" name="naddress"></tr> <tr>age<input type="text" name="age"></tr> <tr><input type="submit" name="submit" value="submit"></tr> </table> </form> </body> </html>
this is my bean.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!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>Insert title here</title> </head> <body> <jsp:useBean id="one" class="MyServlet.MyBean" scope="session"/> <jsp:setProperty name="one" property="name" param="name"/> <jsp:setProperty name="one" property="age" param="age" /> <jsp:setProperty name="one" property="address" param="address" /> <%@ include file="include.jsp" %> <br/> name is <jsp:getProperty property="name" name="one"/> </body> </html>
this is include.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!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>Insert title here</title> </head> <body> INCLUDE JSP ${sessionScope.one.address} </body> </html>
still it doesn't work
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
I like...
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
EL is working ? if not please go through the link what i mentioned in my first post.
also lets try this also
${param.naddress}
in your include.jsp
anarkali perera
Ranch Hand
Posts: 237
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
but if i use ${param.name} in bean.jsp it is working
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!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>Insert title here</title> </head> <body> My name is ${param.name} <br/> <jsp:useBean id="one" class="MyServlet.MyBean" scope="session"/> <jsp:setProperty name="one" property="name" param="name"/> <jsp:setProperty name="one" property="age" param="age" /> <jsp:setProperty name="one" property="address" param="address" /> <%@ include file="include.jsp" %> <br/> name is <jsp:getProperty property="name" name="one"/> </body> </html>
then it prints "My name is anarkali"
but if i use ${param.name} in include.jsp it is not working?
Thanks tiny ad, for helping me escape the terrible comfort of this chair.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
calling jsp directl from HTML form
retrive serialize files data ERROR
bean value gives null
give another jsp to action
how to re set a existing bean
More...