Solved

JSTL Conversion problem

Posted on 2004-10-19
7
547 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
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.

752 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