• Post Reply Bookmark Topic Watch Topic
  • New Topic

passing dynamic vars to nested custom tag fails

 
Robert Jaeger
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

I wrote my first custom tags for form processing and everything works fine.
But then I had the following problem:



Unfortunately options (expression!) for the "select"-tag are not passed:



If I put the <sapo:select>-Element outside the form-tag it can access the value, but the outer-tag-relations gets lost.

Can somebody tell me why this happens? Would be great, I couldn't find a solution. I read something about tei-classes, but I cannot find a good explanation what they are good for, they seem to be a relict from the old tag-library-specification.

Regards,
Robert


 
Stefan Evans
Bartender
Posts: 1822
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your JSP where is the value for <%= options %> supposed to come from?

You don't look to have declared a variable in the JSP.
 
Robert Jaeger
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course I did! In a scriptlet:



and then I placed my custom tag code that doesnt recognize the "options"-variable in the nested element "sapo-select" whereas the request variable in the "sapo:form"-tag is recognized!:



Don�t understand it
But anyway, thanks for your answer!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suspect the tld entry for the form tag does not specify the correct content type. What's the tag declaration for the form tag look like?
 
Robert Jaeger
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Thanks for you answer!
I checked it, but everything seems to be correct. Moreover it works, when I put the <select>-tag outside the <form>-tag, so the tld-setting should be correct. It seems that variables passed by expressions don't work with inner tags
But maybe I have to add some code to the form tag to pass variables. Seems that you know more than I do



Regards from Bogot�, Colombia,
Robert
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Robert Jaeger:

I checked it, but everything seems to be correct. Moreover it works, when I put the <select>-tag outside the <form>-tag, so the tld-setting should be correct.


It is not correct.

It seems that variables passed by expressions don't work with inner tags


It will if declared correctly.


<body-content>scriptless</body-content>


What's wrong with this picture?

Also, what class are you extending for your form tag?
 
Robert Jaeger
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Again thanks for your answer!

Well, the content of the <form>-tag is not scriptless (<% ... %> , so I should set the body-content to JSP, which is not supported by the SimpleTag:



The two other available values "empty" and "tagdependent" don't work: empty produces an error since the content is not empty, tagdependent ignores the content.

Does that mean I can't work with SimpleTags in this case?

current code (extended class for Form Tag)


Thanks for your hints! Am I on the right way? So I have to extend from TagSupport?
Regards,
Robert.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Robert Jaeger:
so I should set the body-content to JSP, which is not supported by the SimpleTag ...

Does that mean I can't work with SimpleTags in this case?


Exactly. SimpleTag is a JSP 2.0 mechanism. If you want to continue to use JSP 1.x scriptlets and scriptlet expressions, you need to use the JSP 1.x classic tag handlers.

Or, you could step firmly into the JSP 2.0 world and eschew scriplets completely.
 
Robert Jaeger
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Sheriff Bear Bibeault

Thanks, you helped me a lot with your hints!

Still a lot to learn for me ... I think about going the JSP 2.0 way.

Saludos desde Colombia,
Robert.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!