You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Alex Siman <al...@gmail.com> on 2009/09/19 05:32:21 UTC

How does Struts serve assets from JAR?

I see that Struts serve theme files (validation.js, styles.css, ...) from
JAR. How does it do it?

All I want is to pack all 3rd part web libs like jQuery, YUI, FCKEdtior...
into JARs e.g.:
jquery.jar
yui.jar
...

-- 
View this message in context: http://www.nabble.com/How-does-Struts-serve-assets-from-JAR--tp25518288p25518288.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Hello Help please with Struts2

Posted by Dave Newton <ne...@yahoo.com>.
O_o

Martin Gainty wrote:
> the struts-tags URL <%@ taglib uri="/struts-tags" prefix="s" %> lookups the uri in *.tld 
> (in this case /WEB-INF/classes/META-INF/struts-tags.tld)
> 
> <!-- struts-tags.tld contents displayed here -->
> <?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>2.2.3</tlib-version>
>     <jsp-version>1.2</jsp-version>
>     <short-name>s</short-name>
> 
>     <uri>/struts-tags</uri>
> 
> <tag>
>         <name>head</name>
>         <tag-class>org.apache.struts2.views.jsp.ui.HeadTag</tag-class>
> 
> make sure the accompanying jar containing the classes such as HeadTag are located either on WEB-INF/classes or WEB-INF/lib
> 
> .\WebappName\WEB-INF\lib\struts2-core-2.1.6.jar
> 
> Martin 
> ______________________________________________ 
> Verzicht und Vertraulichkeitanmerkung
>  
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> 
> 
> 
> 
> 
> 
>> From: Harasevich@yandex.ru
>> To: user@struts.apache.org
>> Subject: Hello Help please with Struts2
>> Date: Sat, 19 Sep 2009 21:55:59 +0100
>>
>> Hello
>>
>> When running samples struts 2
>>
>> Here is exception relative to this taglib in NetBeans7.1:
>> <%@ taglib uri="/struts-tags" prefix="s" %>
>>
>>
>>
>> org.apache.jasper.JasperException: /example/HelloWorld.jsp(2,41) PWC6117: 
>> File "/struts-tags" not found
>>         at 
>> org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:73)
>>         at 
>> org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:359)
>>         at 
>> org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:153)
>>
>>
>> Do not now reason why this error appear , beacause struts2-core-2.0.11.jar 
>> is on classpath ?
>>
>> Thanks.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
> 
> _________________________________________________________________
> Bing brings you health info from trusted sources.
> http://www.bing.com/search?q=pet+allergy&form=MHEINA&publ=WLHMTAG&crea=TXT_MHEINA_Health_Health_PetAllergy_1x1


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Hello Help please with Struts2

Posted by Konstantyn Harasevich <Ha...@yandex.ru>.
Hello

Thanks very much to all responses  this issue is resolved
with this message.

Kostya
----- Original Message ----- 
From: "Martin Gainty" <mg...@hotmail.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Saturday, September 19, 2009 11:53 PM
Subject: RE: Hello Help please with Struts2



the struts-tags URL <%@ taglib uri="/struts-tags" prefix="s" %> lookups the 
uri in *.tld
(in this case /WEB-INF/classes/META-INF/struts-tags.tld)

<!-- struts-tags.tld contents displayed here -->
<?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>2.2.3</tlib-version>
    <jsp-version>1.2</jsp-version>
    <short-name>s</short-name>

    <uri>/struts-tags</uri>

<tag>
        <name>head</name>
        <tag-class>org.apache.struts2.views.jsp.ui.HeadTag</tag-class>

make sure the accompanying jar containing the classes such as HeadTag are 
located either on WEB-INF/classes or WEB-INF/lib

.\WebappName\WEB-INF\lib\struts2-core-2.1.6.jar

Martin
______________________________________________
Verzicht und Vertraulichkeitanmerkung

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene 
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte 
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht 
dient lediglich dem Austausch von Informationen und entfaltet keine 
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von 
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.






