about jstl in tomcat!

Posted on 2004-10-18
Last Modified: 2013-11-24
this is my some cod in my project:
<jsp:useBean id="idCommunity" class="" scope="page" />

<c:set var="id" value="${}"/>
<c:set var="action" value="${param.action}"/>
<c:set var="retList"/>
<c:if test="${empty id}">
   <c:set var="action" value="new"/>
<c:if test="${!empty id}">
   <c:set var="action" value="edit"/>
   <c:set var="idCommunity" value="${idCommunity.getCommunityInformation(id)}"/>  //&#26377;&#38382;&#39064;
   <c:set var="retList" value="${idCommunity.getCommunityChildByPId(id)}"/>
now <c:set var="idCommunity" value="${idCommunity.getCommunityInformation(id)}"/> is error,and the error message is:
org.apache.jasper.JasperException: /webapp/community/editCommunity.jsp(24,3) The function getCommunityInformation must be used with a prefix when a default namespace is not specified

but when i use this page in resin3.0.8 ,it can work well ,but when in tomcat5.0.28,it can not work!

Question by:hgbdelphi
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
  • 3

Author Comment

ID: 12344103
jstl can not call javabean 's method with auguments in tomcat like this

but it can in resin,how can i do it????

LVL 21

Expert Comment

ID: 12345716
I don't think you can call methods with parameters in JSTL.  Tomcat is confusing the method call with the JSP 2.0 feature of functions.  You need to call using the following syntax:
${prefix:methodName(param1, param2, ...)}
and also include the TLD

        returnType methodName(param1Type, param2Type, ...)

See this tutorial:

Author Comment

ID: 12353303
thanks to MogalManic!

  but i can do it in resin,so i help this can work in tomcat,can help me again,if i do this like you say,i will change my code much more,can help me  again.

Best Regard!
Technology Partners: 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!

LVL 21

Expert Comment

ID: 12357180
Tomcat is closer to the standard so my guess is that you are using a feature that is specific to resin.  If you use the JSTL functions they should work in Resin.

Author Comment

ID: 12364860
hi  MogalManic ,
thanks for your help,
<c:set var="idCommunity" value="${idCommunity.getCommunityInformation(id)}"/>
<c:set var="idCommunity" value="<%=idCommunity.getCommunityInformation(id)%>"/>

it can work ,but i will change all my code.

Best Regard!
LVL 21

Accepted Solution

MogalManic earned 100 total points
ID: 12365131
Just define the following TLD and you should be able to use it in BOTH resin and Tomcat
Call it Community.tld:

<taglib xmlns=""
    xsi:schemaLocation=" web-jsptaglibrary_2_0.xsd"

            int getCommunityInformation(int)
On your JSP include:
<%@ taglib prefix="cm:" uri=""%>
<c:set var="idCommunity" value="${cm:idCommunity.getCommunityInformation(id)}"/>


Author Comment

ID: 12366753
  i will change some code like you,and another i will do this
<c:set var="idCommunity" value="<%=idCommunity.getCommunityInformation(id)%>"/>

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Exception after setting jdbc session management 2 82
wordappend challenge 8 221
firstswap challenge 20 84
How to increase Spring boot/Tomcat max file upload size 2 240
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
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…
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.

740 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