Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » JSP validation foobarred by my taglib function
JSP validation foobarred by my taglib function [message #208672] Mon, 18 February 2008 11:12 Go to next message
Eclipse UserFriend
Originally posted by: adam.hardy.no.spam.cyberspaceroad.spam

Firstly is this actually the right forum to talk about JSP validation? It is
part of WTP, isn't it?

Eclipse's JSP validator is great but is seriously unhappy with my taglibs:

<%@ taglib prefix="a" uri="http://www.permacode.org/taglib/atomic-1.0" %>
<input type="submit" id="speciesSubmit"
value="${a:translate('general.submit.button')}"
name="method:save" />
<input type="reset" value="${a:translate('general.reset.button')}"/>
<input type="submit" name="method:cancel"
value="${a:translate('general.cancel.button')}"/>

The errors don't make sense:

Syntax error on token "throws", delete this token

or

Syntax error on token ",", . expected

There must be something about my use of JSTL functions. I set them up per the
instructions in the Java web tutorial:

<function>
<name>translate</name>
<function-class>org.permacode.atomic.JspFunctionLibrary</function-class >
<function-signature>
java.lang.String translate(java.lang.String)
</function-signature>
</function>


They compile and run fine, so I'm unsure what to do. If I replace my JSTL
functions with standard functions, e.g. ${fn:length()} for instance, the
validator loves it.

Can anyone tell me what the issue is?

thanks
Adam
Re: JSP validation foobarred by my taglib function [message #208713 is a reply to message #208672] Mon, 18 February 2008 21:47 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4434
Registered: July 2009
Senior Member

adam hardy wrote:
> Firstly is this actually the right forum to talk about JSP validation?
> It is part of WTP, isn't it?

This is absolutely the right forum, as it's something provided by WTP.

> Eclipse's JSP validator is great but is seriously unhappy with my taglibs:
>
> <%@ taglib prefix="a"
> uri="http://www.permacode.org/taglib/atomic-1.0" %>
> <input type="submit" id="speciesSubmit"
> value="${a:translate('general.submit.button')}"
> name="method:save" />
> <input type="reset" value="${a:translate('general.reset.button')}"/>
> <input type="submit" name="method:cancel"
> value="${a:translate('general.cancel.button')}"/>
>
> The errors don't make sense:
>
> Syntax error on token "throws", delete this token
>
> or
>
> Syntax error on token ",", . expected
>
> There must be something about my use of JSTL functions. I set them up
> per the instructions in the Java web tutorial:
>
> <function>
> <name>translate</name>
> <function-class>org.permacode.atomic.JspFunctionLibrary</function-class >
> <function-signature>
> java.lang.String translate(java.lang.String)
> </function-signature>
> </function>
>
>
> They compile and run fine, so I'm unsure what to do. If I replace my
> JSTL functions with standard functions, e.g. ${fn:length()} for
> instance, the validator loves it.
>
> Can anyone tell me what the issue is?

Without looking at the library or its translation by WTP, there's
unfortunately not much that can be done to diagnose the problem. If
you can, though, please retry it with today's 3.0M5 milestone. You
might be affected by bug 215615 for all I know. It's also possible
that the EL translation isn't quite right--try appending a scriptlet
with just a semicolon after the tags where you're invoking EL functions.

---
Nitin Dahyabhai
Eclipse WTP Source Editing
IBM Rational


_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: JSP validation foobarred by my taglib function [message #208740 is a reply to message #208713] Tue, 19 February 2008 00:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: adam.hardy.no.spam.cyberspaceroad.spam

Nitin Dahyabhai on 18/02/08 21:47, wrote:
> adam hardy wrote:
>> Firstly is this actually the right forum to talk about JSP validation?
>> It is part of WTP, isn't it?
>
> This is absolutely the right forum, as it's something provided by WTP.
>
>> Eclipse's JSP validator is great but is seriously unhappy with my
>> taglibs:
>>
>> <%@ taglib prefix="a"
>> uri="http://www.permacode.org/taglib/atomic-1.0" %>
>> <input type="submit" id="speciesSubmit"
>> value="${a:translate('general.submit.button')}"
>> name="method:save" />
>> <input type="reset" value="${a:translate('general.reset.button')}"/>
>> <input type="submit" name="method:cancel"
>> value="${a:translate('general.cancel.button')}"/>
>>
>> The errors don't make sense:
>>
>> Syntax error on token "throws", delete this token
>>
>> or
>>
>> Syntax error on token ",", . expected
>>
>> There must be something about my use of JSTL functions. I set them up
>> per the instructions in the Java web tutorial:
>>
>> <function>
>> <name>translate</name>
>>
>> <function-class>org.permacode.atomic.JspFunctionLibrary</function-class >
>> <function-signature>
>> java.lang.String translate(java.lang.String)
>> </function-signature>
>> </function>
>>
>>
>> They compile and run fine, so I'm unsure what to do. If I replace my
>> JSTL functions with standard functions, e.g. ${fn:length()} for
>> instance, the validator loves it.
>>
>> Can anyone tell me what the issue is?
>
> Without looking at the library or its translation by WTP, there's
> unfortunately not much that can be done to diagnose the problem. If you
> can, though, please retry it with today's 3.0M5 milestone. You might be
> affected by bug 215615 for all I know. It's also possible that the EL
> translation isn't quite right--try appending a scriptlet with just a
> semicolon after the tags where you're invoking EL functions.

Adding a scriptlet with <%;%> makes no substantial difference in some places,
and in others perhaps it solved one 'validation error' or two in the list for
the line but never all.

Bug 215615 seems to be be unrelated, but unfortunately I can't take time to
verify that by upgrading to a milestone at this point due to my current workload.

Here's the code for the EL function if that helps:

public static String translate(String key) throws JspException
{
if (pageContextHolder.get() == null)
{
throw new JspException(
"Not initialized! Place the JspFunctionLibrary taglib "
+ "at the top of the first JSP used in the request!");
}
return LocaleSupport.getLocalizedMessage(pageContextHolder.get(), key);
}

public static String url(String url) throws JspException
{
if (pageContextHolder.get() == null)
{
throw new JspException(
"Not initialized! Place the JspFunctionLibrary taglib "
+ "at the top of the first JSP used in the request!");
}
HttpServletRequest request =
(HttpServletRequest) pageContextHolder.get().getRequest();
String context = request.getContextPath();
if (url.indexOf("/") == 0) {
url= url.substring(1);
}
return context + "/" + url;
}
Re: JSP validation foobarred by my taglib function [message #208747 is a reply to message #208713] Tue, 19 February 2008 00:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: adam.hardy.no.spam.cyberspaceroad.spam

Nitin Dahyabhai on 18/02/08 21:47, wrote:
> adam hardy wrote:
>> Firstly is this actually the right forum to talk about JSP validation?
>> It is part of WTP, isn't it?
>
> This is absolutely the right forum, as it's something provided by WTP.
>
>> Eclipse's JSP validator is great but is seriously unhappy with my
>> taglibs:
>>
>> <%@ taglib prefix="a"
>> uri="http://www.permacode.org/taglib/atomic-1.0" %>
>> <input type="submit" id="speciesSubmit"
>> value="${a:translate('general.submit.button')}"
>> name="method:save" />
>> <input type="reset" value="${a:translate('general.reset.button')}"/>
>> <input type="submit" name="method:cancel"
>> value="${a:translate('general.cancel.button')}"/>
>>
>> The errors don't make sense:
>>
>> Syntax error on token "throws", delete this token
>>
>> or
>>
>> Syntax error on token ",", . expected
>>
>> There must be something about my use of JSTL functions. I set them up
>> per the instructions in the Java web tutorial:
>>
>> <function>
>> <name>translate</name>
>>
>> <function-class>org.permacode.atomic.JspFunctionLibrary</function-class >
>> <function-signature>
>> java.lang.String translate(java.lang.String)
>> </function-signature>
>> </function>
>>
>>
>> They compile and run fine, so I'm unsure what to do. If I replace my
>> JSTL functions with standard functions, e.g. ${fn:length()} for
>> instance, the validator loves it.
>>
>> Can anyone tell me what the issue is?
>
> Without looking at the library or its translation by WTP, there's
> unfortunately not much that can be done to diagnose the problem. If you
> can, though, please retry it with today's 3.0M5 milestone. You might be
> affected by bug 215615 for all I know. It's also possible that the EL
> translation isn't quite right--try appending a scriptlet with just a
> semicolon after the tags where you're invoking EL functions.

Adding a scriptlet with <%;%> makes no substantial difference in some places,
and in others perhaps it solved one 'validation error' or two in the list for
the line but never all.

Bug 215615 seems to be be unrelated, but unfortunately I can't take time to
verify that by upgrading to a milestone at this point due to my current workload.

Here's the code for the EL function if that helps:

public static String translate(String key) throws JspException
{
if (pageContextHolder.get() == null)
{
throw new JspException(
"Not initialized! Place the JspFunctionLibrary taglib "
+ "at the top of the first JSP used in the request!");
}
return LocaleSupport.getLocalizedMessage(pageContextHolder.get(), key);
}

public static String url(String url) throws JspException
{
if (pageContextHolder.get() == null)
{
throw new JspException(
"Not initialized! Place the JspFunctionLibrary taglib "
+ "at the top of the first JSP used in the request!");
}
HttpServletRequest request =
(HttpServletRequest) pageContextHolder.get().getRequest();
String context = request.getContextPath();
if (url.indexOf("/") == 0) {
url= url.substring(1);
}
return context + "/" + url;
}
Re: JSP validation foobarred by my taglib function [message #208754 is a reply to message #208713] Tue, 19 February 2008 00:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: adam.hardy.no.spam.cyberspaceroad.spam

Nitin Dahyabhai on 18/02/08 21:47, wrote:
> adam hardy wrote:
>> Firstly is this actually the right forum to talk about JSP validation?
>> It is part of WTP, isn't it?
>
> This is absolutely the right forum, as it's something provided by WTP.
>
>> Eclipse's JSP validator is great but is seriously unhappy with my
>> taglibs:
>>
>> <%@ taglib prefix="a"
>> uri="http://www.permacode.org/taglib/atomic-1.0" %>
>> <input type="submit" id="speciesSubmit"
>> value="${a:translate('general.submit.button')}"
>> name="method:save" />
>> <input type="reset" value="${a:translate('general.reset.button')}"/>
>> <input type="submit" name="method:cancel"
>> value="${a:translate('general.cancel.button')}"/>
>>
>> The errors don't make sense:
>>
>> Syntax error on token "throws", delete this token
>>
>> or
>>
>> Syntax error on token ",", . expected
>>
>> There must be something about my use of JSTL functions. I set them up
>> per the instructions in the Java web tutorial:
>>
>> <function>
>> <name>translate</name>
>>
>> <function-class>org.permacode.atomic.JspFunctionLibrary</function-class >
>> <function-signature>
>> java.lang.String translate(java.lang.String)
>> </function-signature>
>> </function>
>>
>>
>> They compile and run fine, so I'm unsure what to do. If I replace my
>> JSTL functions with standard functions, e.g. ${fn:length()} for
>> instance, the validator loves it.
>>
>> Can anyone tell me what the issue is?
>
> Without looking at the library or its translation by WTP, there's
> unfortunately not much that can be done to diagnose the problem. If you
> can, though, please retry it with today's 3.0M5 milestone. You might be
> affected by bug 215615 for all I know. It's also possible that the EL
> translation isn't quite right--try appending a scriptlet with just a
> semicolon after the tags where you're invoking EL functions.

Adding a scriptlet with <%;%> makes no substantial difference in some places,
and in others perhaps it solved one 'validation error' or two in the list for
the line but never all.

Bug 215615 seems to be be unrelated, but unfortunately I can't take time to
verify that by upgrading to a milestone at this point due to my current workload.

Here's the code for the EL function if that helps:

public static String translate(String key) throws JspException
{
if (pageContextHolder.get() == null)
{
throw new JspException(
"Not initialized! Place the JspFunctionLibrary taglib "
+ "at the top of the first JSP used in the request!");
}
return LocaleSupport.getLocalizedMessage(pageContextHolder.get(), key);
}

public static String url(String url) throws JspException
{
if (pageContextHolder.get() == null)
{
throw new JspException(
"Not initialized! Place the JspFunctionLibrary taglib "
+ "at the top of the first JSP used in the request!");
}
HttpServletRequest request =
(HttpServletRequest) pageContextHolder.get().getRequest();
String context = request.getContextPath();
if (url.indexOf("/") == 0) {
url= url.substring(1);
}
return context + "/" + url;
}
Re: JSP validation foobarred by my taglib function [message #208762 is a reply to message #208713] Tue, 19 February 2008 00:08 Go to previous message
Eclipse UserFriend
Originally posted by: adam.hardy.no.spam.cyberspaceroad.spam

Nitin Dahyabhai on 18/02/08 21:47, wrote:
> adam hardy wrote:
>> Firstly is this actually the right forum to talk about JSP validation?
>> It is part of WTP, isn't it?
>
> This is absolutely the right forum, as it's something provided by WTP.
>
>> Eclipse's JSP validator is great but is seriously unhappy with my
>> taglibs:
>>
>> <%@ taglib prefix="a"
>> uri="http://www.permacode.org/taglib/atomic-1.0" %>
>> <input type="submit" id="speciesSubmit"
>> value="${a:translate('general.submit.button')}"
>> name="method:save" />
>> <input type="reset" value="${a:translate('general.reset.button')}"/>
>> <input type="submit" name="method:cancel"
>> value="${a:translate('general.cancel.button')}"/>
>>
>> The errors don't make sense:
>>
>> Syntax error on token "throws", delete this token
>>
>> or
>>
>> Syntax error on token ",", . expected
>>
>> There must be something about my use of JSTL functions. I set them up
>> per the instructions in the Java web tutorial:
>>
>> <function>
>> <name>translate</name>
>>
>> <function-class>org.permacode.atomic.JspFunctionLibrary</function-class >
>> <function-signature>
>> java.lang.String translate(java.lang.String)
>> </function-signature>
>> </function>
>>
>>
>> They compile and run fine, so I'm unsure what to do. If I replace my
>> JSTL functions with standard functions, e.g. ${fn:length()} for
>> instance, the validator loves it.
>>
>> Can anyone tell me what the issue is?
>
> Without looking at the library or its translation by WTP, there's
> unfortunately not much that can be done to diagnose the problem. If you
> can, though, please retry it with today's 3.0M5 milestone. You might be
> affected by bug 215615 for all I know. It's also possible that the EL
> translation isn't quite right--try appending a scriptlet with just a
> semicolon after the tags where you're invoking EL functions.

Adding a scriptlet with <%;%> makes no substantial difference in some places,
and in others perhaps it solved one 'validation error' or two in the list for
the line but never all.

Bug 215615 seems to be be unrelated, but unfortunately I can't take time to
verify that by upgrading to a milestone at this point due to my current workload.

Here's the code for the EL function if that helps:

public static String translate(String key) throws JspException
{
if (pageContextHolder.get() == null)
{
throw new JspException(
"Not initialized! Place the JspFunctionLibrary taglib "
+ "at the top of the first JSP used in the request!");
}
return LocaleSupport.getLocalizedMessage(pageContextHolder.get(), key);
}

public static String url(String url) throws JspException
{
if (pageContextHolder.get() == null)
{
throw new JspException(
"Not initialized! Place the JspFunctionLibrary taglib "
+ "at the top of the first JSP used in the request!");
}
HttpServletRequest request =
(HttpServletRequest) pageContextHolder.get().getRequest();
String context = request.getContextPath();
if (url.indexOf("/") == 0) {
url= url.substring(1);
}
return context + "/" + url;
}
Previous Topic:tld file as input in plug in extension points
Next Topic:How to create a web project programmatically while another is being created?
Goto Forum:
  


Current Time: Sat Apr 20 01:57:40 GMT 2024

Powered by FUDForum. Page generated in 0.04351 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top