How to get ServletContext from Interceptor.init

2008-01-05 Thread Néstor Boscán
Hi
 
Is there a way to get the ServletContext from Interceptor.init. I tried
using the ActionContext but it returns null.
 
Regards,
 
Néstor Boscán


How to set multiple cookies to access them using bean:cookie multiple="yes" tag.

2008-01-05 Thread sai reddy

I'm a newbie to struts. I wanted to practice  tag's 'multiple' 
attribute.
But the problem is i don't know how to set multiple cookies.
Please help me.

I tried this code to set multiple cookies...but only the last
cookie gets added...i mean the first one gets replaced by the
second cookie resulting in only one cookie set at the end.

##
##  response.addCookie(new Cookie("animal","dog")); ##
##  response.addCookie(new Cookie("animal","cat")); ##
##

Please tell me how to set multiple cookies..




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



Re: [S2] Action-specific interceptor config sanity check needed.

2008-01-05 Thread Dave Newton
Never mind :(

(Apparently actually reading the stack trace can be handy sometimes.)

Don't like it, though, and if nobody has any strenuous objections, I'd like
to fix it.

--- Dave Newton <[EMAIL PROTECTED]> wrote:

> Howdy,
> 
> 
>   
> #{'cool': 'map'}
>   
>   ... etc ...
> 
> 
> Generates an NPE on startup.
> 
> If I switch to:
> 
> 
>   
>   
>   #{'cool' : 'map'}
>   alias1_input
> 
> 
> it works as expected.
> 
> Note that if I use "defaultStack" instead of "basicStack" in the second
> example it breaks, but at runtime w/ an OGNL exception.
> 
> I'm assuming I'm doing something dorky, because I'm sick and tired, but I
> sure don't know what it is yet, so a hint would be appreciated.
> 
> Thanks,
> Dave
> 
> 
> 
> -
> 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] Action-specific interceptor config sanity check needed.

2008-01-05 Thread Dave Newton
Howdy,


  
#{'cool': 'map'}
  
  ... etc ...


Generates an NPE on startup.

If I switch to:


  
  
  #{'cool' : 'map'}
  alias1_input


it works as expected.

Note that if I use "defaultStack" instead of "basicStack" in the second
example it breaks, but at runtime w/ an OGNL exception.

I'm assuming I'm doing something dorky, because I'm sick and tired, but I
sure don't know what it is yet, so a hint would be appreciated.

Thanks,
Dave



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



Re: RE: S2: chart result type not recognized

2008-01-05 Thread John . C . Cartwright
Thanks for your offer to help Martin!  

Listed below is the struts.xml, web.xml, and source for the Action class
(taken straight from the docs).
I'm testing it by simply typing the URL into the browser: 

http://localhost:8000/viewer-commons-2.0/chart/ViewModeration.action

I notice that if I embed the same URL into the src attribute of an img
element in an html page, the chart displays.  Makes me think perhaps the
mime type is not being set.  Is this possible?  In that case would I
potentially get different behavior from Apache/Tomcat on different
platforms (Mac vs Linux)?

--john

=== struts.xml ===

http://struts.apache.org/dtds/struts-2.0.dtd";>








sessionTimeout.jsp
error.jsp

204
SessionTimeoutException
${exception}












listMapSessions.jsp







400
300





400
300







=== ViewModerationChartAction.java ===
/*
 * example taken from Struts docs
 * (http://struts.apache.org/2.0.11/docs/jfreechart-plugin.html)
 */
package com.jccartwright;


import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.CategoryAxis;
import org.jfree.chart.axis.CategoryLabelPositions;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.renderer.category.BarRenderer;
import org.jfree.data.category.CategoryDataset;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.ui.ApplicationFrame;
import org.jfree.ui.RefineryUtilities;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
import org.jfree.chart.renderer.xy.StandardXYItemRenderer;
import org.jfree.chart.axis.ValueAxis;
import org.jfree.chart.plot.XYPlot;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.Preparable;
import org.apache.commons.lang.math.RandomUtils;

public class ViewModerationChartAction extends ActionSupport {

   private JFreeChart chart;

