- This topic has 1 reply, 2 voices, and was last updated 19 years, 7 months ago by Riyad Kalla.
-
AuthorPosts
-
koslMemberHello,
I want to develop kind of a template in JSF allowing to write (simplified):<mylib:formField prompt=[PROMPT]>
<h:inputText id=”ID” maxlength=”15″ required=”true” />
</mylib:formField>instead of:
<TR><TD>
<h:outputText value=”[PROMPT]” />
</TD><TD>
<h:inputText id=”ID” maxlength=”15″ required=”true” />
</TD><TD>
<h:message for=”ID” />
</TD></TR>At first I thought that I can simply do that by developing JSP tag. I decided to use tag files for that but then I ran into problems as:
1) tag files seem not to work in my setting. Simple tag file:
<%@ attribute name=”test” required=”true” %>
Test: ${test}
produces as output “Text: ${test}” instead of replacing ${test} with variable value. I guess this is a configuration-issue but I have no idea what I’m doing wrong (I’m using JBoss 4.0.1sp1 which claims to support JSP 2.0)2) I need to produce text: <h:message for=”ID” /> but for this I need ID. I could include it as another argument to my new tag but this would lead to redundancy (ID is in tag and then also in tag body) that I’d prefer to avoid. So I need to somehow obtain the ID from the tag’s body but I have no idea how to do that neatly…
Then I decided to try to develop new component instead of writing a custom tag. But again I run into problems because I know how to write a component that produces desired HTML code in its encode-methods but I have no idea how to write a component that just simply merges few other components into one (which is in fact what I’m aiming at).
I’d be very grateful for any suggestions/references. Thanks in advance!
Kind regards,
kosl
Riyad KallaMember1) tag files seem not to work in my setting. Simple tag file:
<%@ attribute name=”test” required=”true” %>
Test: ${test}
produces as output “Text: ${test}” instead of replacing ${test} with variable value. I guess this is a configuration-issue but I have no idea what I’m doing wrong (I’m using JBoss 4.0.1sp1 which claims to support JSP 2.0)Make sure your web.xml file uses the Web 2.4 schema, this will automatically turn on script evaluation for you. If you are using a 2.3 DTD in your DOCTYPE in your web.xml file, then your scripts will be ignored like they are doing now and you need to add the isELIgnored=false page directive.
2) I need to produce text: <h:message for=”ID” /> but for this I need ID. I could include it as another argument to my new tag but this would lead to redundancy (ID is in tag and then also in tag body) that I’d prefer to avoid. So I need to somehow obtain the ID from the tag’s body but I have no idea how to do that neatly…
You really should ask in the MyFaces user list and/or the Java JSF Forums for help, those guys eat JSF for breakfast 🙂
BTW Moving to OT > Soft Dev.
-
AuthorPosts