Re: parse freemarker file that is not action result

2007-07-30 Thread Perssy Llamosas
Try to use a classless action, it will default to 
com.opensymphony.xwork.ActionSupport which always returns success.


action name=search
   result type=freemarkersearch.ftl/result
/action

Perssy Llamosas

 Original Message 
Subject: parse freemarker file that is not action result
From: Leonidas Papadakis [EMAIL PROTECTED]
To: user@struts.apache.org
Date: 30/07/2007 12:53 p.m.

Greetings to all,

i am using struts2. I have a freemarker page search.ftl I wish this 
file to be parsed even if it is not returned by an action (i.e. get 
values from session). I have noticed that only action returned 
freemarker files are rendered.


Can someone suggest what do i have to do so that if i just wright on 
the browser straight the freemarker file it will be parsed ? (The same 
for velocity as well)


Thank you very much. Your answers are appreciated.

Leonidas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Don't expose .action to user?

2007-07-23 Thread Perssy Llamosas

Well...

How would you handle a situation that requires you to use an action with 
slashes?

action name=show/* class=org.beyond.TestAction  method={1} /

Or even better, action with parameters in their uri. show/{1}/{2} ex: 
show/book/43


It has its downfalls. I don't see myself creating hundreds of folders 
and .action files. I wanted to use the restful mapper for RESTful URLs.


Perssy Llamosas

 Original Message 
Subject: Re:Don't expose .action to user?
From: Kevin Lawrence [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Date: 20/07/2007 11:06 a.m.
I have a solution that seems to work. Feedback on whether it is a good 
solution or rather, why it is not, would be wonderful.



Executive summary:
 map *.action to struts filter
 add main.action as the first entry in web.xml's welcome list

Have all user-visible urls look like directories:

  http://www.junitfactory.com/demo

For urls that will be handled by an action, add a file main.action to 
the directory.


Original post is here:
http://www.mail-archive.com/user%40struts.apache.org/msg63838.html

Kevin

http://www.junitfactory.com
You send us code. We send back tests. For free.

Perssy Llamosas wrote:
You can't get rid of the .action, at least in my tests I have not 
being able to map a clean url without the .action. Even the 
Restful2ActionMapper requires a .action at the end.





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Don't expose .action to user?

2007-07-23 Thread Perssy Llamosas

This is what happens:

There is no Action mapped for action name pages/index.html. - [unknown location]

Struts tries to handle everything, wouldn't it be nice to have a fall through?
If Struts can't find the URI within its mapping try to find if there is static 
content with that request.

I am using the action extension configured as an empty string but to avoid 
Struts trying to handle everything,
I mapped the struts filter to /logic/* . 
I am still not convinced with my solution but at least the result is pretty clean and works for me.

And I can use RestFul without .action or map struts to serve dynamic files,
ex: /logic/get/result.csv /logic/get/result.pdf

Perssy Llamosas.

 Original Message 
Subject: Re:Don't expose .action to user?
From: Ted Husted [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Date: 23/07/2007 10:08 a.m.

Try it with the action extension configured to an empty string, and
see what happens.

On 7/23/07, Perssy Llamosas [EMAIL PROTECTED] wrote:

Well...

How would you handle a situation that requires you to use an action with
slashes?
action name=show/* class=org.beyond.TestAction  method={1} /

Or even better, action with parameters in their uri. show/{1}/{2} ex:
show/book/43

It has its downfalls. I don't see myself creating hundreds of folders
and .action files. I wanted to use the restful mapper for RESTful URLs.

Perssy Llamosas

 Original Message 
Subject: Re:Don't expose .action to user?
From: Kevin Lawrence [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Date: 20/07/2007 11:06 a.m.
 I have a solution that seems to work. Feedback on whether it is a good
 solution or rather, why it is not, would be wonderful.


 Executive summary:
  map *.action to struts filter
  add main.action as the first entry in web.xml's welcome list

 Have all user-visible urls look like directories:

   http://www.junitfactory.com/demo

 For urls that will be handled by an action, add a file main.action to
 the directory.

 Original post is here:
 http://www.mail-archive.com/user%40struts.apache.org/msg63838.html

 Kevin

 http://www.junitfactory.com
 You send us code. We send back tests. For free.

 Perssy Llamosas wrote:
 You can't get rid of the .action, at least in my tests I have not
 being able to map a clean url without the .action. Even the
 Restful2ActionMapper requires a .action at the end.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Don't expose .action to user?

2007-07-20 Thread Perssy Llamosas
You can't get rid of the .action, at least in my tests I have not 
being able to map a clean url without the .action. Even the 
Restful2ActionMapper requires a .action at the end.


To make it work without the action you can always set the struts2 
extension to  and map the struts2 filter to somewhere else than /* so 
struts2 lets you serve other content.

web.xml:
!-- snip  --
filter-mapping
   filter-namestruts2/filter-name
   url-pattern/logic/*/url-pattern
