DeclareControl taglib in jsp
Dear all,
I am trying to use "declareControl" in jsp in order to use a control method.
But I found that it can't declare the control which I stored in a seperate
Control Project. Is that taglib restricted us to declare control within same
project? Thx a lot.
<netui-data:declareControl type="dbControls.ProductsDBControl"
controlId="productsDBControl"/>
/Karen
Karen--
I'd suggest upgrading to SP2. I tried this with a custom control
(JCS) and with a simple DB control which were both visible and invokable
with that tag from a JSP.
Try upgrading and let me know if you see the same problem.
Hope that helps.
Eddie
Karen Law wrote:
Well, I am using WLW 8.1 GA. I have built the Control Project before runing
my jsp. The control can imported in my jsp successfully since I can read all
methods in my Data Palette. But I don't know why error occur everytime when
I run the jsp. It seems locating the control in same web application.
Thx.
Karen
"Eddie O'Neil" <[email protected]> wrote in message
news:[email protected]..
Karen--
Hi; a couple of questions...
Are you using WLW 8.1 GA or SP2?
Are you building the entire application before trying to run the JSP
(Build -> Build Application)? The control project isn't necessarily
built if you just run the JSP itself.
Eddie
Karen Law wrote:
Below are error message:
Tag Error
Tag DeclareControl Errors 2
Tag Error Message A Control of type "dbControls.ProductsDBControl"
could not be declared because: weblogic.jws.WlwProxyException: Unable to
create proxy for: /myWeb/dbControls.ProductsDBControl.jcx
Tag Error Message Could not create control of type
"dbControls.ProductsDBControl".
"Karen Law" <[email protected]> wrote in message
news:400b7d7d$[email protected]..
Dear all,
I am trying to use "declareControl" in jsp in order to use a controlmethod.
But I found that it can't declare the control which I stored in a
seperate
Control Project. Is that taglib restricted us to declare control withinsame
project? Thx a lot.
<netui-data:declareControl type="dbControls.ProductsDBControl"
controlId="productsDBControl"/>
/Karen
Similar Messages
-
How to use taglibs in JSP for Database access
Hi
Could any one please tell me how to use taglibs in JSP for Database access
with regrds
JojoThis is a sample how to connect to a MySQL database with JSTL 1.0:
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<%@ taglib uri="http://java.sun.com/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>JSTL MySQL</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<c:catch var="e">
<sql:setDataSource var="datasource" url="jdbc:mysql://Your_Server_Name_Here/You_Schema_Here"
user="Your_Username_Here" password="Your_Password_Here"
driver="com.mysql.jdbc.Driver"/>
<c:out value="datasource= ${datasource}, Class = ${driver.class}"/>
<br />
<br />
<sql:query var="deejays" dataSource="${datasource}">SELECT * FROM Your_Table_Name_Here</sql:query>
<table>
<%-- Get the column names for the header of the table --%>
<c:forEach var="columnName" items="${deejays.columnNames}"><th><c:out value="${columnName}"/></th></c:forEach>
<tbody>
<%-- Get the value of each column while iterating over rows --%>
<c:forEach var="row" items="${deejays.rows}">
<tr><c:forEach var="column" items="${row}">
<td><c:out value="${column.value}"/></td>
</c:forEach>
</tr>
</c:forEach>
</tbody>
</table>
</c:catch>
<br />
<br />
<c:if test="${e!=null}"><span class="error">Error</span>�
<c:out value="${e}" />
</c:if>
</body>
</html>And this thread might help you:
http://forum.java.sun.com/thread.jspa?threadID=639471&tstart=44 -
Error while using mxml taglib in jsp
Hi,
I am getting following error while useing the mxml taglib in
jsp for flex 2.0.1,
java.lang.NullPointerException
flex.webtier.server.j2ee.jsp.MxmlTagImpl.doStartTag(MxmlTagImpl.java:112)
flex.bootstrap.BootstrapTag.doStartTag(BootstrapTag.java:77)
org.apache.jsp.test_jsp._jspx_meth_mm_005fmxml_005f0(test_jsp.java:79)
org.apache.jsp.test_jsp._jspService(test_jsp.java:54)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
My jsp as below,
<%@ taglib uri="FlexTagLib" prefix="mm" %>
<html><body>
<mm:mxml source="reports/sampleapp.mxml" />
</body></html>
If any one knows how to resolve above error, please help me,
My email id : [email protected]
Regards,
Chandra Reddydid u deploy your dbadapter through console to the plan mentioned for deployment?
-
Server Error 500: Cant find taglibs oracle.jsp.parse.JspParseException
I dont know what iam doing wrong. My project runs under tomcat, but not under oc4j.
Here is my stacktrace:
500 Internal Server Error
OracleJSP: oracle.jsp.parse.JspParseException: Zeilennummer 3, <%@ taglib uri="/tags/fn" prefix="fn" %>
Fehler:oracle.xml.parser.v2.XMLParseException ( /WEB-INF/jsp-fragments/taglibs.jsp ):
Zeile #:3 Spalte #:48 : FIXED type Attribute value not equal to the default value 'http://java.sun.com/xml/ns/j2ee'.
Zeile #:4 Spalte #:56 : Attribute 'xmlns:xsi' used but not declared.
Zeile #:5 Spalte #:81 : Attribute 'xsi:schemaLocation' used but not declared.
Zeile #:6 Spalte #:16 : Attribute 'version' used but not declared.
Zeile #:8 Spalte #:15 : Invalid element 'description' in content of 'taglib', expected elements '[tlibversion]'.
Zeile #:8 Spalte #:15 : Element 'description' used but not declared.
Zeile #:9 Spalte #:16 : Invalid element 'display-name' in content of 'taglib', expected elements '[tlibversion]'.
Zeile #:9 Spalte #:16 : Element 'display-name' used but not declared.
Zeile #:10 Spalte #:16 : Invalid element 'tlib-version' in content of 'taglib', expected elements '[tlibversion]'.
Zeile #:10 Spalte #:16 : Element 'tlib-version' used but not declared.
Zeile #:11 Spalte #:14 : Invalid element 'short-name' in content of 'taglib', expected elements '[tlibversion]'.
Zeile #:11 Spalte #:14 : Element 'short-name' used but not declared.
Zeile #:12 Spalte #:7 : Invalid element 'uri' in content of 'taglib', expected elements '[tlibversion]'.
Zeile #:14 Spalte #:12 : Invalid element 'function' in content of 'taglib', expected elements '[tlibversion]'.
Zeile #:14 Spalte #:12 : Element 'function' used but not declared.
Zeile #:15 Spalte #:17 : Element 'description' used but not declared.
Zeile #:19 Spalte #:20 : Element 'function-class' used but not declared.
Zeile #:20 Spalte #:24 : Element 'function-signature' used but not declared.
Zeile #:21 Spalte #:13 : Element 'example' used but not declared.
Zeile #:26 Spalte #:12 : Invalid element 'function' in content of 'taglib', expected elements '[tlibversion]'.
hope that someone can help me out.
thanksWhich oc4j version are you using? You can get the version by
java -jar oc4j.jar -version -
<?xml version="1.0" encoding="UTF-8"?>
<jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:ui="http://www.sun.com/web/ui">
<jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
<f:view>
<ui:page binding="#{Page1.page1}" id="page1">
<ui:html binding="#{Page1.html1}" id="html1">
<ui:head binding="#{Page1.head1}" id="head1">
<ui:link binding="#{Page1.link1}" id="link1" url="/resources/stylesheet.css"/>
</ui:head>
<ui:body binding="#{Page1.body1}" id="body1" style="-rave-layout: grid">
<ui:form binding="#{Page1.form1}" id="form1"/>
</ui:body>
</ui:html>
</ui:page>
</f:view>
</jsp:root>
where to include,
<%@taglib prefix="is" uri="http://com.examples.imageslider"%>
<f:view>
<h:form>
<is:ImageSlider id="imageSlider1"
url="/resources/image1.jpg,/resources/image2.jpg"
style="border: medium solid #000080;"
width="200" height="150"/>
</h:form>
</f:view>Hi Riaz,
You can use same code in JSP
Java Code
import java.util.*;
class TestHashMap
public static void main(String args[])
HashMap hm=new HashMap();
//store some Objects.
hm.put("Rajib Sarma","100");
//duplicate keys are not allowed.
hm.put("Rajib Sarma","200");//The value "100" is replaced by "200".
hm.put("Sazid Ahmed","200");
//Display the contents of the HashMap
System.out.println("Displaying all the keys/values.\r\n");
System.out.println("Key\t\tValue\r\n");
//get all the keys
Collection c=hm.keySet();
//obtain an Iterator
Iterator i=c.iterator();
while(i.hasNext())
//obtain a key
Object key=i.next();
//obtain the value of the key
Object value=hm.get(key);
System.out.println(key +"\t" + value);
}//while ends
}//main ends
} -
Custom taglibs w/ JSP features
Hello Together,
I am currently facing a little problem:
I use custom taglibs for rendering certain web elements (lets say widgets etc.). The reason is greater reusability and full integration into the runtime. However, what do you recommend on how to render such components?
As far as i know, there are only two solutions:
- embedding markup (e.g. XHTML, XML...) into the tag class (not so good, especially when large chunks of markup)
- reading from markup templates located on the file system and populating them w/ data (slow?).
What do you use for custom taglibs that are to render markup contents (thus, no flow taglibs)?
I know that i can fallback to pure JSPs, but there is no elegant way calling them with parameters. The reason is that i have "abstract control classes" with some properties. According to these properties, my taglib renders the control. When doing this with a JSP fragment, there is no "cool" way:
the class proto: an GUI class with properties
- id
- caption
- state
- etc.
-- taglib example --
<some:guiElement obj="${controls.current}" method="xml" />
This taglib can query all properties by the obj reference and render.
-- JSP equivalent w/ JSTL call --
<c:import url="/base/guiElement.jsp?id=${controls.current.id}&caption=${controls.current.caption}[...]" />
This is bad design, and all params have to be passed seperately (or not?).
You see, Taglibs are quite more handy to use, as you know. But i am missing JSP features in taglibs, such as how to do an <c:import /> from within an taglib etc.
Another thing in mind is themeability. One can use a copy of the JSP fragment and modify its visual appearance, but w/ taglibs, that is more harder (except when using markup templates).
Does anyone knoe how to marry JSP featires into custom taglibs?
Sorry for that long posting :-)
Greetings, TimoHello,
Just an answer to myself and anyone who is interested:
The solution to my problem is migrating to JSP 2.0 where you can use tag template files.
Thus, if possible, upgrading to JSP 2.0 + Servlet 2.4 does the job.
Greetings, Timo -
Hi!
I cannot determine why I'm getting the following error:
I've installed Apache Tomcat/4.0.6
"PARSE error at line 6 column 19
org.xml.sax.SAXParseException: Element type "taglib" must be declared."
Can you tell why the parser does not recognize it?
Appreciate any help.
ele
[my JSP]
<%@ page language="java" import="java.lang.*,java.util.*,javax.servlet.jsp.*,java.io.PrintWriter,javax.servlet.http.HttpServletResponse,javax.servlet.jsp.JspWriter" %>
<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
[my web.xml]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<display-name>SegDis</display-name>
<description></description>
<servlet>
<servlet-name>ScriviPunto</servlet-name>
<servlet-class>ScriviPunto</servlet-class>
</servlet>
<servlet>
<servlet-name>lanciaScriviPunto</servlet-name>
<jsp-file>/lanciaScriviPunto.jsp</jsp-file>
</servlet>
<servlet>
<servlet-name>segnalazione</servlet-name>
<jsp-file>/segnalazione.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>ScriviPunto</servlet-name>
<url-pattern>/scriviPunto</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>lanciaScriviPunto</servlet-name>
<url-pattern>/lanciaScriviPunto.jsp</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>segnalazione</servlet-name>
<url-pattern>/segnalazione.jsp</url-pattern>
</servlet-mapping>
<taglib>
<taglib-uri>/WEB-INF/c.tld</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>
</web-app>
[the .tld file (downloaded from Sun)]
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>c</short-name>
<uri>http://java.sun.com/jstl/core</uri>
<display-name>JSTL core</display-name>
<description>JSTL 1.0 core library</description>
<validator>
<validator-class>
org.apache.taglibs.standard.tlv.JstlCoreTLV
</validator-class>
<init-param>
<param-name>expressionAttributes</param-name>
<param-value>
out:value
out:default
out:escapeXml
if:test
import:url
import:context
import:charEncoding
forEach:items
forEach:begin
forEach:end
forEach:step
forTokens:items
forTokens:begin
forTokens:end
forTokens:step
param:encode
param:name
param:value
redirect:context
redirect:url
set:property
set:target
set:value
url:context
url:value
when:test
</param-value>
<description>
Whitespace-separated list of colon-separated token pairs
describing tag:attribute combinations that accept expressions.
The validator uses this information to determine which
attributes need their syntax validated.
</description>
</init-param>
</validator>
<tag>
<name>catch</name>
<tag-class>org.apache.taglibs.standard.tag.common.core.CatchTag</tag-class>
<body-content>JSP</body-content>
<description>
Catches any Throwable that occurs in its body and optionally
exposes it.
</description>
<attribute>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<name>choose</name>
<tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class>
<body-content>JSP</body-content>
<description>
Simple conditional tag that establishes a context for
mutually exclusive conditional operations, marked by
<when> and <otherwise>
</description>
</tag>
<tag>
<name>out</name>
<tag-class>org.apache.taglibs.standard.tag.el.core.OutTag</tag-class>
<body-content>JSP</body-content>
<description>
Like <%= ... >, but for expressions.
</description>
<attribute>
<name>value</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>default</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>escapeXml</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<name>if</name>
<tag-class>org.apache.taglibs.standard.tag.el.core.IfTag</tag-class>
<body-content>JSP</body-content>
<description>
Simple conditional tag, which evalutes its body if the
supplied condition is true and optionally exposes a Boolean
scripting variable representing the evaluation of this condition
</description>
<attribute>
<name>test</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<name>import</name>
<tag-class>org.apache.taglibs.standard.tag.el.core.ImportTag</tag-class>
<tei-class>org.apache.taglibs.standard.tei.ImportTEI</tei-class>
<body-content>JSP</body-content>
<description>
Retrieves an absolute or relative URL and exposes its contents
to either the page, a String in 'var', or a Reader in 'varReader'.
</description>
<attribute>
<name>url</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>varReader</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>context</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>charEncoding</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<name>forEach</name>
<tag-class>org.apache.taglibs.standard.tag.el.core.ForEachTag</tag-class>
<tei-class>org.apache.taglibs.standard.tei.ForEachTEI</tei-class>
<body-content>JSP</body-content>
<description>
The basic iteration tag, accepting many different
collection types and supporting subsetting and other
functionality
</description>
<attribute>
<name>items</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>begin</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>end</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>step</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>varStatus</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<name>forTokens</name>
<tag-class>org.apache.taglibs.standard.tag.el.core.ForTokensTag</tag-class>
<body-content>JSP</body-content>
<description>
Iterates over tokens, separated by the supplied delimeters
</description>
<attribute>
<name>items</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>delims</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>begin</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>end</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>step</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>varStatus</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<name>otherwise</name>
<tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class>
<body-content>JSP</body-content>
<description>
Subtag of <choose> that follows <when> tags
and runs only if all of the prior conditions evaluated to
'false'
</description>
</tag>
<tag>
<name>param</name>
<tag-class>org.apache.taglibs.standard.tag.el.core.ParamTag</tag-class>
<body-content>JSP</body-content>
<description>
Adds a parameter to a containing 'import' tag's URL.
</description>
<attribute>
<name>name</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>value</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<name>redirect</name>
<tag-class>org.apache.taglibs.standard.tag.el.core.RedirectTag</tag-class>
<body-content>JSP</body-content>
<description>
Redirects to a new URL.
</description>
<attribute>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>url</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>context</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<name>remove</name>
<tag-class>org.apache.taglibs.standard.tag.common.core.RemoveTag</tag-class>
<body-content>empty</body-content>
<description>
Removes a scoped variable (from a particular scope, if specified).
</description>
<attribute>
<name>var</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<name>set</name>
<tag-class>org.apache.taglibs.standard.tag.el.core.SetTag</tag-class>
<body-content>JSP</body-content>
<description>
Sets the result of an expression evaluation in a 'scope'
</description>
<attribute>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>value</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>target</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>property</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<name>url</name>
<tag-class>org.apache.taglibs.standard.tag.el.core.UrlTag</tag-class>
<body-content>JSP</body-content>
<description>
Prints or exposes a URL with optional query parameters
(via the c:param tag).
</description>
<attribute>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>value</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>context</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<name>when</name>
<tag-class>org.apache.taglibs.standard.tag.el.core.WhenTag</tag-class>
<body-content>JSP</body-content>
<description>
Subtag of <choose> that includes its body if its
condition evalutes to 'true'
</description>
<attribute>
<name>test</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
</taglib>this is a wild guess, but make sure the taglib text you added to your web.xml doens't contain funky characters you may have copied from some web page. i.e. retype it by hand if you copied it.
If that isn't it.. sorry i don't see a problem. -
How to use tags from taglib in jsp
i am using tomcat. I don't know where the taglibrary is stored i.e in which folder and how can i access that library and use it in the jsp pages.
Refer to
http://java.sun.com/webservices/docs/1.0/tutorial/doc/JSPTags4.html
thanks,
Deepak -
Hi, I just recently got tag libraries to work and I am wanting to send a dynamic attribute that has a value which is stored in the session. The problem is that I believe that the tag library is processed before the actual jsp code is, and therefore I get something like
<%= someObj.getValue() %> instead of the actual value. Has anyone else encountered this issue and if so could you please recommend some solution(s)?
Here is how I call the taglibg:
<countytaglib:countyList state="TN" selectedCounty="<%= county %>" />
The value ends up being '<%= county %>' instead of the actual value.
Any help is appreciated. Thank you all in advance!
-PVThe required is only if the attribute is required.
For your question's answer the rtexprvalue should only be true.
in the TLD file for the TAG, for every attribute whose
value can be evaluated by the JSP scriptlet put as
follows:
<attribute>
<name>attribute_name</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>rtexpvalue should be specified to true in case for the
attribute
name you would like something like
<%= user.getFirstName() %>Hope that helps. -
Jsp taglibs and jsp commands...
Another question about taglibs...
If I want to use the body in a tag together with a class which is used in the tag code.
For example I want to do the following:
<foo:listStudents>
<%= student.fname %> <%= student.lname %> <%= student.id %>
</foo:listStudents>
Do I have to use the TagExtraInfo or? The class Student (student) is ofcourse declared and used in the tag.
Regards Per JonssonI am also on the lookout for this. i have posted many times but no one has answered my question till now. if you get to know the answer do inform me at
[email protected]
Regards
Ramesh Kesavanarayanan -
Dear all,
I didn't work on JSP with JSTL. If anyone can help me in this regard for making a simple JSP page with JSTL, it will be highly appreciable.
I am working on Tomcat 5.0.
Thanks for ur timeWhat do you mean 'help' ?
I would advice you to make a start by reading up the documentation here - http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSTL.html#wp74644, to download the tag libraries here - http://java.sun.com/products/jsp/jstl/index.jsp (there's also a documentation)
and start putting pages using jstl.
When you are stuck up, come here by all means, post your problems and people would only be too happy to aid you. A generic shout for 'help' like the one in your post wouldnt get much response.
cheers,
ram. -
I am new to JSP
When we are using Java code , Regular Expression in JSP.
What is the need for JSTL in the firstplace?
Why JSTL is used in JSP?
Thank
psathishcssearch for the JSTL tutorials on the net.
-
I've written a custom tag library for some advanced UI components (tabbedpane, toolbar, tree, etc.) that I've been distributing for free as a .jar file with the associated .tld file. So far, so good.
Now I want to write some more advanced tags (i.e. a DateSelection and Calculator tag) that will require some helper JSP files (and possibly images) to render the actual calendar and calculator.
My plan is to have the tag generate a textfield with a hyerplink image to it's right. When clicked the image would load the helper JSP file in a new window. The user would do his thing and when done, the JSP would reload the parent window so the textfield could grab the result from the request and display it.
My question is how to package this. I would like to keep this thing as a single self contained .jar file that could be easily placed in the WEB-INF directory of a user's webapp and VIOLA, it's done.
Can I reference a .JSP (& | images) stored in this jar file or will the user have to be responsible for placing the JSP(s) (and the hyperlink images) within their context path? This would add some possible support issues (you know what I mean) and being a freeware package I'd like to avoid that at all costs.
You guys have been tremendous help so far. Thanks.how will mailing the jar help ?
I dont think you can include it all in the jarfile. Best thing is to make an entire war file with the developed taglib and jsp's.
The user then should deploy the war file and ervything should work. -
Custom taglib and inexplicable jsp compilation issue
Can someone explain what could possibly be happening here? I have been working on this for two days to no avail.
With the following configuration, my jsp behaves as I expect it to on Tomcat, but fails to compile both for Jetty and the Maven2 jspc plugin
deepfij.tld
<taglib version="2.0" xmlns="http://java.sun.com/xml/ns/j2ee [3]" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd">
<tlib-version>1.0</tlib-version>
<short-name>deepfij</short-name>
<uri>com.fijimf.deepfij</uri>
<tag>
<name>menuItem</name>
<tag-class>com.fijimf.deepfij.web.tag.MenuItemTag</tag-class>
<body-content>scriptless</body-content>
<attribute>
<name>item</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>
menubar.jsp
<%@ taglib prefix="df" uri="/WEB-INF/tlds/deepfij.tld"%>
<c:forEach var="page" items="${menuRootPages}">
<df:menuItem item="${page}" />
</c:forEach>
MenuItemTag.java
package com.fijimf.deepfij.web.tag;
.With the error: com.fijimf.deepfij.web.tag cannot be resolved to a type.
BUT*, if I move MenuItemTag into the package com.fijimf.web, and correspondingly change the .tld, everything works as expected.
Is this a bug, or is there a constraint in taglib packages I don't know about?
Any guidance would be great, because I'd like to put classes where I want them.This is most likely a bug on the server. The JSP formatted Tag Files usually have a .tag extension on them ( [see tutorial|http://java.sun.com/javaee/5/docs/tutorial/doc/bnama.html] ). The server is probably looking at yyy.xxx.tag and trying to use it as if it was a Tag File named xxx.tag, rather than a package.
-
what is the use of
<%@ taglib uri="taglib" prefix="hbj" %>
in jsp?
The portal Content works fine even without that.
Any specific reasons?Hello Hanif,
This is the we declare taglibs in JSP files. Check this for definition:
http://java.sun.com/products/jsp/tutorial/TagLibraries5.html#61992
After declaring this taglib <%@ taglib uri="taglib" prefix="<b>hbj</b>" %>
, you can use all HTMLB classes as tags in JSP.
I am not sure in which JSP you mean that every thing works fine with out this taglib!! But if you remove this taglib, then you cannot use HTMLB in this JSP.
http://help.sap.com/saphelp_nw2004s/helpdata/en/42/efdb279a563ee7e10000000a1553f7/frameset.htm
Greetings,
Praveen Gudapati
p.s Points are always welcome for helpful answers
Maybe you are looking for
-
Ipod touch Christmas present won't work
I got my daughter an ipod touch 4th gen. 32 gb. having serious trouble getting it to work. Upon connecting it to my pc for the first time I was prompted to have to restore it...didnt understand why a brand new ipod would need to be restored but i t
-
I am a recent user, coming from Eudora. It's all working pretty well, but I just noticed that my sent mails are not being stored anywhere. I have searched in different ways but can't find them. I have checked prefs, and all relevant boxes are correct
-
How to exit from an update Function Module
Hi Friends, I am using an Update Function Module in my program.The Program also has various other logics implemented in it. The Update Function Module gets triggered only when it finds COMMIT WORK statement. Now, I want that when the FM gets triggere
-
I am developing an MIDlet and I want to record a users mobile phone in it. As far as I know I can't read the users phone number from the SIM card so I use a text field for the users to enter in their phone number. Is there any way I can store the num
-
Producing Movies for Distribution
I am attempting to produce a digital portfolio from a powerpoint presentation by converting the slide show into a Quick Time movie. My question is, if I burn the movie to a CD for distribution to clients is there a way to provide a Quick Time player