Custom Tag is missing required attribute property
Hello,
Here is my struts config file source;
<global-forwards>
<forward name="mainpage" path="/index.jsp">
</forward>
<forward name="CustomerDetailsForward" path="/GoToCustomerPage.do">
</forward>
</global-forwards>
<!-- Action Mappings -->
<action-mappings>
<action path="/SubmitCustomerForm" type="action.SubmitCustomerForm" name="CustomerForm" scope="request" validate="true" input="/CustomerDetails.jsp">
<forward name="success" path="/Success.jsp">
</forward>
<forward name="failure" path="/Failure.jsp">
</forward>
</action>
<action path="/GoToCustomerPage" type="org.apache.struts.actions.ForwardAction" parameter="/CustomerDetails.jsp">
</action>
</action-mappings>
And my index.jsp source;
<html:html>
<head>
<html:base/>
</head>
<body>
<html:button></html:button>
<html:link forward="CustomerDetailsForward">Go To Customer Form </html:link>
</body>
</html:html>
And here is the error;
Error Message:JSPG0227E: Exception caught while translating /index.jsp: /index.jsp(13,1) --> JSPG0006E: Custom Tag is missing required attribute property
Root Cause:com.ibm.ws.jsp.translator.JspTranslationException: JSPG0227E: Exception caught while translating /index.jsp: /index.jsp(13,1) --> JSPG0006E: Custom Tag is missing required attribute property at com.ibm.ws.jsp.translator.visitor.validator.ValidateVisitor.visitCustomTagStart(ValidateVisitor.java:304) at com.ibm.ws.jsp.translator.visitor.JspVisitor.processJspElement(JspVisitor.java:267) at com.ibm.ws.jsp.translator.visitor.JspVisitor.processChildren(JspVisitor.java:309) at com.ibm.ws.jsp.translator.visitor.JspVisitor.processJspElement(JspVisitor.java:268) at com.ibm.ws.jsp.translator.visitor.JspVisitor.processChildren(JspVisitor.java:309) at com.ibm.ws.jsp.translator.visitor.JspVisitor.processJspElement(JspVisitor.java:139) at com.ibm.ws.jsp.translator.visitor.JspVisitor.visit(JspVisitor.java:121) at com.ibm.ws.jsp.translator.JspTranslator.processVisitors(JspTranslator.java:121) at com.ibm.ws.jsp.translator.utils.JspTranslatorUtil.translateJsp(JspTranslatorUtil.java:181) at com.ibm.ws.jsp.translator.utils.JspTranslatorUtil.translateJspAndCompile(JspTranslatorUtil.java:83) at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.translateJsp(AbstractJSPExtensionServletWrapper.java:349) at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper._checkForTranslation(AbstractJSPExtensionServletWrapper.java:317) at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.checkForTranslation(AbstractJSPExtensionServletWrapper.java:226) at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:131) at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionProcessor.handleRequest(AbstractJSPExtensionProcessor.java:270) at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:308) at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:472) at com.ibm.ws.wswebcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:111) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3129) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:238) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811) at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1433) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:93) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:274) at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214) at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152) at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213) at com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195) at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136) at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:194) at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:741) at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:863) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1510)
volkov wrote:
Error Message:JSPG0227E: Exception caught while translating /index.jsp: /index.jsp(13,1) --> JSPG0006E: Custom Tag is missing required attribute propertyWhich is line 13 then? And check the syntax for that tag.
Similar Messages
-
JPSTranslate:Custom tag is missing required attribute for
When ever I am placing a label in jsf using RAD i am getting a similar error which i am not able to rectify. And how to integreate swing components in Faces jsp file
Please help me out.volkov wrote:
Error Message:JSPG0227E: Exception caught while translating /index.jsp: /index.jsp(13,1) --> JSPG0006E: Custom Tag is missing required attribute propertyWhich is line 13 then? And check the syntax for that tag. -
Custom Tag with script in attribute.
Hi,
I use a custom tag in which an attribute is generated dynamicly.But it
doesn't work.
Here is the sample:
<tlt:MyTag MyAttr="<%= "abc"%>" />
the result is MyTag doesn't work correctly but output <tlt:MyTag
MyAttr="abc" /> in the browser source file.My server is wls5.1 sp6.
Can I use this approach?
Pan
Pan YangBin wrote:
>
> Hi,
> I use a custom tag in which an attribute is generated dynamicly.But it
> doesn't work.
>
> Here is the sample:
> <tlt:MyTag MyAttr="<%= "abc"%>" />
That's because the value of MyAttr attribute is included in the same
quotes as the value of the expression. Change the line to:
<tlt:MyTag MyAttr='<%= "abc"%>' />
and it should do the trick.
>
> the result is MyTag doesn't work correctly but output <tlt:MyTag
> MyAttr="abc" /> in the browser source file.My server is wls5.1 sp6.
Oh, I see. You didn't specify that the page uses the Tag Library which
is done by
<%@ taglib uri="/uri_to_your_TLD" prefix="tlt" %>
Another mistake is that the name of the "MyAttr" attribute begins with
the uppercase letter, so at the end the page compilation will result
with an error saying that appropriate attribute won't be found or so.
Change the name of "MyAttr" to "myAttr" or whatever you like, but it
must start with the lowercase letter.
Take a look at JavaServer Pages specification available at
http://java.sun.com/products/jsp. There you can find loads of answers,
esp. a chapter about Tag Extenstions.
> Pan
Jacek Laskowski
HP Consulting
-
Missing required input property error in insert attachment
Hi,
Im getting this following error some times not all times when i tring to insert attachment files to campaign object
<ErrorMessage>Missing required input property "Handle"(SBL-ODS-00242)</ErrorMessage>
please give some solution
Thanks,
Sathis Kumar PDo you have the XML request that you are sending?
-
Bulk import error - Missing required attribute fullname
Folks,
I am having trouble trying to bulk import some users.
I have the following file for import (cut down from what I really want to import):
command,user,waveset.resources,password.password,password.confirmpassword,global.firstname,global.lastname,global.fullname
Create,user1,myLDAPresourcename,passwd,passwd,myfirstname1,mysurname1, myfirstname1 mysurname1This works using Accounts->Launch Bulk Actions with Action set to From Action List and everything else on that page left at the default value. The correct data appears in IDM and the LDAP resource.
Now if I try to import the following file, in which the user does not have a first name, I get in to trouble:
command,user,waveset.resources,password.password,password.confirmpassword,global.firstname,global.lastname,global.fullname
Create,user2,myldapresourcename,passwd,passwd,,mysurname2,mysurname2
The error message is:
com.waveset.Util.WaveSetException: An error occurred adding user uid=user2, .. to resource myLDAPresourcename.
com.waveset.util.WavesetException: Missing required attribute fullnameClearly the import file contains a column for fullname (column 8) and a value for fullname in the only row of data mysurname2. As far as I am concerned it is perfectly valid for a user not to have a firstname; but they must have a fullname.
I have tried using an import file without a value for fullname, but with a firstname and lastname like this
command,user,waveset.resources,password.password,password.confirmpassword,global.firstname,global.lastname,global.fullname
Create,user3,myLDAPresourcename,passwd,passwd,myfirstname3,mysurname3,This works. The correct data appears in IDM and the LDAP resource and IDM has generated a fullname value of {Firstname} {Surname}. Trying to leave out the firstname and the fullname gives the same error as above.
The configuration of my resource (in summary) is
objectclasses:
top
person
inetOrgPerson
Account Attributes:
accounted -> uid [required]
password -> userPassword
firstname -> givenname
lastname -> sn [required]
objectClass -> objectClass
fullname -> cn [required]
As an experiment I have tried reconfiguring the resource so that fullname is not marked as required.
Importing user1 and user3 still works and still creates the correct data in IDM and the LDAP resource.
Importing user2 now gives a different error:
com.waveset.Util.WaveSetException: An error occurred adding user uid=user2, .. to resource myLDAPresourcename.
javax.naming.directory.SchemaViolationException: [LDAP: error code 65 Object Class Violation]I dont understand why, during the import of a user without a firstname IDM will not generate a fullname or use the supplied fullname.
Can anyone help?
Regards,
GavinAfter further testing it turned out that I couldn't create a user without a firstname from the IDM GUI and this in turn was because of the way fullname was generated by the user form.
I've got the user form changed and now user creation (from the GUI and via bulk import) is working as hoped. -
How to create a custom tag for a custom converter
In Jdeveloper 11g, I have a project where I have created a custom converter class that impements the javax.faces.convert.Converter class. I have registered the converter with an id in the faces-config.xml file of the project, and the converter works fine by using the <f:converter type="myconverter"> tag. However, the custom converter has a field which I would like to set from the tag itself. Hence, I would like to add an attribute to <f:converter> tag if possible or create a custom tag that has the attribute.
I have done some reserach and I found that a custom tag can be implemented: I need to create a class which extends from the ConverterTag class or javax.faces.webapp.ConverterElTag class, which I did, but I also need to create ".tld" (tag library) file which defines the tag itself.
The part about creating the ".tld" file and registring the new tag is what I'm not sure how to do.
Does someone know how to do this?
thank youHi frank,
that's a good document, and it explains how to make a custom converter. I already created the custom converter, it converts a number to any currency pattern. I know java already has a currency converter, but it doesn't support Rupee currency format, and I need that format.
My converter works, but I would like to pass the pattern of the format through an attribute in a tag. Since f:converter doesn't seem to support that, I created a custom tag which uses my converter, and it enables me to pass a pattern to the converter.
All of that works, but I need to be able to pass the pattern as an EL expression, and it's not evaluating the expression before passing it to the converter. It just passes the whole expression as a string. I'm thinking It may be something I'm doing wrong.
this is the tag library definition file:
<!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.2</tlib-version>
<jsp-version>2.1</jsp-version>
<short-name>custom</short-name>
<uri>custom-currency-converter</uri>
<description>
custom currency custom tag library
</description>
<tag>
<name>CurrencyConverter</name>
<tag-class>
converter.Tag.CurrencyConverterTag
</tag-class>
<body-content>JSP</body-content>
<attribute>
<name>pattern</name>
<type>java.util.String</type>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>
Edited by: Abraham Ciokler on Feb 4, 2011 11:20 AM -
JSP Custom Tags, Tag Handlers, Passing values
Multiple questions here while I try to work with custom tags (its a requirement):
From what I have had so far - I have a .tld file, a .java file and a .jsp page.
(this is not a working version as I just got it from a website)
platform: tomcat on an xp box.
I was wondering if we can pass the parameters that are passed to the the jsp page (like blah.jsp?param1=value1¶m2=valu2 ) to the tag handler?
This is because the processing that I need to do in the handler would depend on what I have in the passed values.
Any help in letting me know where to place those files on the tomcat context root would help. Please see, I do have a couple of servlets running on the box also and they might be in the same context root.
Any good short tutorial link is also welcome as a short answer as I try to unravel the custom tags in jsp.I am using TomCat 5.5
What I need to do using tags is to build a web-page on the fly by polling a couple of different tables in the database.
This is to be done using a jsp and custom tag (requirement) which would be able to handle any resultsets. We also have to come up with pageContext attribute names and supply column names as those attributes. Thus we will have to come up with the meta data file and a tag library descriptor as well.
I found a helloworld solution on a website and was trying to modify it to meet my needs. But I guess I under-estimated the work that needed to be done in this one. -
Why doesn't my custom tag work?
First, my backend database is MS Access. Nothing I can do about that, unfortunately.
I have defined three custom tags (no body, no attributes) to display report information from my project tracking/metrics Access database:
<prefix:showProjectInfo />
<prefix:showProjectTeam />
<prefix:showProjectHistory />
In my JSP, the first tag I use, <prefix:showProjectInfo />, works perfectly. However, <prefix:showProjectTeam /> gives no output.
First, here is the tld file that defines the tags (report.tld):
<?xml version="1.0" encoding="UTF-8" ?>
<!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>report</short-name>
<uri>/report</uri>
<!-- Forte4J_TLDX: This comment contains code generation information. Do not delete.
<tldx>
<tagHandlerGenerationRoot>classes</tagHandlerGenerationRoot>
</tldx>
-->
<!-- A validator verifies that the tags are used correctly at JSP
translation time. Validator entries look like this:
<validator>
<validator-class>com.mycompany.TagLibValidator</validator-class>
<init-param>
<param-name>parameter</param-name>
<param-value>value</param-value>
</init-param>
</validator>
-->
<!-- A tag library can register Servlet Context event listeners in
case it needs to react to such events. Listener entries look
like this:
<listener>
<listener-class>com.mycompany.TagLibListener</listener-class>
</listener>
-->
<tag>
<name>showProjectInfo</name>
<tag-class>mil.usaf.rad.metrics.report.showProjectInfoTag</tag-class>
<body-content>empty</body-content>
<description>Shows the basic project information</description>
</tag>
<tag>
<name>showProjectTeam</name>
<tag-class>mil.usaf.rad.metrics.report.showProjectTeamTag</tag-class>
<body-content>empty</body-content>
</tag>
<tag>
<name>showProjectHistory</name>
<tag-class>mil.usaf.rad.metrics.report.showProjectHistoryTag</tag-class>
<body-content>empty</body-content>
</tag>
</taglib>Next, here is the relevant section of web.xml that defines this taglib:
<taglib>
<taglib-uri>/WEB-INF/report.tld</taglib-uri>
<taglib-location>/WEB-INF/report.tld</taglib-location>
</taglib>Next, the code for showProjectTeamTag.java:
* showProjectTeam.java
* Created on March 9, 2005, 10:46 AM
package mil.usaf.rad.metrics.report;
import java.io.*;
import java.sql.*;
import java.lang.Integer;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
* @author jason.ferguson
public class showProjectTeamTag extends TagSupport
public showProjectTeamTag()
super();
public int doAfterBody() throws JspException
HttpServletRequest req = (HttpServletRequest) pageContext.getRequest();
int pr_id = Integer.parseInt(req.getParameter("pr_id"));
JspWriter out = pageContext.getOut();
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try
out.print("test");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn = DriverManager.getConnection("jdbc:odbc:Metrics");
catch (Exception e)
throw new JspException(e.getMessage());
String queryGetTeam = "SELECT Projects.pr_id, Accounts.name AS Name, Sum(Schedule.hours) AS SumOfhours FROM tblTAAccounts AS Accounts INNER JOIN ((tblTAScheduleEntries AS Schedule INNER JOIN tblProjectRelease AS ProjectRelease ON Schedule.projectID = ProjectRelease.tblFKTimeAccntProject) INNER JOIN tblPMProjects AS Projects ON ProjectRelease.Release_ID = Projects.pr_id) ON Accounts.accountID = Schedule.accountID WHERE Projects.pr_id=" + pr_id + " GROUP BY Projects.pr_id, Accounts.name, ProjectRelease.Release_number, Projects.Project_name";
try
out.print(queryGetTeam);
stmt = conn.createStatement();
rs = stmt.executeQuery(queryGetTeam);
if (rs == null)
out.print("No Results!");
out.print("<table>\n");
out.print("<tr>\n");
out.print("<th>Name</th>\n");
out.print("<th>Total Hours</th>\n");
out.print("</tr>\n");
while(rs.next())
out.print("<tr>\n");
out.print("<td>" + rs.getString("Name") + "</td>\n");
out.print("<td>" + rs.getInt("SumOfhours") + "</td>\n");
out.print("</tr>\n");
out.print("</table>\n");
rs.close();
stmt.close();
conn.close();
catch (Exception e)
throw new JspException(e.getMessage());
return SKIP_BODY;
}Finally, projectdetail.jsp, where the tag is called:
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="java.sql.*" %>
<%@page import="java.lang.Integer" %>
<%@taglib uri="/WEB-INF/report.tld" prefix="report" %>
<html>
<head><title>Project Detail</title></head>
<body>
<h1 align="center">Project Status</h1>
<h3>Project Description</h3>
<report:showProjectInfo />
<h3>Team Members</h3>
<report:showProjectTeam />
</body>
</html>The first tag, <report:showProjectInfo />, works fine. However, I get no output whatsoever when the system encounters <report:showProjectTeam />. I am a relative newbie at this, so any help is appreciated.
JasonIt doesnt seem to matter if the code is in doStartTag(), doEndTag(), orr any of the other functions.
I also put, as the first item in the function:
System.out.println("TEST");Nothing.
Just as an aside, here is the code for the <prefix:showProjectInfo />. Maybe I made a mistake in it? I closed the resultset and connection...
import java.io.*;
import java.sql.*;
import java.lang.Integer;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
* @author jason.ferguson
public class showProjectInfoTag extends BodyTagSupport
public int doEndTag() throws JspException
HttpServletRequest req = (HttpServletRequest) pageContext.getRequest();
int pr_id = Integer.parseInt(req.getParameter("pr_id"));
JspWriter out = pageContext.getOut();
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn = DriverManager.getConnection("jdbc:odbc:Metrics");
catch (Exception e)
throw new JspException(e.getMessage());
String queryProjectInfo = "SELECT * FROM tblPMProjects WHERE pr_id=" + pr_id;
try
stmt = conn.createStatement();
rs = stmt.executeQuery(queryProjectInfo);
while (rs.next())
out.print("<table border=\"1\" style=\"border-collapse:collapse\">\n");
out.print("<tr>\n");
out.print("<td><b>Project Name:</b>" + rs.getString("Project_name") + "</td>\n");
out.print("<td align=\"right\"><b>RAD Number:</b>" + rs.getString("tblProjectNumber") + "</td>\n");
out.print("</tr>\n");
out.print("<tr>\n");
out.print("<td>Project description: " + rs.getString("Project_description") + "</td>\n");
out.print("</tr>\n");
out.print("<tr>\n");
out.print("<td>Customer: " + rs.getString("Customer_POC") + "</td>");
out.print("<tr>\n");
out.print("<tr>\n");
out.print("<td>Customer Unit: " + rs.getString("Customer_OFC") + "</td>\n");
out.print("</tr>\n");
out.print("<tr>\n");
out.print("<td>Customer Phone: " + rs.getString("Customer_phone") + "</td>\n");
out.print("</tr>\n");
out.print("</table>\n");
rs.close();
stmt.close();
conn.close();
catch (Exception e)
throw new JspException(e.getMessage());
finally
//conn.close();
return SKIP_BODY; -
Passing Javascript Enabled or Disabled value in a custom tag
Hi,
In my JSP I am using a custom tag.
This custom tag is having one attribute called status(whose value will be jsenabled means true or jsdisabled means false) depending on the browser's javascript enabled or disabled
How can i find the value of javascript enabled or javascript disabled and set the value of the attribute status in my jsp.
This is the custom tag
<t:tab summary="tabs" url="/services/eservicepac/registrationprocess/process.wss" tabNames='<%=tabList%>' currentTab="<%=currentTab%>" zone="WWW_ZONE" fetchText="false" status=" "
</t:tab>
The value of this attribute status=" " should be the value of jsenabled or disabled.
Since the user can visit any page at any time, the jsenabled value is not maintained in session or request, so i can't take from session or request also.
As this is urgent,
--I am expecting the replyHi Merlin,
In addition to what was written above, you must make sure that you tell your web application to run as a JSP 2.0 web application.
You do this by defining your web.xml a little differently. Like this at the top:
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd">
That should be what you need to get it working correctly.
Damian Sutton -
I want to create a custom tag that has a attribute that ask
for a number. like below...
<cf_makeattributes number="?">
Now say I made that number something like 5
<cf_makeattributesnumber=
"5">
I would like for the tag to take that number and make 5
attributes called "Form" in a array from 1 to 5 like below...
<cfset attributes.form = arraynew(1)>
<cfloop index="i" from="1" to="#attributes.number#">
#attributes.form
</cfloop>
Is it possible to make a tag that ask for a number like 5 and
make 5 attributes and within the same tag assign values to those 5
attributes. for example consider the above.
<cf_makeattributes number="5" attribute1="hi"
attribute2="hello" attribute3="howdy" attribute4="hey"
attribute5="HOWE!">
or say i want to make 2 attributes and assign 2 values to
those attributes
<cf_makeattributes number="2" attribute1="This tag asked
for 2 numbers" attribute2="and therefore gave me the ability to
make 2 attributes">
I also have another question that kinda applies to the
question above.
How does the coldfusion server read the tags. for example
look at below
<cf_makeattributes number="2" attribute1="hello"
attribute2="world">
would the server read it like this...
step 1
<
cf_makeattributes number="2" attribute1="hello"
attribute2="world">
step 2
<cf_makeattributes
number="2" attribute1="hello" attribute2="world">
step 3
makeattributes.CFM (it now goes to the template that holds
the tags scripts)
Or does it first read all thats bold below
<cf_makeattributes
number="2" attribute1="hello" attribute2="world">
then goes to the makeattributes template. Is there away I
can compile my script one step at a time like C# and C++ just to
see the steps
PLUS Do i have to put my custom tag into a specific folder or
can I just put it in the same folder as the document thats calling
the custom tag> I could either make a bunch of attributes that will grab
all the
> values or I could loop out a array of attributes. Thats
my goal
I was with you until that line. The term attributes is
confusing in this context. I'm not sure if you're talking about
attributes in a generic sense or the custom tag attribute
scope.
> Now here wat im thinking now. What if instead I put the
forms in a list. something like this...
> <cf_Formentry
Forms="#Form.one#,#form.two#,#form.three#">
Do you mean form
fields?
Let's try this from a different angle. Can you give a
concrete example of the desired results using this form?
<form>
<input name="username1" value="Alice">
<input name="username2" value="Bob">
<input name="username3" value="Kyle">
<input name="username4" value="Michelle">
<input name="username5" value="Robert">
</form> -
Custom tag SetProperty: Mandatory attribute property missing
Ok, first some code. Here's the contents of my displayCollection.tag:
<%@ tag body-content="scriptless" import="com.serco.inquire.*" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ attribute name="mgr" required="true" %>
<jsp:useBean id="irc" scope="session" class="com.serco.inquire.irCollection">
<jsp:setProperty name="mgrid" value="${mgr}" />
</jsp:useBean>
${irc.mgrid}Here's the JSP I'm calling it from (myq.jsp):
<%@page language="java" import="java.util.*,com.serco.inquire.*" %>
<%@ taglib prefix="inq" tagdir="/WEB-INF/tags" %>
<inq:displayCollection mgr="Chris Novish" />Here's the java class for irCollection (used in the tag file):
package com.serco.inquire;
import java.sql.*;
import java.util.*;
public class irCollection {
public String mgrid;
public irCollection() {
super();
public void setMgrid(String datum) {
this.mgrid = datum;
public String getMgrid() {
return this.mgrid;
}And finally, here's the error I get when i try to run myq.jsp:
org.apache.jasper.JasperException: /WEB-INF/tags/displayCollection.tag(7,2) SetProperty: Mandatory attribute property missing org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:41)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:198)
org.apache.jasper.compiler.JspUtil.checkAttributes(JspUtil.java:174)
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:595)
org.apache.jasper.compiler.Node$SetProperty.accept(Node.java:1150)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2428)
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:647)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1182)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2428)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2434)
org.apache.jasper.compiler.Node$Root.accept(Node.java:475)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1789)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:216)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:372)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:352)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:339)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:594)
org.apache.jasper.servlet.JspServletWrapper.loadTagFile(JspServletWrapper.java:231)
org.apache.jasper.compiler.TagFileProcessor.loadTagFile(TagFileProcessor.java:577)
org.apache.jasper.compiler.TagFileProcessor.access$000(TagFileProcessor.java:48)
org.apache.jasper.compiler.TagFileProcessor$TagFileLoaderVisitor.visit(TagFileProcessor.java:642)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1539)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2428)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2434)
org.apache.jasper.compiler.Node$Root.accept(Node.java:475)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
org.apache.jasper.compiler.TagFileProcessor.loadTagFiles(TagFileProcessor.java:660)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:228)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:372)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:352)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:339)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:594)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:344)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)>
as far as I can tell, the attribute mgr is set in myq.jsp when it invokes displayCollection.tag, and displayCOllection.tag's only attribute (required) is mgr. so uhm... what do I misunderstand?Nick,
Thanks for your help.
But I also face another problem that is
"unable to load class com.jguru.FormBean" when I tried to call another jsp.
Here are my code :
package com.jguru;
public class FormBean {
private String LName;
private String FName;
private String Passwd;
private String Tel;
private String Title;
private String Dept;
private String Email;
private String Accesstype;
public FormBean() {
LName="";
FName="";
Passwd="";
Tel="";
Title="";
Dept="";
Email="";
Accesstype="";
public String getLName() {
return LName;
public String getFName() {
return FName;
public String getPasswd() {
return Passwd;
public String getTel() {
return Tel;
public String getTitle() {
return Title;
public String getDept() {
return Dept;
public String getEmail() {
return Email;
public String getAccesstype() {
return Accesstype;
public void setLName(String x) {
LName = x;
public void setFName(String x) {
FName = x;
public void setPasswd(String x) {
Passwd = x;
public void setTel(String x) {
Tel = x;
public void setTitle(String x) {
Title = x;
public void setDept(String x) {
Dept = x;
public void setEmail(String x) {
Email = x;
public void setAccesstype(String x) {
Accesstype = x;
Thanks. -
Assigning bean property to custom tag's attribute
1. The #{beanName.property} notation can only be used inside JSF tags.
2. The attributes of custom tags does not accept embedded tags.
e.g. <prefix:tagName attrib1="<jsftag>">
I need to assign a bean's property to the attrib1 attribute. how do I do this?Alternatively, how can I assign the value of a bean property to a variable?
e.g.
<%
int var=<bean.property>
%>
I can use the variable on the custom tag like this:
<prefix:tagName attrib1="<%=var%>"> OR
But this may not be the best solution though because I have to use scriptlets... -
Custom tag attributes and rtexprvalue property
I have created a custom tag. In my .tld file I have added <rtexprvalue>true</rtexprvalue>
for several of the tag's attributes. Now I want to be able to pass values to
these attributes with the expression syntax:
eg <mytagprefix:pager maxRecordCount="{pageFlow.maxRecords}" />
where maxRecords is a public variable in my pageflow.
In my tag code to assign the value of maxRecordCount I have the following:
public void setMaxRecordCount(String maxRecordCount) throws JspException
Object obj = null;
obj = evaluateExpression(maxRecordCount, "maxRecordCount");
if(hasErrors())
reportErrors();
localRelease();
else
pb.setMaxRecordCount(new Long(((String) obj)).longValue());
I keep getting compile time errors in my jsp such as:
Error: no match was found for method setMaxRecordCount(long) in type package.PagerTag.
where package is the package of my custom class PagerTag.
In my pageflow maxRecordCount is a String. I don't understand why it is looking
for a long. Sometimes the error goes away and I thought I had gotten it to work
but then I realized that it was only working as long as the name of my attribute
and the name of my public variable matched and that is not what I wanted to do.
Should I be able to do what I am doing? I can instead pass this to the tag:
<netui-data:getData resultId="maxreccount" value="{pageFlow.maxRecordCount}" />
maxRecordCount="<%=(String) pageContext.getAttribute(\"maxreccount\")%>"
but that is much less convenient.
Thanks for any help.
RobinHello,
Yes I forgot to include the faces xml DD. Here are the portions of code relating to the component and renderers:
<render-kit>
<renderer>
<component-family>MyFamily</component-family>
<renderer-type>MyRenderer</renderer-type>
<renderer-class>essaisUn.MyRenderer</renderer-class>
</renderer>
</render-kit>
<component>
<component-type>MyComponent</component-type>
<component-class>essaisUn.MyComponent</component-class>
<component-extension>
<component-family>MyFamily</component-family>
<renderer-type>MyRenderer</renderer-type>
</component-extension>
</component>I changed from "<hello>" to "hello" and I still get the same exception.
Can anyone bail me out?
Thanks in advance,
Julien Martin. -
Custom Tag: pass my own type in as attribute
I thought I can pass any type as attribute into my custom tag. I tried, but failed. The exception is:
org.apache.jasper.JasperException: Unable to convert '${myType}' to class MyTpye for attribute myAttribute: java.lang.IllegalArgumentException: Property Editor not registered with the PropertyEditorManager.
I know I can pass the value in using PageContext attribute. However, still want to figure out how to do it through custom tag attribute.
Here's my taglig file:
<tag>
<name>myTag</name>
<tag-class>MyTagClass</tag-class>
<body-content>empty</body-content>
<attribute>
<name>myAttribute</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>MyType</type>
</attribute>
</tag>
What am I missing here? Thanks.Hi
Pls tell me how did you resolve this issue. I am also facing the same problem.
Thanks
Prakash -
Hi folks,
I am trying to create a custom tag that accepts a java.util.Locale as a parameter, and for some reason the container is giving me all kinds of attitude. Here's the detail:
----from the .tld---
<tag>
<name>loadMasthead</name>
<tag-class>uiTagHandlers.LoadMasthead</tag-class>
<body-content>empty</body-content>
<description>Paints the masthead for a given page</description>
<attribute>
<name>locale</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>java.util.Locale</type>
</attribute>
</tag> ---end tld--
from the jsp-
<%@ taglib uri="/WEB-INF/simpleUITags.tld" prefix="helper" %>
<%@ page import="java.util.Locale" %>
<helper:loadMasthead locale="<%= Locale.US %>" />---end jsp----
---from the handler-----
public int doTagStart() throws JspTagException{
JspWriter out = pageContext.getOut();
try{
if( locale != null)
out.print( UIHelper.loadMasthead(locale) );
else
out.print( UIHelper.loadMasthead() );
}catch( Exception ex ){
throw new JspTagException( ex.getMessage() );
return SKIP_BODY;
public int doTagEnd() throws JspTagException{
return SKIP_PAGE;
* Sets the locale.
* @param locale The locale to set
public void setLocale(java.util.Locale locale) {
this.locale = locale;
end handler---
Here's the error I'm getting from the container:
[8/5/04 12:14:34:704 EDT] 7abbd628 WebGroup E SRVE0026E: [Servlet Error]-[Unable to convert string '<%= Locale.US %>' to class java.util.Locale for attribute locale: java.lang.IllegalArgumentException: Property Editor not registered with the PropertyEditorManager]: org.apache.jasper.JasperException: Unable to convert string '<%= Locale.US %>' to class java.util.Locale for attribute locale: java.lang.IllegalArgumentException: Property Editor not registered with the PropertyEditorManager
at org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(JspRuntimeLibrary.java:920)
at org.apache.jsp._index._jspService(_index.java:84)
at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
Any ideas what is going on here?
Thanks in advance,
MattThe taglib always passes a string. The container is supposed to change it to the proper object, but some do not, as it wasn't clear in the original specs (I found various bug reports). My container does not do this properly for taglibs, so I ended up using a bean, which it processed correctly.
Your container can't figure out how to change the String it receives to the Locale object it's supposed to set the property to.
I found a similar problem displayed here:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4727371
You'd need to check with your container docs to see if yours is supposed to be able to do the conversion. If not, you'll either need to write it yourself or do what I did and use a bean so it never passes a string to begin with.
Maybe you are looking for
-
Logon Failed Error in Crystal Reports
Hiii Experts, We are facing one error while working on crystal reports 2008 and SAP Version 8.8-PL18 and SAP 8.81-PL 9 "Logon Failed" Error comes even when we add all connection details correctly in connection details window, somet
-
All the pricing conditions are not visible for a given sales area, material
Hello All, There is a customized screen with sales area(Sales org, distribution channel and division), material and sold to party. There is buttton when we click it has to display the pricing conditions. The problem here is it is not displaying all t
-
Is This Hardware Upgrade Feasible?
My current system is an xw6200 HP workstation. The display adapter is a GeForce GTX 260 OC, having 896 MB of GDDR3 memory (on a 448-bit bus), DirectX 10 support and a default GPU clock rate of 576 MHz. This adapter drives 2 x NEC MultiSync LCD2690W
-
Hi, my computer is not detecting any display, i'd been having this problem since i connected my computer to a tv, the tv burned up, and after that my port doesn't detect anything at all?? Was that the problem can I fix it.I have the lion 10.7.5. Dont
-
Placing 8 objects on stage in a circle
Hi, Need some help placing 8 150X150 circles on stage at equidistant locations around a larger circle (644X644, line width 4, centered on stage). Stage is 750X750. This is not dynamically drawn in runtime. Simply getting the correct coordinates for t