Solved

JSTL Conversion problem

Posted on 2004-10-19
7
543 Views
Last Modified: 2013-11-24
JSP PAGE:
------------

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@ page contentType="text/html;charset=windows-1252"%>
<html>
  <head>
    <title>index page</title>
  </head>

  <jsp:useBean id="userSession" class="view.UserBean" type="view.UserBean" scope="session"/>
  welcome: <jsp:getProperty name="userSession" property="userName"/>
  <body bgcolor="#6565c0">

  <c:url var="inboxURL" value="inbox.jsp">
  <c:param name="folder" value="inbox"/>
  </c:url>
  <p><strong><a href="${inboxURL}"> <P>INBOX</P>
  </a>
 
  <c:url value="compose.jsp" var="composeURL"></c:url>
  <p><strong><a href="${composeURL}"> <P>COMPOSE</P>
  </a>
   
  </body>
</html>



OUTPUT HTML FOR THIS JSP IS :
--------------------------------------
  <html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>index page</title>
  </head>

  welcome: pragna
  <body bgcolor="#6565c0">
  <p><strong><a href="${inboxURL}"> <P>INBOX</P>  </a>
  <p><strong><a href="${composeURL}"> <P>COMPOSE</P>  </a>
   
  </body>
</html>


PROBLEM:
-------------
Example Here conversion from

"${inboxURL}" to "inbox.jsp?folder=inbox" is not taking place

Please say what is problem here and kindly give solution what to do
0
Comment
Question by:expertbharadwaj
  • 4
  • 2
7 Comments
 
LVL 2

Expert Comment

by:siliconeagle
ID: 12348257
you need to use the <c:out/> tag to output data e.g:-
<c:out value="${inboxURL}"/>

if the expression isn't in a tag it doesnt get evaluated hence the ${inboxURL}  doesn't get processed by the server.
0
 
LVL 1

Author Comment

by:expertbharadwaj
ID: 12356425

BUT IN J2EE tutorial pdf  book it is directly used as i used ???

<!-- please see page-482  as shown on top of pages or (524 or 1540) as shown at bottom of accrobat reader -->

Like this

<c:if test="${selectedFlag}" >
<jsp:setProperty name="locales" property="selectedLocaleString"
value="${selectedLocaleString}" />


<jsp:useBean id="date" class="mypkg.MyDate"/>
<jsp:setProperty name="date" property="locale" value="${locales.selectedLocale}"/>

<b>Date: </b>${date.date}
</c:if>

// here value is directly expression

Please see why in this book it is given
0
 
LVL 2

Expert Comment

by:siliconeagle
ID: 12356636
this is JSP 2.0, are you using tomcat 5 or some other JSP2.0 compatible server? if it not the you need the <c:out/> tag as before.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Author Comment

by:expertbharadwaj
ID: 12357303
Im using oracle AS 10 .g
0
 
LVL 2

Accepted Solution

by:
siliconeagle earned 50 total points
ID: 12357775
from
http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jsps/jspconfig/JSPConfig.html

Deactivating EL Evaluation
Since the syntactic pattern ${expr} that identifies an EL expression was not reserved in the JSP specifications before JSP 2.0, there may be situations where such a pattern appears but the intention is not to activate EL expression evaluation but rather to pass through the pattern verbatim. Each JSP page has a default mode for EL expression evaluation. The default value varies depending on the version of the Web application deployment descriptor.

i guess this means that it should work by default but if it an old webapp ported from an older version then maybe the EL wont be enabled, maybe you should make a new web.xml for you app if it's not too much trouble. I guess jDeveloper has functionality to do this.
0
 
LVL 2

Expert Comment

by:siliconeagle
ID: 12357796
In any case <c:out/> will work if you're still having trouble.
0
 
LVL 27

Expert Comment

by:rrz
ID: 12370872
If your app server uses JSP 2.0 , then instead of
><%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
use  
  <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>  

Do you have the jstl.jar( version 1.1) and standard.jar  ?
Did you look at the source(sent to browser) of the output html you posted ?  Are the JSTL tags there ?
Can you get a simple tag to work ? Try  <c:out value="hello"/>

Also the opening tag in your context's web.xml should be for Servlet API 2.4        
rrz
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
what is spring 3 39
Fix45 challenge 15 86
copyEvens challenge 6 63
What is JNDI datasource in spring 1 38
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now