/filter-mapping
!-- /snip  --

struts.xml:
!-- snip  --
constant name=struts.action.extension value= /
!-- /snip  --

If someone knows other way without extra prefix and no suffix, please share.

Perssy Llamosas

 Original Message 
Subject: Re:Don't expose .action to user?
From: Adam Ruggles [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Date: 19/07/2007 02:23 p.m.

Here a couple links that should get you started.

http://struts.apache.org/2.0.8/struts2-core/apidocs/org/apache/struts2/dispatcher/mapper/Restful2ActionMapper.html 


http://struts.apache.org/2.0.8/docs/restfulactionmapper.html
http://struts.apache.org/2.0.8/docs/actionmapper.html

Kevin Lawrence wrote:

I have not. Can you give me a link?

Thanks,

Kevin

Adam Ruggles wrote:

Have you looked at using the restful url stuff?

Kevin Lawrence wrote:

I know you were joking but, for me, there are two concerns:

1. I want the urls to be memorable

 www.junitfactory.com/demo

is easier to remember than

 www.junitfactory.com/demo.action (or .htm or .html or .jsp)


2. I will almost certainly move part of my site to a CMS in the 
near future and I don't want to break all the URLs




Kevin


Eric Buitenhuis wrote:
If obscuring the underlying technology is the primary concern, 
perhaps using

*.htm

 instead of *.action for struts 2 while using *.html for static could
be a solution. Then everyone would think you were writing it using 
Microsoft

technology :-)



On 7/19/07, Neil Aggarwal [EMAIL PROTECTED] wrote:


Matt:

I use URLRewrite.  I only have a few rules since
urlreqrite supports regex pattern mathing.

Thanks,
Neil

--
Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
FREE! Eliminate junk email and reclaim your inbox.
Visit http://www.spammilter.com for details.

-Original Message-
From: mraible [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 19, 2007 11:32 AM
To: user@struts.apache.org
Subject: Re: Don't expose .action to user?


I agree it would be nice if you could make totally clean URLs 
with Struts

2
-
as if you had each action registered as servlets in your web.xml.
Unfortunately, I don't believe it's possible. The only solution I 
can

think
of is to use the UrlRewriteFilter.

http://tuckey.org/urlrewrite

While this solution would work, it'd require duplicating your 
action paths
in urlrewrite.xml. I guess the best solution is to write some 
sort of
adapter for the UrlRewriteFilter that sweeps your struts.xml and 
creates
rules to forward all action names (w/o an extension) to your 
actions with

an
extension. In turn, you'd have to write outgoing rules that strip 
off the

extension from URLs.

If someone has a more elegant solution, I'd love to hear about it.

Matt


Chris Pratt wrote:

 We had the same concern, so by putting this in the top of our 
struts.xml

:

   constant name=struts.action.extension value=html/

 It makes all the actions look like regular old .html requests.
   (*Chris*)

 
- 


 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




--
View this message in context:

http://www.nabble.com/Don%27t-expose-.action-to-user--tf4106649.html#a116921 


69
Sent from the Struts - User mailing list archive at Nabble.com.


- 


To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


- 


To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: error

2007-07-17 Thread Perssy Llamosas

Use a JDK, not a JRE as JAVA_HOME.

naseer mohammed wrote:
i am trying to run struts-blank application which encounter this 
exception..



org.apache.jasper.JasperException: No Java compiler available
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510) 

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:387) 

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) 