   public String execute() throws Exception {
  // chart creation logic...
  XYSeries dataSeries = new XYSeries(new Integer(1)); //pass a key
for this serie
  for (int i = 0; i <= 100; i++) {
 dataSeries.add(i, RandomUtils.nextInt());
  }
  XYSeriesCollection xyDataset = new XYSeriesCollection(dataSeries);

  ValueAxis xAxis = new NumberAxis("Raw Marks");
  ValueAxis yAxis = new NumberAxis("Moderated Marks");

  // set my chart variable
  chart =
 new JFreeChart(
"Moderation Function",
JFreeChart.DEFAULT_TITLE_FONT,
new XYPlot(
   xyDataset,
   xAxis,
   yAxis,
   new StandardXYItemRenderer(StandardXYItemRenderer.LINES)),
false);
  chart.setBackgroundPaint(java.awt.Color.white);

  return super.SUCCESS;
   }

   public JFreeChart getChart() {
  return chart;
   }

}


=== web.xml ===


http://java.sun.com/xml/ns/j2ee"; 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
 xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xs
d" 
 version="2.4">
  viewer-commons
  viewer-commons
  
struts2
   
org.apache.struts2.dispatcher.FilterDispatcher
  
  
struts2
/*
  
  
/index.jsp
  
  
   
gov.noaa.eds.arcims.tng.listeners.ContextListener
  
  
   
gov.noaa.eds.arcims.tng.listeners.SessionListener
  


- Original Message -
From: Martin Gainty <[EMAIL PROTECTED]>
Date: Saturday, January 5, 2008 2:56 pm
Subject: RE: S2: chart result type not recognized

> 
> Johncan you post the code you are implementingjspsActionServlet
> as well as the configuration filesweb.xmlany struts*.xml
> Thanks/Martin 
> __Disclaimer and 
> confidentiality noteEverything in this e-mail and any attachments 
> relates to the official business of Sender. This transmission is of 
> a confidential nature and Sender does not endorse distribution to 
> any party other than intended recipient. Sender does not 
> necessarily endorse content contained within this transmission.> 

RE: S2: chart result type not recognized

2008-01-05 Thread Martin Gainty

Johncan you post the code you are implementingjspsActionServlet
as well as the configuration filesweb.xmlany struts*.xml
Thanks/Martin __Disclaimer and 
confidentiality noteEverything in this e-mail and any attachments relates to 
the official business of Sender. This transmission is of a confidential nature 
and Sender does not endorse distribution to any party other than intended 
recipient. Sender does not necessarily endorse content contained within this 
transmission.> Date: Sat, 5 Jan 2008 11:30:45 -0700> From: [EMAIL PROTECTED]> 
Subject: Re: S2: chart result type not recognized> To: user@struts.apache.org> 
> Hi Ian,> > thanks for your reply. For testing purposes, I'm simply calling it 
via URL:> > 
http://localhost:8080/viewer-commons-2.0/chart/serverIronLoadChart.action> > 
Strangely, I was able to get the chart example from the docs to run in> new 
context, I just can't seem to be able to integrate it into a more> complex 
existing application. I'm assuming that the result type is not> being 
recognized, but don't see any errors in the logs and don't know> how to pursue 
debugging the problem.> > By the way, I really enjoyed your recent Struts2 
book!> > > --john> > - Original Message -> From: Ian Roughley <[EMAIL 
PROTECTED]>> Date: Friday, January 4, 2008 7:43 am> Subject: Re: S2: chart 
result type not recognized> > > How are you referencing the action? I always 
use an img tag like > > this:> > > > > 
> /Ian> > > > -- > > Ian Roughley> > From Down & Around, Inc.> > Consulting * 
Training / Mentoring * Agile Process * Open Source> > web: http://www.fdar.com 
- email: [EMAIL PROTECTED]> > > > > > > > John Cartwright wrote:> > > Hello 
All,> > >> > > I'm having a little trouble getting a chart result type > > 
configured > > > using the package declaration below. Whenever I hit the > > 
associated > > > URL, my browser prompts me to save a "bin" file rather than > 
> > displaying the chart. The bin file is a valid png, but somehow > > Struts > 
> > is not recognizing the returned type. Can anyone suggest what > > I'm > > > 
doing wrong?> > >> > > Thanks!> > >> > > -- john> > >> > >> > >  > namespace="/chart">>  > > > > 
class="gov.noaa.eds.arcims.tng.action.ServerIronLoadChartAction">> > > > > > 400> > > 300> > > > > > > > > > > >> > > 
--> > ---> > > 
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]> 
_
Make distant family not so distant with Windows Vista® + Windows Live™.
http://www.microsoft.com/windows/digitallife/keepintouch.mspx?ocid=TXT_TAGLM_CPC_VideoChat_distantfamily_012008

[S2] logic:redirect substitute

2008-01-05 Thread Marcin Pietraszek
Hi,

as in subject. Is there in Struts2 tag which have the same behavior as
 from Struts1? If no, how I can achive simillar effect
with S2 tags?

-- 
greetings! kbl/Cinek/greengoo
marcin.pietraszek.pl

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



Re: S2: chart result type not recognized

2008-01-05 Thread John . C . Cartwright
Hi Ian,

thanks for your reply.  For testing purposes, I'm simply calling it via URL:

http://localhost:8080/viewer-commons-2.0/chart/serverIronLoadChart.action

Strangely, I was able to get the chart example from the docs to run in
new context, I just can't seem to be able to integrate it into a more
complex existing application.  I'm assuming that the result type is not
being recognized, but don't see any errors in the logs and don't know
how to pursue debugging the problem.

By the way, I really enjoyed your recent Struts2 book!


--john

- Original Message -
From: Ian Roughley <[EMAIL PROTECTED]>
Date: Friday, January 4, 2008 7:43 am
Subject: Re: S2: chart result type not recognized

> How are you referencing the action?  I always use an img tag like 
> this:
> 
> 
> /Ian
> 
> -- 
> Ian Roughley
> From Down & Around, Inc.
> Consulting * Training / Mentoring * Agile Process * Open Source
> web: http://www.fdar.com - email: [EMAIL PROTECTED]
> 
> 
> 
> John Cartwright wrote:
> > Hello All,
> >
> > I'm having a little trouble getting a chart result type 
> configured 
> > using the package declaration below.  Whenever I hit the 
> associated 
> > URL, my browser prompts me to save a "bin" file  rather than 
> > displaying the chart.  The bin file is a valid png, but somehow 
> Struts 
> > is not recognizing the returned type.  Can anyone suggest what 
> I'm 
> > doing wrong?
> >
> > Thanks!
> >
> > -- john
> >
> >
> >  namespace="/chart">>   > 
> class="gov.noaa.eds.arcims.tng.action.ServerIronLoadChartAction">>  
>   
> >400
> >300
> > 
> >  
> >   
> >
> > --
> ---
> > 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: [S2] Adding a new interceptor to every package.

2008-01-05 Thread stanlick
Hey GF --

Your package declaration can extend multiple packages by using the comma!



Scott

On Jan 4, 2008 10:36 AM, GF <[EMAIL PROTECTED]> wrote:

> Hi everyone.
> I have many packages that extends extends="tiles-default".
> I would like to add an interceptor to all of them.
>
> Now I'm doing this:
>
> namespace="/myspace">
>
>
> />
>
>
>
>
>
>
>
>...
>
>
> But I should do this to Every one.. and it is not nice..
> Can you suggest me a quicker (and more elegant) way?
>
> Thank you!
>
> GF
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Scott
[EMAIL PROTECTED]


Re: [S2] Adding a new interceptor to every package.

2008-01-05 Thread GF
Really I have still some issues.

my struts.xml is built in this way:






In every included xml i define a different package for a different
section of the, i.e. in struts1.xml I define the package name="one"

If I put the package name="default" inside struts1.xml I can extend
package "one" from "default"...
But if I put package name ="default" at the begininning of struts.xml
when I launch the application it says that package "one" cannot find
the referenced "default" package..




...





In few words it seems that inside the included XML i cannot reference
packages defined in the main XML.. is this true?

Thank you

> Sure: define the stack once, then reference it from each of your packages:
>
>
>  
>
>
>  
>  
>
>  
>
>  
>
>
>
>
>  ...actions...
>
>

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



XHTML Form validation problems... for ever!

2008-01-05 Thread Manos Batsis


I'm using commons-validator 1.3.1 with Struts 1.3.8 and 1.3.9. In short, 
the jcv_retrieveFormName function returns nothing, so other functions 
that try to use it end up with errors looking up for variables (well 
functions) like "_required" when they should look for formnameOrId_required.


I've had related problems since I can remember trying to use XHTML with 
the JS validation stuff. Am I missing something?


Many thanks,

Manos


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



Re: [S2] Adding a new interceptor to every package.

2008-01-05 Thread GF
thank you very much!

>
> Sure: define the stack once, then reference it from each of your packages:
>
>
>  
>
>
>  
>  
>
>  
>
>  
>
>
>
>
>  ...actions...
>
>

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



The file cannot be validated as the host "struts.apache.org" is currently unreachable.

2008-01-05 Thread Subhash_K

Hi,

I am new to struts. For learning I am using Struts 2.0.11 and Eclipse 3.3.1
Europa.
After Importing Struts-blank.war file in eclipse I get these wornings for
struts.xml and exmple.xml  as well as Login-validation.xml
warnings are as follows :- 
The file cannot be validated as the host "struts.apache.org" is currently
unreachable.
The file cannot be validated as the host "www.opensymphony.com" is currently
unreachable.
-- 
View this message in context: 
http://www.nabble.com/The-file-cannot-be-validated-as-the-host-%22struts.apache.org%22-is-currently-unreachable.-tp14632214p14632214.html
Sent from the Struts - User mailing list archive at Nabble.com.


RE: wrong request parameters sent

2008-01-05 Thread ravi_eze

yaa i am presetting the checkbox.

any how i got the solution, may b a workaround one:i wrote a reset
interceptor which would always reset the checkbox vairable of the action
class when the jsp page is submitted. now if the checkbox is not selected
the value remains reset.





mgainty wrote:
> 
> 
> are you pre-setting the value or fieldValue attributes for s:checkbox
> please display code in your jspMartin
> __Disclaimer and
> confidentiality noteEverything in this e-mail and any attachments relates
> to the official business of Sender. This transmission is of a confidential
> nature and Sender does not endorse distribution to any party other than
> intended recipient. Sender does not necessarily endorse content contained
> within this transmission.> Date: Mon, 31 Dec 2007 21:48:12 -0800> From:
> [EMAIL PROTECTED]> To: user@struts.apache.org> Subject: Re: wrong request
> parameters sent> > > hi any help?> > > > ravi_eze wrote:> > > > hi,> > > >
> i have 3 checkboxes(c1,c2,c3) enclosed in a form (theme: ajax;> >
> validate=true). I am trying to get the validation done by ajax and when i>
> > un-check all boxes or check some of the boxes i see that always c3 is> >
> being set in request parameter.> > > > when i tried to debug i found the
> following statement in> > validationClient.js which could be a cause of
> this behavior:> > > > var vc = this;> > var form = input.form;> > var
> params = new Object();> > for (var i = 0; i < form.elements.length; i++)
> {> > var e = form.elements[i];> > if (e.name != null && e.name != '') {> >
> params[e.name] = e.value;> > }> > }> > > > which is always putting the 3rd
> checkbox in the request parameter even> > though its not checked. If i
> remove all ajax related attributes (i.e.> >  parameters are going right and the validations> > are happening fine. > >
> > > any ideas where i am going wrong/ is any body else is also getting
> the> > same behavior?> > > > > > -- > View this message in context:
> http://www.nabble.com/wrong-request-parameters-sent-tp14555088p14564745.html>
> Sent from the Struts - User mailing list archive at Nabble.com.> > >
> -> To
> unsubscribe, e-mail: [EMAIL PROTECTED]> For additional
> commands, e-mail: [EMAIL PROTECTED]> 
> _
> Don't get caught with egg on your face. Play Chicktionary!
> http://club.live.com/chicktionary.aspx?icid=chick_wlhmtextlink1_dec
> 

-- 
View this message in context: 
http://www.nabble.com/wrong-request-parameters-sent-tp14555088p14631571.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Struts 2 + Spring 2 + JPA + AJAX tutorial

2008-01-05 Thread Alvaro Sanchez-Mariscal
Quoting:

"1. Create a folder named "META-INF" under the "src" folder.
2. Create a file named "persistence.xml" under the "META-INF" folder
and set its content to..."

Content within src should be compiled into WEB-INF/classes.

Doing the maven way, this file should be in src/main/resources

Alvaro.


On Jan 5, 2008 4:03 AM, Pascal SEREMES-DAMAL <[EMAIL PROTECTED]> wrote:
> All the code is there :
> http://struts.apache.org/2.0.11/docs/struts-2-spring-2-jpa-ajax.html
>
> But I had a problem to deploy the application on my tomcat server.
>
> Musachy and Laurie suggested to move the file persistence.xml from
> /META-INF (where indicated in the tutorial) to
> /WEB-INF/classes/META-INF.
>
> Enjoy.
>
>
> Pascal
>
>
> 2008/1/4, Frans Thamura <[EMAIL PROTECTED]>:
> > can we have the code also?
> >
> > F
> >
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
Alvaro Sanchez-Mariscal Arnaiz
Java EE Architect & Instructor
[EMAIL PROTECTED]

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