> From: Harasevich@yandex.ru
> To: user@struts.apache.org
> Subject: Hello Help please with Struts2
> Date: Sat, 19 Sep 2009 21:55:59 +0100
>
> Hello
>
> When running samples struts 2
>
> Here is exception relative to this taglib in NetBeans7.1:
> <%@ taglib uri="/struts-tags" prefix="s" %>
>
>
>
> org.apache.jasper.JasperException: /example/HelloWorld.jsp(2,41) PWC6117:
> File "/struts-tags" not found
>         at
> org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:73)
>         at
> org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:359)
>         at
> org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:153)
>
>
> Do not now reason why this error appear , beacause struts2-core-2.0.11.jar
> is on classpath ?
>
> Thanks.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

_________________________________________________________________
Bing brings you health info from trusted sources.
http://www.bing.com/search?q=pet+allergy&form=MHEINA&publ=WLHMTAG&crea=TXT_MHEINA_Health_Health_PetAllergy_1x1 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Hello Help please with Struts2

Posted by Martin Gainty <mg...@hotmail.com>.
the struts-tags URL <%@ taglib uri="/struts-tags" prefix="s" %> lookups the uri in *.tld 
(in this case /WEB-INF/classes/META-INF/struts-tags.tld)

<!-- struts-tags.tld contents displayed here -->
<?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>2.2.3</tlib-version>
    <jsp-version>1.2</jsp-version>
    <short-name>s</short-name>

    <uri>/struts-tags</uri>

<tag>
        <name>head</name>
        <tag-class>org.apache.struts2.views.jsp.ui.HeadTag</tag-class>

make sure the accompanying jar containing the classes such as HeadTag are located either on WEB-INF/classes or WEB-INF/lib

.\WebappName\WEB-INF\lib\struts2-core-2.1.6.jar

Martin 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.






> From: Harasevich@yandex.ru
> To: user@struts.apache.org
> Subject: Hello Help please with Struts2
> Date: Sat, 19 Sep 2009 21:55:59 +0100
> 
> Hello
> 
> When running samples struts 2
> 
> Here is exception relative to this taglib in NetBeans7.1:
> <%@ taglib uri="/struts-tags" prefix="s" %>
> 
> 
> 
> org.apache.jasper.JasperException: /example/HelloWorld.jsp(2,41) PWC6117: 
> File "/struts-tags" not found
>         at 
> org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:73)
>         at 
> org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:359)
>         at 
> org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:153)
> 
> 
> Do not now reason why this error appear , beacause struts2-core-2.0.11.jar 
> is on classpath ?
> 
> Thanks.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

_________________________________________________________________
Bing brings you health info from trusted sources.
http://www.bing.com/search?q=pet+allergy&form=MHEINA&publ=WLHMTAG&crea=TXT_MHEINA_Health_Health_PetAllergy_1x1

Re: Hello Help please with Struts2

Posted by mu...@aol.com.
 When you say "on the classpath" do you mean the compile classpath of the project or is the jar physically in
WEB-INF/lib?


 


Chris

 


 

-----Original Message-----
From: Wes Wannemacher <we...@wantii.com>
To: Struts Users Mailing List <us...@struts.apache.org>
Sent: Sat, Sep 19, 2009 6:55 pm
Subject: Re: Hello Help please with Struts2










Which app server do you have set up in netbeans?

On 9/19/09, Konstantyn Harasevich <Ha...@yandex.ru> wrote:
> Hello
>
> When running samples struts 2
>
> Here is exception relative to this taglib in NetBeans7.1:
> <%@ taglib uri="/struts-tags" prefix="s" %>
>
>
>
> org.apache.jasper.JasperException: /example/HelloWorld.jsp(2,41) PWC6117:
> File "/struts-tags" not found
>         at
> org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:73)
>         at
> org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:359)
>         at
> org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:153)
>
>
> Do not now reason why this error appear , beacause struts2-core-2.0.11.jar
> is on classpath ?
>
> Thanks.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org




 


Re: Hello Help please with Struts2

Posted by Wes Wannemacher <we...@wantii.com>.
Which app server do you have set up in netbeans?

On 9/19/09, Konstantyn Harasevich <Ha...@yandex.ru> wrote:
> Hello
>
> When running samples struts 2
>
> Here is exception relative to this taglib in NetBeans7.1:
> <%@ taglib uri="/struts-tags" prefix="s" %>
>
>
>
> org.apache.jasper.JasperException: /example/HelloWorld.jsp(2,41) PWC6117:
> File "/struts-tags" not found
>         at
> org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:73)
>         at
> org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:359)
>         at
> org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:153)
>
>
> Do not now reason why this error appear , beacause struts2-core-2.0.11.jar
> is on classpath ?
>
> Thanks.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Hello Help please with Struts2