org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)



help me solve this problem




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [S2] UTF-8

2007-07-13 Thread Perssy Llamosas
This is more a jsp/servlets/tomcat problem. There is a variable that 
controls character encoding in Struts2, it defaults to UTF-8 but I am 
not sure of when it is used by struts, I think it's for .properties reading.

In struts.properties:
struts.i18n.encoding=UTF-8

First you need to tell the tomcat container to read every request in 
UTF-8, you do by adding the property URIEncoding=UTF-8 to the 
connector in your conf/server.xml from your tomcat installation.
Connector port=8080 protocol=HTTP/1.1 connectionTimeout=2 
redirectPort=8443 URIEncoding=UTF-8 /


Then in every jsp/servlet response set the character encoding to UTF-8
In a servlet:
response.setContentType(text/html; charset=UTF-8);
In a jsp:
%@ page contentType=text/html; charset=UTF-8 pageEncoding=UTF-8 %

Then set the page header meta content-type to UTF-8 or IExplorer will 
send ascii even if the page is already in utf-8

meta http-equiv=Content-Type content=text/html; charset=UTF-8

The files (.java .jsp .???) MUST be saved as UTF-8 or the characters 
won't display correctly.


Perssy Llamosas.

Morten wrote:

Hi Perssy

What do you mean by Page Header?

Just curious. Working with some of the same things.

Best regards,
Morten

Perssy Llamosas [EMAIL PROTECTED] skrev i en meddelelse 
news:[EMAIL PROTECTED]
  

Solved it on my own.

The page header requires to be in utf-8 too, it is not enough to have the 
page encoding in jsp to utf-8.

Without that line IE returns ascii while firefox returns utf-8.

Perssy Llamosas wrote:


Hello,

I am trying to make struts read my requests as UTF-8, so far I have 
configured Tomcat connector to uriencode in utf-8 but my struts beans 
still receive ? strings. What am I missing?


Perssy Llamosas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[S2] JSP exception printStackTrace

2007-07-12 Thread Perssy Llamosas

Hello,

I am trying to print the Stack Trace from an exception redirected by 
global-exception-mappings in the struts.xml
I can access the variable using EL but it doesn't seem to exist in the 
page scope since I cannot access it. Where is being stored?


%-- Exception Handler --%
%-- This works --%
div id=error${exception}/div

%-- This doesn't work --%
%
if (exception != null)
   exception.printStackTrace(new PrintWriter(out));
else
   out.write(wtf?);
%

Perssy Llamosas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [S2] JSP exception printStackTrace

2007-07-12 Thread Perssy Llamosas

Okay, I figured it on my own.
%-- works! --%
%
exception = (Exception) request.getAttribute(exception);
if (exception != null)
   exception.printStackTrace(new PrintWriter(out));
%

Perssy Llamosas wrote:

Hello,

I am trying to print the Stack Trace from an exception redirected by 
global-exception-mappings in the struts.xml
I can access the variable using EL but it doesn't seem to exist in the 
page scope since I cannot access it. Where is being stored?


%-- Exception Handler --%
%-- This works --%
div id=error${exception}/div

%-- This doesn't work --%
%
if (exception != null)
   exception.printStackTrace(new PrintWriter(out));
else
   out.write(wtf?);
%

Perssy Llamosas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[S2] UTF-8

2007-07-12 Thread Perssy Llamosas

Hello,

I am trying to make struts read my requests as UTF-8, so far I have 
configured Tomcat connector to uriencode in utf-8 but my struts beans 
still receive ? strings. What am I missing?


Perssy Llamosas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [S2] UTF-8

2007-07-12 Thread Perssy Llamosas

Solved it on my own.

The page header requires to be in utf-8 too, it is not enough to have 
the page encoding in jsp to utf-8.

Without that line IE returns ascii while firefox returns utf-8.

Perssy Llamosas wrote:

Hello,

I am trying to make struts read my requests as UTF-8, so far I have 
configured Tomcat connector to uriencode in utf-8 but my struts beans 
still receive ? strings. What am I missing?


