Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7509261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:51:08+00:00 2026-05-29T22:51:08+00:00

I want to define a jsp tag, which can accept some extra attributes which

  • 0

I want to define a jsp tag, which can accept some extra attributes which are not declared in the .tld file. Is it possible?

I want this because I want to define a <cms:img> tag, which will generate a html img tag. User can pass some attributes to it, but I don’t want to limit user, I hope they can use it just as a normal html img tag.

For example, user can use this tag and pass some required information:

<cms:img id="111" />

Which will generate a html img tag as:

<img src="/show_images?id=111" />

All I need is a id attribute.

But user may treat it as a normal html img tag, and pass some extra attributes to it, like:

<cms:img id="111" width="100px" height="100px" style="..." more attributes .. />

I don’t want to declare the other attributes in my tag, because there are too many, and user may have their custom attributes.

So I want to know: Can I just declare the id attribute in the jsp tag, but let it accept all the other undeclared attributes?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T22:51:11+00:00Added an answer on May 29, 2026 at 10:51 pm

    Yes, it’s possible. These are called dynamic attributes. See http://docs.oracle.com/javaee/1.4/tutorial/doc/JSPTags5.html#wp89775:

    dynamic-attributes (optional)

    Indicates whether this tag supports
    additional attributes with dynamic names. The value identifies a
    scoped attribute in which to place a Map containing the names and
    values of the dynamic attributes passed during invocation of the tag.
    A translation error results if the value of the dynamic-attributes of
    a tag directive is equal to the value of a name-given of a variable
    directive or the value of a name attribute of an attribute directive.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web app, I want to define my index.jsp file to be
I want to define a method on my application controller which I can then
I want to define a very simple JSP 2.0 tag, but don't know how
I want to define some member variable and some code just in Debug Mode,
I want to define some properties on a class using the [Indexable()] attribute in
I want to define a class that supports __getitem__ , but does not allow
I want to define some Contact Groups. I am wondering where and how does
Simple question really. Can a webapp access a config file I define and put
Here's the scenario: I want define a base class that allocate some buffer once
I want define schema in each xml file that I marshalling. And then get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.