Posted by Konstantyn Harasevich <Ha...@yandex.ru>.
Hello

When running samples struts 2

Here is exception relative to this taglib in NetBeans7.1:
<%@ taglib uri="/struts-tags" prefix="s" %>



org.apache.jasper.JasperException: /example/HelloWorld.jsp(2,41) PWC6117: 
File "/struts-tags" not found
        at 
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:73)
        at 
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:359)
        at 
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:153)


Do not now reason why this error appear , beacause struts2-core-2.0.11.jar 
is on classpath ?

Thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: How does Struts serve assets from JAR?

Posted by Alex Siman <al...@gmail.com>.
Thanx for the link!

Indeed, for now I store frameworks into webapp subdir like:
my-eclipse-proj/src/webapp/lib/fckeditor/2.6.4.1
my-eclipse-proj/src/webapp/lib/jquery/1.3.2
my-eclipse-proj/src/webapp/lib/jquery-ui/1.7.2
my-eclipse-proj/src/webapp/lib/yui/2.7.0b
and so on...

But I have some problems with this:
- if I use "search/replace" through my project, I must to exclude
"src/webapp/lib" - boring;
- eclipse annoy me about error in HTML markup of fckeditor's sources;
- there a lot of files (of these frameworks) to commit to my project repo.

It would be nice to pack all these "annoyance" into separate jars, e.g.:
my-eclipse-proj/lib/fckeditor-2.6.4.1.jar
my-eclipse-proj/lib/jquery-1.3.2.jar
my-eclipse-proj/lib/jquery-ui-1.7.2.jar
my-eclipse-proj/lib/yui-2.7.0b.jar
and so on...

and then unpack them on deploy.

But how to do this automatically? Ant, Maven? I need elegant solution,
better integrated with eclipse.


Musachy Barroso wrote:
> 
> why would you wan to do that? Packing static content inside a jar is
> bad by itself (performance hit to read from inside the jar, at least
> once, in the case of struts...every time you access the resource),
> letting struts serve static content is also bad, as struts is not
> designed/optimized for such a task. You will be better off letting the
> container serve those files. But if you really wan to do that, just
> drop the content inside a "/static" directory and use the url tag to
> build a url for it, like:
> 
> <s:url var="someCss" value="/static/something.css"/>
> 
> see http://struts.apache.org/2.x/docs/static-content.html
> 
> musachy
> 
> On Fri, Sep 18, 2009 at 8:32 PM, Alex Siman <al...@gmail.com>
> wrote:
>>
>> I see that Struts serve theme files (validation.js, styles.css, ...) from
>> JAR. How does it do it?
>>
>> All I want is to pack all 3rd part web libs like jQuery, YUI,
>> FCKEdtior...
>> into JARs e.g.:
>> jquery.jar
>> yui.jar
>> ...
>>
>> --
>> View this message in context:
>> http://www.nabble.com/How-does-Struts-serve-assets-from-JAR--tp25518288p25518288.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 
> 
> -- 
> "Hey you! Would you help me to carry the stone?" Pink Floyd
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-does-Struts-serve-assets-from-JAR--tp25518288p25521385.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: How does Struts serve assets from JAR?

Posted by Musachy Barroso <mu...@gmail.com>.
why would you wan to do that? Packing static content inside a jar is
bad by itself (performance hit to read from inside the jar, at least
once, in the case of struts...every time you access the resource),
letting struts serve static content is also bad, as struts is not
designed/optimized for such a task. You will be better off letting the
container serve those files. But if you really wan to do that, just
drop the content inside a "/static" directory and use the url tag to
build a url for it, like:

<s:url var="someCss" value="/static/something.css"/>

see http://struts.apache.org/2.x/docs/static-content.html

musachy

On Fri, Sep 18, 2009 at 8:32 PM, Alex Siman <al...@gmail.com> wrote:
>
> I see that Struts serve theme files (validation.js, styles.css, ...) from
> JAR. How does it do it?
>
> All I want is to pack all 3rd part web libs like jQuery, YUI, FCKEdtior...
> into JARs e.g.:
> jquery.jar
> yui.jar
> ...
>
> --
> View this message in context: http://www.nabble.com/How-does-Struts-serve-assets-from-JAR--tp25518288p25518288.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org