Perssy Llamosas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[S2] Disabling OGNL

2007-07-11 Thread Perssy Llamosas
I am using JSP 2.1 EL rather than the OGNL but I believe OGNL is adding 
extra processing time I don't really require since it appears in the 
profiler.


Is there a way to remove the dependency?

I see this document: http://cwiki.apache.org/WW/ognl.html#OGNL-JSP2.1

But I want to disable OGNL not JSP 2.1 EL.

Perssy Llamosas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts 2.x mapping question

2007-07-10 Thread Perssy Llamosas
Yes, I tried setting that constant but that makes every static file not 
to be served by tomcat.

with:
'struts.action.extension='
there won't be .css .html .js

There must be another way. I have seen examples of custom mappers 
without .action but I don't seem to be able to make them work in struts 2.x


Perssy Llamosas

Don Brown wrote:

You'll need to tell Struts to not use an action extension.  I believe
the setting is 'struts.action.extension=', so by setting it to
nothing, it now won't require the '.action' extension.  You shouldn't
need to use the restful2 action mapper for this to work.  Be warned,
it may not be fully compatible with all the tags.

Don

On 7/10/07, yitzle [EMAIL PROTECTED] wrote:

I found this via Google

http://struts.apache.org/2.0.8/struts2-core/apidocs/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.html 

 Default action mapper implementation, using the standard *.[ext] 
(where ext usually action)
 pattern. The extension is looked up from the Struts configuration 
key struts.action.exection.


HTH

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts 2.x mapping question

2007-07-10 Thread Perssy Llamosas

This article answers my question:

http://www.lunatech-research.com/archives/2005/07/29/struts-urls

There is a big but, mapping each extension in the web.xml to the default 
servlet works but it's not the ideal solution since it would require 
that every extension in my application to be mapped, what about the 
extension less files?. The result would be quite complicated and I am 
trying to make things easier and fast with struts 2.x. Isn't there any 
other way? Perhaps writing a custom mapper or filter?


Perssy Llamosas

Perssy Llamosas wrote:
Yes, I tried setting that constant but that makes every static file 
not to be served by tomcat.

with:
'struts.action.extension='
there won't be .css .html .js

There must be another way. I have seen examples of custom mappers 
without .action but I don't seem to be able to make them work in 
struts 2.x


Perssy Llamosas

Don Brown wrote:

You'll need to tell Struts to not use an action extension.  I believe
the setting is 'struts.action.extension=', so by setting it to
nothing, it now won't require the '.action' extension.  You shouldn't
need to use the restful2 action mapper for this to work.  Be warned,
it may not be fully compatible with all the tags.

Don

On 7/10/07, yitzle [EMAIL PROTECTED] wrote:

I found this via Google

http://struts.apache.org/2.0.8/struts2-core/apidocs/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.html 

 Default action mapper implementation, using the standard *.[ext] 
(where ext usually action)
 pattern. The extension is looked up from the Struts configuration 
key struts.action.exection.


HTH

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Struts 2.x mapping question

2007-07-09 Thread Perssy Llamosas

Hello,

I am trying to configure my struts application to listen to request 
without .action or .do
I think it has to do something with the struts.mapper.class but I cannot 
seem to make it work, I have tried several approaches but I cannot get 
rid of the .action or .do without mapping everything to struts which 
would get rid of the static content.


My current configuration:
web.xml
...
filter-mapping
   filter-namestruts2/filter-name
   url-pattern/*/url-pattern
/filter-mapping
...


struts.xml
struts
   constant name=struts.enable.SlashesInActionNames value=true/
   constant name=struts.mapper.class 
value=org.apache.struts2.dispatcher.mapper.Restful2ActionMapper/

   constant name=struts.mapper.alwaysSelectFullNamespace value=false/

   package name=default extends=struts-default
   action name=search class=org.beyond.SearchAction
   result name=success/pages/result.jsp/result
   /action
   /package
/struts

I want to access to the page as http://localhost:8080/directory/search
I currently access with http://localhost:8080/directory/search.action

Thanks.

Perssy Llamosas.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]