Custom types and select lists

2010-04-19 Thread Lance Hill
I  am trying to find an example of how to populate a select list of objects,
show the correct item as selected, and if the selection is saved, properly
update the object containing the item. In the example below, I would want to
show a group of fields for Student information with a select list of
Campuses. If the Student is already stored with a specific Campus, that
should be selected. If the selection choice is changed, saving the Student
should update what Campus object is contained by the Student.

 

I have a custom TypeConverter  to convert between the Campus id string and
Campus objects and I can see the conversion code executes fine.
Unfortunately, saving a selection results in an "invalid field value for
field 'campus'" error and when I first call up the page, the selected Campus
is not the correct one.

 

 

public class Student {

 

  private Campus campus;

  

  public Campus getCampus() {return campus; }

  public void setCampus(Campus campus) {this.campus = campus; }

}

 

public class Campus {

 

  private Long id;

private String name;

  

  public Long getId() {return name; }

  public void setId(Long id) {this.id = id; )

  public String getName() {return name; }

  public void setName(String name) {this.name = name; }

}

 

public class StudentAction extends ActionSupport implements ModelDriven,
Preparable {

 

protected Object model;

private Student student;

  private Campus campus;

private List campusList; 

  private DB db;

  private long id;

 

  public void prepare() throws Exception {   

campusList = db.findAllCampuses();

if (getId() == 0) {

student = db.createNewStudent(); 

} else { 

student = db.findByStudentId(getId()); 

} 

  }

 

  public String save() {

  try {

  db.save(getModel());

} catch (Exception e) {

  return ERROR;

}

  return SUCCESS;

}

  public Student getModel() {return student; }

public long getId() {return id; }

public void getId() {return id; }

 

}

 

public class CampusConverter extends StrutsTypeConverter {

  

private DB db;

  

  public Object convertFromString(Map context, String[] values, Class
toClass) {

  Campus campus = null;

if (values != null && values.length > 0 && values[0] != null &&
values[0].length() > 0) {

campus = db.findCampusById(new Long(values[0]));

}

return campus;

  }

  public String convertToString(Map context, Object o) {

if (o instanceof Campus) {

return ((Campus)o).getId().toString();

}

return "";

  }

}

 



  







  



 

Suggestions, corrections, pointers, or links to examples/tutorials of how to
do this properly would be greatly appreciated.

 

 

Regards,

Lance Hill



RE: SecurityContextHolder.getContext().getAuthentication() returning null

2010-03-17 Thread Lance Hill
I'm using Spring 3/Spring Security 3.

I tried using  on the 
protected page and the username actually appears when I go directly to 
http://localhost/jsp/hello.jsp. 

If I go to http://localhost/hello.action, the  tag renders nothing and 
SecurityContextHolder.getContext().getAuthentication() returns a null value.

Here is my struts.xml


 
 
/jsp/hello.jsp




And my web.xml





springSecurityFilterChain

org.springframework.web.filter.DelegatingFilterProxy



action2-cleanup

org.apache.struts2.dispatcher.ActionContextCleanUp



sitemesh

com.opensymphony.module.sitemesh.filter.PageFilter



action2

org.apache.struts2.dispatcher.FilterDispatcher



   CAS Single Sign Out Filter
   
org.jasig.cas.client.session.SingleSignOutFilter


 


action2-cleanup
/*


sitemesh
/*


action2
/*



   CAS Single Sign Out Filter
   /*



  springSecurityFilterChain
  /*






org.jasig.cas.client.session.SingleSignOutHttpSessionListener



org.springframework.web.context.ContextLoaderListener



org.apache.tiles.web.startup.TilesListener




dwr
uk.ltd.getahead.dwr.DWRServlet

debug
true



jspSupportServlet

org.apache.struts2.views.JspSupportServlet
5


tiles
org.apache.tiles.web.startup.TilesServlet


org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
/WEB-INF/tiles-defs.xml

2



dwr
/dwr/*





index.jsp
default.jsp
index.html



403
/403.jsp




-Original Message-
From: Lukasz Lenart [mailto:lukasz.len...@googlemail.com] 
Sent: Wednesday, March 17, 2010 11:52 AM
To: Struts Users Mailing List
Subject: Re: SecurityContextHolder.getContext().getAuthentication() returning 
null

2010/3/17 Lance Hill :
> Any hints about why SecurityContextHolder.getContext().getAuthentication()
> would return a null?

Spring version? Configuration? Did you try the simplest possible setup?


Regards
-- 
Łukasz
http://www.lenart.org.pl/
Kapituła Javarsovia 2010
http://javarsovia.pl

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



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



SecurityContextHolder.getContext().getAuthentication() returning null

2010-03-17 Thread Lance Hill
I am trying to get access to the currently logged in user, but when I call
SecurityContextHolder.getContext().getAuthentication(), the Authentication
returned is null. I am assuming the user is logged in since they have access
to the secure page I am testing, but I don't know how to tell for sure since
I cannot access the Authentication object.

 

Any hints about why SecurityContextHolder.getContext().getAuthentication()
would return a null?



RE: Getting the authenticated user from Spring Security for use in an Action

2010-03-17 Thread Lance Hill
I tried using that, but SecurityContextHolder.getContext() returns a null
value. Any thoughts on how to fix that?

-Original Message-
From: Hoying, Ken [mailto:ken_hoy...@premierinc.com] 
Sent: Wednesday, March 17, 2010 7:36 AM
To: Struts Users Mailing List
Subject: RE: Getting the authenticated user from Spring Security for use in
an Action

Try:

SecurityContextHolder.getContext().getAuthentication().getPrincipal()

-Original Message-
From: Lance Hill [mailto:la...@baldhead.com] 
Sent: Tuesday, March 16, 2010 5:15 PM
To: 'Struts Users Mailing List'
Subject: Getting the authenticated user from Spring Security for use in an
Action

I need to access information about the currently logged in user. I don't
think putting the user into the session during login is how it is supposed
to be done, but I have not found examples of how to get access to the
current user from Spring/Spring Security. Can someone please provide a link
or brief example of the best practice?


Thank you.


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

-
***Note:The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited.  If you have
received this communication in error, please notify the Sender
immediately by replying to the message and deleting it from your
computer.  Thank you.  Premier Inc.

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



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



RE: Getting the authenticated user from Spring Security for use in an Action

2010-03-16 Thread Lance Hill
I used the same method to obtain the Authentication, but it returns as null.
The user is logged in since it gets to the protected page I am accessing.
Any thoughts on how to get the properly populated SecurityContext? 


-Original Message-
From: Wes Wannemacher [mailto:w...@wantii.com] 
Sent: Tuesday, March 16, 2010 5:54 PM
To: Struts Users Mailing List
Subject: Re: Getting the authenticated user from Spring Security for use in
an Action

I use -

SecurityContextHolder.getContext().getAuthentication()

I assume that if the object returned is null, then the user isn't logged in.

I am using spring-security 2.0.4.

-Wes

On Tue, Mar 16, 2010 at 5:42 PM, Lance Hill  wrote:
> I have Spring Security set up to use CasAutheticationProvider to provide a
> UserDetails object.
>
> I did find an example that uses the SecurityContext to obtain an
> Authentication object and grab the UserDetails from there. I am not sure
how
> to get access to the populated SecurityContext since
> SecurityContextHolder.getContext() is returning an empty SecurityContext
and
> I am not sure if that is the best way to access the user.
>
>
> -Original Message-
> From: Wes Wannemacher [mailto:w...@wantii.com]
> Sent: Tuesday, March 16, 2010 5:16 PM
> To: Struts Users Mailing List
> Subject: Re: Getting the authenticated user from Spring Security for use
in
> an Action
>
> What mechanism are you using to handle authentication/authorization?
>
> -Wes
>
> On Tue, Mar 16, 2010 at 5:14 PM, Lance Hill  wrote:
>> I need to access information about the currently logged in user. I don't
>> think putting the user into the session during login is how it is
supposed
>> to be done, but I have not found examples of how to get access to the
>> current user from Spring/Spring Security. Can someone please provide a
> link
>> or brief example of the best practice?
>>
>>
>> Thank you.
>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@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-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@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-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



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



RE: Getting the authenticated user from Spring Security for use in an Action

2010-03-16 Thread Lance Hill
I have Spring Security set up to use CasAutheticationProvider to provide a
UserDetails object. 

I did find an example that uses the SecurityContext to obtain an
Authentication object and grab the UserDetails from there. I am not sure how
to get access to the populated SecurityContext since
SecurityContextHolder.getContext() is returning an empty SecurityContext and
I am not sure if that is the best way to access the user.


-Original Message-
From: Wes Wannemacher [mailto:w...@wantii.com] 
Sent: Tuesday, March 16, 2010 5:16 PM
To: Struts Users Mailing List
Subject: Re: Getting the authenticated user from Spring Security for use in
an Action

What mechanism are you using to handle authentication/authorization?

-Wes

On Tue, Mar 16, 2010 at 5:14 PM, Lance Hill  wrote:
> I need to access information about the currently logged in user. I don't
> think putting the user into the session during login is how it is supposed
> to be done, but I have not found examples of how to get access to the
> current user from Spring/Spring Security. Can someone please provide a
link
> or brief example of the best practice?
>
>
> Thank you.
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@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-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



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



Getting the authenticated user from Spring Security for use in an Action

2010-03-16 Thread Lance Hill
I need to access information about the currently logged in user. I don't
think putting the user into the session during login is how it is supposed
to be done, but I have not found examples of how to get access to the
current user from Spring/Spring Security. Can someone please provide a link
or brief example of the best practice?


Thank you.


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



Struts + Spring 3

2010-03-09 Thread Lance Hill
I am currently working on a project that uses maven, struts 2, spring, and
spring security and ran into a big headache when trying to use spring
security 3.

 

Does anyone have an example of a working application that uses Spring 3
together with Struts 2? The reason I ask is that I was using the
struts-spring-plugin 2.1.8 and when I started to implement spring security,
I used version 3 which requires spring version 3, but the plugin relies on
spring 2.5.6.

 

Thank you,

Lance Hill



Single Sign On And Spring Security

2010-02-25 Thread Lance Hill
Hello,

 

I am hoping someone can provide me with some links or examples of how to
combine Struts 2 with Spring security. The end goal is to use Spring
security to access a CAS server (http://www.jasig.org/cas) in order to
provide single sign on ability between a Struts2 application and a Wordpress
site.

 

Thank you,

Lance Hill

 



Old tiles site

2008-10-14 Thread Lance Java
When I type in tiles2 into google, the first result is this page
http://struts.apache.org/struts-sandbox/tiles/index.html
I had been using this as a reference until I discovered it was out of date
and has moved here http://tiles.apache.org/index.html

It would have been nice if the old site had told me this first thing.

Cheers,
Lance.


Re: How to allow to download several files in a zip in Internet Explorer

2008-10-14 Thread Lance Java
Try zos.flush() instead of close()
It is not your responsibility to close the servlet output stream, it is the
container's.

2008/10/13 Ariel <[EMAIL PROTECTED]>

> Hi Everybody:
> I 'm using struts 1.2 version, in my web application I have a chart where
> the user can add several files that are located in the server, then in a
> hiperlink the user decide to download the several files in a zip file. I
> implemented this functionalities, in Mozilla Firefox works perfectly but
> with Internet Explorer doesn't work.
> Please could you help to find how to do it correctly to make it works in
> both browsers ???
> Here I post a piece of my code:
> 
> ServletContext  context  =
> getServlet().getServletContext();
> String  mimetype =
> context.getMimeType(filename);
> resp.setContentType( (mimetype != null) ? mimetype
> :"multipart/mixed" );
> resp.setHeader( "Content-Disposition", "attachement;
> filename=\"chart.zip\"" );
> ZipOutputStream zos = new
> ZipOutputStream(resp.getOutputStream());
> ChartStructure chart = (ChartStructure)
> req.getSession().getAttribute("chart");
>byte[] buf = new byte[1024];
>int len;
> for (Iterator iterator = chart.iterator();
> iterator.hasNext();){
> Files elem = iterator.next();
> ZipEntry zipEntry = new
> ZipEntry(elem.getPhisicalFileName());
> String filepath = elem.getDownloadLink();
>FileInputStream fin = new FileInputStream(path);
>BufferedInputStream in = new BufferedInputStream(fin);
>zos.putNextEntry(zipEntry);
>while ((len = in.read(buf)) >= 0) {
>   zos.write(buf, 0, len);
>}
>in.close();
>zos.closeEntry();
>}
> zos.close();
> 
>
> I hope you can help me.
> Greetings
> Ariel
>


Re: Using tiles 2 with struts 1

2008-10-13 Thread Lance Java
> 2. Use (and probably fix) the Struts 1/Tiles 2 plugin:
This is what I'm after... thanks!

> Spring 2.5 has an integration layer to Tiles 2:
Yep... that's the easy bit :)

Thanks,
Lance.

2008/10/13 Antonio Petrelli <[EMAIL PROTECTED]>

> 2008/10/13 Lance Java <[EMAIL PROTECTED]>:
> > Is it possible to use tiles2 with struts1?
>
> There are two ways:
> 1. Use Tiles 2 independently of Struts 1: this way you can use them
> both, but without real integration (such as forwarding to a Tiles
> definition).
> 2. Use (and probably fix) the Struts 1/Tiles 2 plugin:
> http://svn.apache.org/repos/asf/struts/struts1/trunk/tiles2/
>
> > I am about to move a struts 1 app to spring MVC + tiles2.
>
> This is another story, Spring 2.5 has an integration layer to Tiles 2:
>
> http://static.springframework.org/spring/docs/2.5.x/reference/view.html#view-tiles
>
> HTH
> Antonio
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: Using tiles 2 with struts 1

2008-10-13 Thread Lance Java
> Any reason for your optioning against Struts2.x?
Spring MVC is the new standard where I currently work and all sites are
moving in that direction. The support team and developers here have spring
MVC skills so it makes sense. If it was up to me I'd be moving to tapestry5
(http://tapestry.apache.org/tapestry5)

each to their own :)

2008/10/13 Martin Gainty <[EMAIL PROTECTED]>

>
> Good Morning Lance
>
> I would start here
>
> http://www.jajakarta.org/struts/struts1.2/documentation/ja/target/userGuide/struts-tiles.html
> Any reason for your optioning against Struts2.x?
>
> Martin
> __
> Disclaimer and confidentiality note
> Everything 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, 13 Oct 2008 15:59:42 +0100
> > From: [EMAIL PROTECTED]
> > To: user@struts.apache.org
> > Subject: Using tiles 2 with struts 1
> >
> > Is it possible to use tiles2 with struts1?
> > I am about to move a struts 1 app to spring MVC + tiles2. I was hoping
> that
> > spring MVC and struts 1 could live side by side in the interum period but
> > first I need to upgrade to struts1 + tiles2. I've looked through the
> struts1
> > website which seems out of date and haven't found any reference to tiles2
> > struts1 integration.
> >
> > Thanks in advance,
> > Lance.
>
> _
> See how Windows Mobile brings your life together—at home, work, or on the
> go.
> http://clk.atdmt.com/MRT/go/msnnkwxp1020093182mrt/direct/01/


Using tiles 2 with struts 1

2008-10-13 Thread Lance Java
Is it possible to use tiles2 with struts1?
I am about to move a struts 1 app to spring MVC + tiles2. I was hoping that
spring MVC and struts 1 could live side by side in the interum period but
first I need to upgrade to struts1 + tiles2. I've looked through the struts1
website which seems out of date and haven't found any reference to tiles2
struts1 integration.

Thanks in advance,
Lance.


Re: Multiple upload using Struts 1.0

2007-05-30 Thread Lance
You should be right if you implement the 4 indexed bean methods on your 
form.
@see 
http://java.sun.com/j2se/1.4.2/docs/api/java/beans/IndexedPropertyDescriptor.html#IndexedPropertyDescriptor(java.lang.String, 
java.lang.Class)


Here is an example if your property holding the files is called "files"

jsp:
 
 
 


form:
public class MyMultiFileForm {
   private List files = new ArrayList();

   // provide implementations for the following methods
   public List getFiles()
   public List setFiles()
   public FormFile getFiles(int index)
   public void setFiles(int index, FormFile file)
}

Vikash Manoranjan wrote:

Hi all,
 
We have very urgent requirement for multipe file upload option using Struts

1.0. The number of files to be uploaded will be decided at run-time. Kindly
help me. Its very urgent
 
waiting for reply...
 

Thanks and Regards, 


Vikash Manoranjan

Senior Software Engineer

Infotech Enterprises Limited 
B-37, Sector-1, 
Noida - 201301 
Uttar Pradesh, India 

 

  



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



Re: Best practice - Wizard flow

2007-05-24 Thread Lance
Why not draw all 3 pages but hide 2 of them and javascript the next page 
on and off.

All pages inside the same form, last page submits.

Charbel Abdul-Massih wrote:

I am developing a wizard type flow with 3 pages in the wizard...

 


We'll call them page 1, page 2, and page 3...

 


I need users to be able to navigate between pages with a next/previous
button, without losing any data that was entered in any of the pages.
The last submit from page 3 will store everything to the database.

 


What is the best way to model this in struts.xml...ie: how many action
mappings is recommended.  Do I have one action mapping for the view, and
one for each submit??? I would like to keep away from the session if
possible.

 


Any suggestions would be appreciated.

 


Thanks,

Charbel


  



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



Re: RE interceptor call

2007-05-24 Thread Lance

http://translate.google.com/translate_t?langpair=fr|en
Is just the usual disclaimer etc apart from the link

sudeepj2ee wrote:

HI

I could not understand the language pls can u communicate in english,

I have seen the link posted by you but the functionality what i want is
calling the interceptor from the action something like calling the
interceptor when certain exception occurs.

thanks  for replying
regards 
sudeep




meissa.sakho-2 wrote:
  

Depuis le 21 décembre 2006, Natexis Investor Servicing s'appelle Natixis
Investor Servicing. Les adresses mails des collaborateurs ayant changé,
veillez à la mise à jour de votre carnet d'adresses.


try this,
http://struts.apache.org/2.x/docs/writing-interceptors.html

L'integrite de ce message n'etant pas assuree sur internet, Natixis ne
peut etre tenu responsable de son contenu. Toute utilisation ou diffusion
non autorisee est interdite. Si vous n'etes pas destinataire de ce
message, merci de le detruire et d'avertir l'expediteur.
Ensemble, faisons un geste pour l'environnement : n'imprimons nos mails
que si necessaire

The integrity of this message cannot be guaranteed on the Internet.
Natixis can not therefore be considered responsible for the contents. Any
unauthorized use or dissemination is prohibited. If you are not the
intended recipient of this message, then please delete it and notify the
sender.






  



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



Re: JSP pre-compile question

2007-05-23 Thread Lance

It sounds like it's a non-struts issue to me.

Try putting the following in the jsp after you draw the form
<% response.getWriter().flush(); %>

If it comes thru quickly there's something after you write the form 
that's holding the page up.
You might need some println's with times or a debugger etc to see what's 
going on.


> it's as if the page is being streamed line by line, from top to bottom.
This depends on the app server but it could be byte by byte (via 
response.getOutputStream())


Charbel Abdul-Massih wrote:

Hi guys...Thanks for all your help so far, but to answer your
questions...

The slowness in rendering the page is very obvious...it's as if the page
is being streamed line by line, from top to bottom...

There are no images on the page...

The page consists of 5 form fields...

The request does not access any DB...

The HTML outputted is only 17KB...

I am running it locally on Weblogic 9.2 and Java 5...

I doubt it's a pre-compile issue now because the slowness and
streaming-like rendering is experienced on every request, not just the
first...

Any other ideas???

Thanks,
Charbel

 
-Original Message-
From: Lance [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 23, 2007 11:22 AM

To: Struts Users Mailing List
Subject: Re: JSP pre-compile question

This might also be because you are not specifying heights (and widths) 
for images.
If you have any other static widths & heights (menu area, header area 
etc) you should specify them too.


Lance.

Al Sutton wrote:
  

P.S.  If you're considering pre-compiling, the only thing you'll loose


is
  

the lag for the first time the page is displayed, every time after the


first
  

time you view a page almost all servlet engines will use the version


which
  

was compiled for the first page request.

-Original Message-
From: Al Sutton [mailto:[EMAIL PROTECTED] 
Sent: 23 May 2007 16:06

To: 'Struts Users Mailing List'
Subject: RE: JSP pre-compile question

The short answer is no because this is how the browser receives the


data
  

about the page, and pretty much all browsers display the data as soon


as
  

they can after get it.

There are things you can do to reduce the visibility of this to the


user
  

(smaller tables and div areas, smaller pages, etc.), but there isn't
anything you can do about how the browser receives the data and


chooses to
  

render it.

-Original Message-
From: Charbel Abdul-Massih [mailto:[EMAIL PROTECTED]
Sent: 23 May 2007 15:59
To: user@struts.apache.org
Subject: JSP pre-compile question

Hi,

I am evaluating Struts 2.0, and I'm using tiles pluging with it...

 


When my pages render in the browser, they seem to render top down,


with a
  

slight delay in rendering...meaning the top of the page renders first,


then
  

the rest of the page renders gradually, until you see the full


page...Is
  

there a way to change this and have it render without the delay???

 


Thanks,
Charbel



-
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: JSP pre-compile question

2007-05-23 Thread Lance
This might also be because you are not specifying heights (and widths) 
for images.
If you have any other static widths & heights (menu area, header area 
etc) you should specify them too.


Lance.

Al Sutton wrote:

P.S.  If you're considering pre-compiling, the only thing you'll loose is
the lag for the first time the page is displayed, every time after the first
time you view a page almost all servlet engines will use the version which
was compiled for the first page request.

-Original Message-
From: Al Sutton [mailto:[EMAIL PROTECTED] 
Sent: 23 May 2007 16:06

To: 'Struts Users Mailing List'
Subject: RE: JSP pre-compile question

The short answer is no because this is how the browser receives the data
about the page, and pretty much all browsers display the data as soon as
they can after get it.

There are things you can do to reduce the visibility of this to the user
(smaller tables and div areas, smaller pages, etc.), but there isn't
anything you can do about how the browser receives the data and chooses to
render it.

-Original Message-
From: Charbel Abdul-Massih [mailto:[EMAIL PROTECTED]
Sent: 23 May 2007 15:59
To: user@struts.apache.org
Subject: JSP pre-compile question

Hi,

I am evaluating Struts 2.0, and I'm using tiles pluging with it...

 


When my pages render in the browser, they seem to render top down, with a
slight delay in rendering...meaning the top of the page renders first, then
the rest of the page renders gradually, until you see the full page...Is
there a way to change this and have it render without the delay???

 


Thanks,
Charbel



-
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] field-validator regex ignoring given message

2007-05-23 Thread Lance

Ah... pls ignore

Paolo Beccari wrote:





[0-9]*(\.[0-9]+)?


Hi Lance, as already established (see previous posts), it is not a 
matter of regular expressions.

The matter is: the variable in the Action is a Long (and MUST be a Long).
The regex validation does not work, if the variable is not a String.
I'm searching a way to validate (through Action-validation.xml) a 
field that must be numeric, and that is defined as a Long in the 
action corresponding to the Form. According to this, field-validator 
type="int" is inadequate, and I was not able to found a number (or 
Long?) validation.


P.



-
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] field-validator regex ignoring given message

2007-05-23 Thread Lance

[0-9]*(\.[0-9]+)?


Paolo Beccari wrote:



--- Paolo Beccari <[EMAIL PROTECTED]> wrote:

  
   [0-9]
   





--- "Dave Newton" <[EMAIL PROTECTED]> wrote:
If it's defined as a Long in your action then you
might not be able to run a regex on it--I would
imagine type conversion has already happened.

d.



Thank for the reply, Dave. I switched to regex because I wanted to 
validate a field to be a number, but in the docs I found only 
type="int" validation while I need a wider range. So how to validate a 
Long value? I'm pretty sure it's possible...


Thanks again.
P.



-
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: How can I access an attribute of session using JSP tags?

2007-05-22 Thread Lance
I am saying the standard struts tags do check session scope if 
scope="session" or no scope is provided, so it's probably a bug in your 
code.


Nuwan Chandrasoma wrote:

Hi,

I would go for JSTL tags, but i dont really get what you trying to say!

Thanks,

Nuwan

- Original Message - From: "hk" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, May 22, 2007 4:37 PM
Subject: How can I access an attribute of session using JSP tags?




I tried to check and output an attribute of session in a jSP page, 
which I

had set in an action by using logic:present and bean:out tagas, but I
coulnd't. It seems like those are not a right tag.


--
View this message in context: 
http://www.nabble.com/How-can-I-access-an-attribute-of-session-using-JSP-tags--tf3797537.html#a10741921 


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]



Re: How can I access an attribute of session using JSP tags?

2007-05-22 Thread Lance
It should be ok, if you leave the scope attribute empty, all scopes will 
be checked.

If scope="session" the tags will only check session scope.

Can I also suggest checking jstl which may make things (esp logic) a lot 
easier

http://jadecove.com/downloads/jstl-quick-reference.pdf

hk wrote:

I tried to check and output an attribute of session in a jSP page, which I
had set in an action by using logic:present and bean:out tagas, but I
coulnd't. It seems like those are not a right tag.


  



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



Re: [s2] Best method of passing ActionErrors through a redirect

2007-05-22 Thread Lance

You could forward rather than redirect.
Another option is to use "flash scope" which has been discussed on this 
list previously. My understanding of this is that a filter manages a map 
on the session and requests have access to attributes added by the 
previous request.


I have never implemented the latter but it sounds kinda cool.

Raghupathy, Gurumoorthy wrote:
Redirect looses all data .. this is how it is to work  
One thing you can do is store it as a session attribute :) ... not the
best way but one of the way 



Regards
Guru

-Original Message-
From: Al Sutton [mailto:[EMAIL PROTECTED] 
Sent: 22 May 2007 17:22

To: 'Struts Users Mailing List'
Subject: [s2] Best method of passing ActionErrors through a redirect

Simple question; 
 
Is there any way to retain messages added with addActionError or

addActionMessage during a redirect?
 
 
 
More complex explanation of my setup;
 
ActionA gets data and has uses a jsp to display the data (using
my_jsp.jsp). 
my_jsp.jsp has a comment field which submits data to ActionB

ActionB processes the comment and then should send the user to ActionA
which
gets the data with the new comment and re-displays the jsp.
 
To go from ActionB to ActionA I use a redirect, but the redirect seems

to
cause anything added with addActionError or addActionMessage to get
dropped
and so the jsp doesn't display them.
 
 
Any suggestions on what to do?


-
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: Struts2 DWR parameter issue

2007-05-22 Thread Lance

You could use jsp tags to create a hidden template row.
Client side you can clone the template row using dwr.util.cloneNode() 
then tweak the appropriate bits.


newtostruts struts wrote:

I'm trying to use DWR with Struts2. The problem is when I'm trying to build the row of a table 
with a  link to an action class, I'm not able to send any params in 
that link.
   
  eg:   var getUname = function( user ) { return '' + user.uname + '' }; 
   
  This is what I'm trying to do but getting errors and not able to retrieve param value in the action class. Since this is done in javascript functions, I can't use any struts tags.
   
  Any suggestions please...
   
  Vinod



   
-
Ready for the edge of your seat? Check out tonight's top picks on Yahoo! TV. 
  



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



Re: OOM Error (Java heap space) from 1800+ form elements, am I doing something wrong?

2007-05-22 Thread Lance
Firstly, I hope you are only using "request" scope for these forms. 
Session scope would kill your application.
Have you tried experimenting with the JVM options? 
(http://blogs.sun.com/watt/resource/jvm-options-list.html)
In particular -Xms (initial Java heap size) and -Xmx (maximum Java heap 
size)

If using jboss, you will need to edit run.bat (PC) or run.conf (unix)

eg
set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx512m

Forsberg, Mike wrote:

A form of approximately 1800 form elements is causing
"java.lang.OutOfMemoryError: Java heap space".  When 1000 form elements
are used, no such error.

The environment:
- JBoss 4.0.5
- Struts 1.1
- A jsp page using struts  tags to start and end the form
block.  Then insidethe form, xslt is used to parse a 300 element xml
document into 6 input tags per element.

What seems to be happening, the reset method for the form bean is
called. Then before any set methods are called, the OOME is thrown.

Should I throw out (REALLY DON'T WANT TO) the xslt and use nested form
beans properties?

Any help would be appreciated.


Mike Forsberg
Software Engineer II
APM - APC
T 512.602.0220




-
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: Status of Tiles without Struts

2007-05-18 Thread Lance

I have used sitemesh in the past http://www.opensymphony.com/sitemesh/
This is a filter that intercepts the html on the way out, parses it then 
decorates it with a header, menu etc. etc.


lightbulb432 wrote:

Great, thanks!

Out of curiosity, what are the alternatives to Tiles for JSP templating? 


Assuming I'd like to use JSP for the view, what ways of making a
maintainable website are there? Of course I could use the JSP include action
and directive, but that wouldn't be maintainable (or would it in practice -
what's your experience?)

What alternatives are there, and how do they compare to Tiles?

Thanks.



Antonio Petrelli-3 wrote:
  

2007/5/18, lightbulb432 <[EMAIL PROTECTED]>:


Could somebody who's in the know here explain what the status of this
project is, and how I can get it up and running in a simple way?
  


Me! Me! :-)

http://tiles.apache.org/

Antonio





  



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



Re: Populate two fields with one value

2007-05-18 Thread Lance

Do you have the approptriate getters and setters?
eg
action.getAcc().setFirstName()
action.getAcc().setLastName()


Mansour wrote:

I tried it. It's not working either.


Guillaume Carré wrote:

2007/5/18, Mansour <[EMAIL PROTECTED]>:

how to populate 2 fields in my action with one value ?
for example I need to populate the first name and last name with one
value for searching:


try this:


 Search Account 

id="fn" />








-
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: session is not destroyed

2007-05-15 Thread Lance
HttpSession.invalidate() will remove all attributes from the session and 
consequent calls to getAttribute() on an invalidated session will cause 
an IllegalStateException.
It could be that an attribute with the same name is in another scope 
(page, request or application) and is being picked up by 
pageContext.findAttribute() somewhere.


Can you send through some code?

jalal udeen wrote:

hi

 im adding some object to list and  the list is added to
session finally i invalidate session but the values of list is again 
still

there session is not destroyed what to do fo this pls

thanks
jalal




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



Re: url, fill collection

2007-05-15 Thread Lance
java.util.Set does not guarantee that the order of it's elements remain 
constant and does not provide set(int,Object) or get(int) methods.
Use a List or an array in the web tier and perhaps convert to a set in 
validation / middle tier.


Cheers,
Lance.

Jaan Tark wrote:

continues 

so i can make it all work with vectors ... but not sets

so if my action class has:
private Vector asd;

then, via browser url ... i can set it like:
?asd.name=smth

but, if i'm using a Set instead the Vector
?asd.name=smth

i'm getting "ERRROR ... ParametersIterceptor ... [setParameters]: 
Unexpected Exception catched: Error setting expression


if testing with Vector and Set ... everything works

am I in somekind of syntax trouble? ...


rgds

-
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: url, fill collection

2007-05-15 Thread Lance

You could use a lazy list and a factory to create your empty person objects.
private List persons = 
org.apache.commons.collections.list.LazyList.decorate(new Vector(), new 
InstantiateFactory(Person.class));


Cheers,
Lance.

Jaan Tark wrote:

problem solved, ignore

gonna write the problem description and solution as soon as i have 
some extra time



rgds

On 15.05.2007 13:51, Jaan Tark wrote:

Hello,

i have a class

public class Person {
   private String name;
   // gettter, setter
}

contained in

public class Master extends ActionSupport {
 private Vector persons;

   //getters, setters
 publis String execute() {
   return SUCCESS;
   }

}

i can retrieve persons in jsp like this:

   



how to i fill the vector via URL (GET)?
(e.g. "?persons.name=test)

if the vector contains primitive types - int, string ... , i''m able 
to fill it ... but having trouble with vector (collections) that 
contain smth like shown


rgds




-
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: hashmap

2007-05-09 Thread Lance
Hi, I'm making the assumption that you are using struts1 and you want to 
access the map in a struts tag.
I couldn't find a way of accessing properties mapped by anything else 
but a string


Therefore, try
hashMap.put(String.valueOf(questionId), new 
Integer(testDAO.getMarks(catid, typeid, patternid)));


In your jsp you can get it by


@see http://struts.apache.org/1.x/struts-taglib/indexedprops.html

Cheers,
Lance.

jalal udeen wrote:

hi all


  how to retrieve values from the  HashMap
  i have set  it as



*hashMap*.put(*new* 
Integer(questionId),*new*Integer(

testDAO.getMarks(catid, typeid, patternid)));

how to  getthese values again



thanks

jalaludeen




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



Re: AW: Good JScript lib for disabling browser toolbars and good integration with Struts?

2007-05-04 Thread Lance

This should do what your after
   window.toolbar.visible = false;
   window.menubar.visible = false;

Check out http://developer.mozilla.org/en/docs/DOM:window for more info.

Peter Neu wrote:

Hello,

I'm using Struts 1.x. Do you know how to disable the toolbars with dojo? Is
there a tutorial? I couldn't find anything on their website. 


Cheers,
Pete

  

-Ursprüngliche Nachricht-
Von: news [mailto:[EMAIL PROTECTED] Im Auftrag von Laurie Harper
Gesendet: Donnerstag, 3. Mai 2007 22:48
An: user@struts.apache.org
Betreff: Re: Good JScript lib for disabling browser toolbars and good
integration with Struts?

Peter Neu wrote:


does somebody know a good Java Script library which disables browser
  

tool- &


navigations bars and right mouse clicks for browser windows? I need a
browser window for my app stripped of all basic browser components.

Best way would be if Struts could already load the java script before
  

the


user sees the first page.
  

You don't mention which Struts version you're using. Struts 2 provides
some integration with Dojo (through the 'ajax' theme) which can probably
do what you need as well as any library.

If you're not using S2, or want to use a different library, you should
be able to do so equally as easily in Struts as any other web app
environment; just include the appropriate 

Re: Jsp out to Persist

2007-05-01 Thread Lance
Ah... this is simpler then, I thought you were recording pages as users 
were viewing them.

Do you need to be logged in to view the page?

If yes, check out commons-httpclient, which will maintin cookies for you
You will neeed to post to the login page then navigate to the page you 
want and save the inputStream() for the page

http://jakarta.apache.org/commons/httpclient/tutorial.html

If no, you can simple use a java.net.URL and openStream() to get a 
stream to the html (genereated by jsp).

http://java.sun.com/j2se/1.4.2/docs/api/java/net/URL.html

nagesh.kumar wrote:

Thanks a lot buddy,

I need to send a mail by using the same html generated by jsp  
 just like your idea [save the file to the server]


How can I implement this do u have any example where I can refer.

Thanks & Regards
Nagesh Reddy.

-Original Message-
From: Lance [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 01, 2007 4:52 PM

To: Struts Users Mailing List
Subject: Re: Jsp out to Persist

Are you saving the file to the client or to the server?

If you want the client to save the file, you can set the content disposition
header... this will cause a file download dialog to appear
response.setHeader("content-disposition", "attachment;
filename=someFileName.html");

If you want to save the file to the server, you could use a
javax.servlet.Filter which is mapped to the uri(s) that you want to keep a
record of.
You could wrap the resppnse in a custom ResponseWrapper The response wrapper
overrides getOutputStream() and getWriter() so that they return objects that
write to the file system and the wrapped response.

Cheers,
Lance,

nagesh.kumar wrote:
  

Hi All,

I have a scenario like I need to persist or get stream of generated 
output JSP OUT PUT [HTML]


I have  flow like ACTION  >  JSP >  gives HTML out oput to browser

Now I need to persist this generated html from jsp to some file.

How can I close this

Please give me a solution

Or

How can I call this action > jsp with out HTTP also.

Thanks & Regards
Nagesh Reddy



DISCLAIMER:
The information in this e-mail is the property of InterGlobe and is 
confidential and privileged. It is intended solely for the addressee. 
Access to this email by anyone else is unauthorized. If you are not 
the intended recipient, any disclosure, copying, distribution or any 
action taken in reliance on it is prohibited and will be unlawful. If 
you receive this message in error, please notify the sender 
immediately and delete all copies of this message




-
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]


DISCLAIMER:
The information in this e-mail is the property of InterGlobe and is 
confidential and privileged. It is intended solely for the addressee. Access to 
this email by anyone else is unauthorized. If you are not the intended 
recipient, any disclosure, copying, distribution or any action taken in 
reliance on it is prohibited and will be unlawful. If you receive this message 
in error, please notify the sender immediately and delete all copies of this 
message



-
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: Jsp out to Persist

2007-05-01 Thread Lance

Are you saving the file to the client or to the server?

If you want the client to save the file, you can set the content 
disposition header... this will cause a file download dialog to appear
   response.setHeader("content-disposition", "attachment; 
filename=someFileName.html");


If you want to save the file to the server, you could use a 
javax.servlet.Filter which is mapped to the uri(s) that you want to keep 
a record of.

You could wrap the resppnse in a custom ResponseWrapper
The response wrapper overrides getOutputStream() and getWriter() so that 
they return objects that write to the file system and the wrapped response.


Cheers,
Lance,

nagesh.kumar wrote:

Hi All,

I have a scenario like I need to persist or get stream of generated output
JSP OUT PUT [HTML]

I have  flow like ACTION  >  JSP >  gives HTML out oput to browser

Now I need to persist this generated html from jsp to some file.

How can I close this 


Please give me a solution

Or 


How can I call this action > jsp with out HTTP also.

Thanks & Regards
Nagesh Reddy



DISCLAIMER:
The information in this e-mail is the property of InterGlobe and is 
confidential and privileged. It is intended solely for the addressee. Access to 
this email by anyone else is unauthorized. If you are not the intended 
recipient, any disclosure, copying, distribution or any action taken in 
reliance on it is prohibited and will be unlawful. If you receive this message 
in error, please notify the sender immediately and delete all copies of this 
message



-
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: ClassCast Exception for ExcelFile Upload

2007-04-30 Thread Lance
If you need a fileInputStream... all I can suggest is that you read from 
formFile.getInputStream() into a file

Get a fileInputStream to the file
Call RcsaPOIEventListner.readExcelStream(fin);
Delete the file
I'd be surprised if you couldn't use 
RcsaPOIEventListner.readExcelStream(formFile.getInputStream());


Gotta go, good luck

Martin Gainty wrote:

Lance
saw this on nabble..

ExcelFileUploadForm excelForm = (ExcelFileUploadForm) form;
FormFile formFile = excelForm.getExcelFile();
InputStream in = (InputStream) formFile.getInputStream();
FileInputStream fin = new (FileInputStream( in ) );

Does this help?
M--
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please 
notify

the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

- Original Message ----- From: "Lance" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" 
Sent: Monday, April 30, 2007 9:21 AM
Subject: Re: ClassCast Exception for ExcelFile Upload


I think this is your problem... FileInputStream fin = 
(FileInputStream) in;

Do you need to do this?
Can you do RcsaPOIEventListner.readExcelStream(in);

The input stream is coming from the request which is not necessarily 
saved to disk / read from a FileInputStream.


Kirthi wrote:

I am having problems with the FileUpload in struts.

I am uploading an Excel File through browser and sending to Struts 
Action

Class, handling it with FormFile. I am casting this FormFile to
FileInputStream which is working fine.

But when I am deleting some of the rows in that excel file and 
uploading it
again its giving me a ClassCastException when converting the Form 
File to

FileInputStream.

I have no idea y its happening like this. Can any one help me with 
this?


Thanks

Here is the error I am getting

root cause
java.lang.ClassCastException
at rcsa.struts.ExcelFileUpload.execute(ExcelFileUpload.java:48)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419) 


at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224) 

at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at 
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:716)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:198) 


at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144) 


at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209) 


at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:595) 


at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:432) 



** 



Here is the code

import java.io.*;

import javax.servlet.ServletException;
import javax.servlet.http.*;

import org.apache.struts.upload.FormFile;
import org.apache.struts.action.*;

import rcsa.poi.RcsaPOIEventListner;
import rcsa.exceptions.RcsaException;
import rcsa.dao.OpRiskSSheet;
import rcsa.misc.ErrorHandler;

public class ExcelFileUpload extends Action {

// - Instance
Variables
String target;

// - Methods

/** * Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws IOException, ServletException,
RcsaException{

ActionMessages errors = new ActionMessages();
if(form != null){
ExcelFileUploadForm excelForm = (ExcelFileUploadForm) form;
FormFile formFile = excelForm.getExcelFile();
InputStream in = (InputStream) formFile.getInputStream();
FileInputStream fin = (FileInputStream) in; errors.clear();
RcsaPOIEventListner.readExcelStream(fin);
//errors = new ErrorHandler(opSheet, errors).checkErrors();
if(errors.isEmpty()){
target = "success";
}else{
target = "failure"; }
}else{
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("UNABLE 
TO LOCATE THE EXCEL FILE", false));

target = "failure";
}
saveErrors(request, errors);
return mapping.findForward(target);

}

}


**

import org.apache.struts.validator.ValidatorForm;
import org.apache.struts.upload.FormFile;

/**
[EMAIL PROTECTED]
*
*/

/**
*Form bean for File Upload.
*
*/
public class ExcelFileUploadForm extends ValidatorForm{

private FormFile excelFile;

/**
*

Re: Dynamic back button

2007-04-30 Thread Lance

There are a couple of tricks
1. The referring page can be found in request.getHeader("referer")... 
the referring page's request parameters can not be found though so this 
will probably not work.


2. You can implement a javax.servlet.Filter
This pushes and pops pages (and their parameters) to a stack.
Pop occurs when back is clicked
When the user chooses an option from the main menu, you clear the stack
Back button (tag??) uses stack.peek(1) to get the prev page and it's 
parameters.


David Harland wrote:

Hi,

I have a page that can be reached from various other pages. On this page is a 
button that will send them back to the page they came from via the action for 
that page. Is there a clever way of doing this with struts 2 other than putting 
a hidden variable in the page to check.

Thanks

Dave.



__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.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]



Re: ClassCast Exception for ExcelFile Upload

2007-04-30 Thread Lance
I think this is your problem... 
	FileInputStream fin = (FileInputStream) in;	


Do you need to do this?
Can you do RcsaPOIEventListner.readExcelStream(in);

The input stream is coming from the request which is not necessarily saved to 
disk / read from a FileInputStream.

Kirthi wrote:

I am having problems with the FileUpload in struts.

I am uploading an Excel File through browser and sending to Struts Action
Class, handling it with FormFile. I am casting this FormFile to
FileInputStream which is working fine.

But when I am deleting some of the rows in that excel file and uploading it
again its giving me a ClassCastException when converting the Form File to
FileInputStream.

I have no idea y its happening like this. Can any one help me with this?

Thanks

Here is the error I am getting

root cause 


java.lang.ClassCastException
at rcsa.struts.ExcelFileUpload.execute(ExcelFileUpload.java:48)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:716)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:198)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:595)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:432)

**

Here is the code

import java.io.*;

import javax.servlet.ServletException;
import javax.servlet.http.*;

import org.apache.struts.upload.FormFile;
import org.apache.struts.action.*;

import rcsa.poi.RcsaPOIEventListner;
import rcsa.exceptions.RcsaException;
import rcsa.dao.OpRiskSSheet;
import rcsa.misc.ErrorHandler;

public class ExcelFileUpload extends Action {

//   - Instance
Variables
String target;

// - Methods

	/** 
	 * Method execute

 * @param mapping
 * @param form
 * @param request
 * @param response
 * @return ActionForward
 */
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws IOException, 
ServletException,
RcsaException{

ActionMessages errors = new ActionMessages();
if(form != null){
ExcelFileUploadForm excelForm = (ExcelFileUploadForm) 
form;
FormFile formFile = excelForm.getExcelFile();
InputStream in = (InputStream) 
formFile.getInputStream();
FileInputStream fin = (FileInputStream) in; 
errors.clear();
RcsaPOIEventListner.readExcelStream(fin);
//errors = new ErrorHandler(opSheet, 
errors).checkErrors();
if(errors.isEmpty()){
target = "success";
}else{
target = "failure";   
}
}else{
			errors.add(ActionMessages.GLOBAL_MESSAGE, 
	new ActionMessage("UNABLE TO LOCATE THE EXCEL FILE", false));

target = "failure";
}
saveErrors(request, errors);
return mapping.findForward(target);

}

}


**

import org.apache.struts.validator.ValidatorForm;
import org.apache.struts.upload.FormFile;

/**
 [EMAIL PROTECTED]
 *
 */

/**
 *Form bean for File Upload.
 *
 */
public class ExcelFileUploadForm extends ValidatorForm{

private FormFile excelFile;

/**
 * @return Returns the theFile.
	 */	 
	 public FormFile getExcelFile() {

return excelFile;
  }
	 
	 /**

  * @param theFile The FormFile to set.
  */
  public void setExcelFile(FormFile excelFile) {
this.excelFile = excelFile;
  }
	  
}



  



-
To unsubscribe, e-mail:

Re: struts Multipart

2007-04-26 Thread Lance

Sounds like a classpath issue to me.
Try searching your webapp for multiple struts.jar or 
commons-fileupload.jar. Are they both in the same dir? (WEB-INF/lib 
probably)


Michel Van Asten wrote:

Hi,

I got a strange problem...

I got this error message When I try to do an upload in my application
any idea ?

javax.servlet.ServletException: Cannot find multipart class
"org.apache.struts.upload.CommonsMultipartRequestHandler", exception:
org.apache.struts.upload.CommonsMultipartRequestHandler
at
org.apache.struts.util.RequestUtils.getMultipartHandler(RequestUtils.jav
a:573)
at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:433)



Michel Van Asten


-
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: Response already committed

2007-04-26 Thread Lance

I just re-read your email... pls ignore my last reply.
My s2 knowlege is very minimal but chances are that an ajax action is 
triggered by an XmlHttpRequest. In this case, you don't want to redirect 
this request. What you want to do is send something (javascript) back  
to the calling page telling it to redirect itself. I'm sure one of the 
s2 users out there have some suggestions here.


Lance.

Lance wrote:

It sounds like you are still redirecting after the repsponse is comitted.
If you attempt to do this on tomcat, an error will be reported then 
instead of redirecting, the redirect page will be included at the end 
of the current page.


Gajbhe, Laxman (Contractor) wrote:

Lance,

 Thanks for your help! I am now able to redirect the page except on
timeout it still opens right under the clicked tab instead of as a full
login page.

 It seems even the redirected page gets displayed as an ajax content if
the original request was triggered by the ajax action.

 Can you think any way to handle this?


Thanks again!

Laxman


This e-mail and its attachments are confidential and solely for the
intended addressee(s). Do not share or use them without Fannie Mae's
approval. If received in error, contact the sender and delete them.


-Original Message-----
From: Lance [mailto:[EMAIL PROTECTED] Sent: Wednesday, 
April 25, 2007 3:47 AM

To: Struts Users Mailing List
Subject: Re: Response already committed

The response is considered committed once you have written to the 
outputstream (perhaps in a jsp).

Once a response has been comitted, you can not redirect or forward etc.

The best solution is to redirect before you write anything to the output

stream, sometimes this is not possible.
Another slightly dodgy solution (I have used this) is to write a 
script tag to the outputstream.



document.location.href = 'loginPage.do';


You can check if the response has been comitted using
response.isComitted()
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletRespo
nse.html

Gajbhe, Laxman (Contractor) wrote:
 

Hi,
 
 I've following global result to handle authentication.





login

/home

input



...



For most part this works fine. The only problem with this is that on
session timeout, it opens up the login page nested inside the page


being
 

requested.

For example if there are tabs on the page and if the user clicks on


one
 

of the tab when the session is timed out, it opens the login page as a
content of the current tab.

So, I figured changing result type to 'redirect-action' should fix it.
Now it started complaing about "response already commited" when I am
logging in first time itself.

Here is the snippets of my interceptor code:

public String intercept(final ActionInvocation invocation) throws
Exception {

final SessionMap session = (SessionMap)
ActionContext.getContext().get(ActionContext.SESSION);

final SessionSecureUser user = (SessionSecureUser)
session.get(Constants.AUTHORIZED_KEY);

if (user == null) {

return Action.LOGIN;

}

Could you please suggest where I could be going wrong with this?

thanks for your help!

Laxman

 

 


This e-mail and its attachments are confidential and solely for the
intended addressee(s). Do not share or use them without Fannie Mae's
approval. If received in error, contact the sender and delete them.

 

  



-
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: Response already committed

2007-04-26 Thread Lance

It sounds like you are still redirecting after the repsponse is comitted.
If you attempt to do this on tomcat, an error will be reported then 
instead of redirecting, the redirect page will be included at the end of 
the current page.


Gajbhe, Laxman (Contractor) wrote:

Lance,

 Thanks for your help! I am now able to redirect the page except on
timeout it still opens right under the clicked tab instead of as a full
login page.

 It seems even the redirected page gets displayed as an ajax content if
the original request was triggered by the ajax action.

 Can you think any way to handle this?


Thanks again!

Laxman


This e-mail and its attachments are confidential and solely for the
intended addressee(s). Do not share or use them without Fannie Mae's
approval. If received in error, contact the sender and delete them.


-Original Message-
From: Lance [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 25, 2007 3:47 AM

To: Struts Users Mailing List
Subject: Re: Response already committed

The response is considered committed once you have written to the 
outputstream (perhaps in a jsp).

Once a response has been comitted, you can not redirect or forward etc.

The best solution is to redirect before you write anything to the output

stream, sometimes this is not possible.
Another slightly dodgy solution (I have used this) is to write a script 
tag to the outputstream.



document.location.href = 'loginPage.do';


You can check if the response has been comitted using
response.isComitted()
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletRespo
nse.html 



Gajbhe, Laxman (Contractor) wrote:
  

Hi,
 
 I've following global result to handle authentication.


 




login

/home

input



...



For most part this works fine. The only problem with this is that on
session timeout, it opens up the login page nested inside the page


being
  

requested.

For example if there are tabs on the page and if the user clicks on


one
  

of the tab when the session is timed out, it opens the login page as a
content of the current tab.

So, I figured changing result type to 'redirect-action' should fix it.
Now it started complaing about "response already commited" when I am
logging in first time itself.

Here is the snippets of my interceptor code:

public String intercept(final ActionInvocation invocation) throws
Exception {

final SessionMap session = (SessionMap)
ActionContext.getContext().get(ActionContext.SESSION);

final SessionSecureUser user = (SessionSecureUser)
session.get(Constants.AUTHORIZED_KEY);

if (user == null) {

return Action.LOGIN;

}

Could you please suggest where I could be going wrong with this?

thanks for your help!

Laxman

 

 


This e-mail and its attachments are confidential and solely for the
intended addressee(s). Do not share or use them without Fannie Mae's
approval. If received in error, contact the sender and delete them.

 

  




-
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: compile error

2007-04-25 Thread Lance
I highly recommend using ant to manage your project including clean, 
compile, deploy, javadoc, etc. etc.


http://supportweb.cs.bham.ac.uk/docs/tutorials/docsystem/build/tutorials/ant/ant.html
http://ant.apache.org/

srikanth_arr wrote:

i am new to struts when i compiling the my first struts app
iam getting a error

D:\Program Files\Apache Software Foundation\Tomcat
5.5\webapps\FirstApp>javac *.
java -d ..\web-inf\classes
UserRegistrationAction.java:8: error while writing
strutsEx.UserRegistrationActi
on: ..\web-inf\classes\strutsEx\UserRegistrationAction.class (The system
cannot
find the path specified)
public class UserRegistrationAction extends Action
^
Note: UserRegistrationForm.java uses or overrides a deprecated API.
Note: Recompile with -Xlint  eprecation for details.
1 error
  



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



Re: Reset struts form values: Struts 1.3

2007-04-25 Thread Lance

true

Mike Baroukh wrote:

> You could use a reset button
> 

It don't always work because it reset to the values that were 
populated on page load.
The case it don't work is when you make a change on a form, post it 
and there was errors. The form is loaded again with the wrong values 
you previously typed and an error message. If you push a "reset 
button", it will reset to the wrong values ...

The only way is to use an action for this.

Mike

Lance a écrit :

You could use a reset button


Chaudhary, Harsh wrote:

Yea, that's what I was thinking too. I was just wondering if Struts (or
some other API) has a built-in caching mechanism. Thanks though,
Harsh.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Paul Benedict
Sent: Tuesday, April 24, 2007 4:55 PM
To: Struts Users Mailing List
Subject: Re: Reset struts form values: Struts 1.3


Chaudhary, Harsh <[EMAIL PROTECTED]> wrote:
 

Hi,

I am using Struts 1.3. We have several struts forms which are
pre-populated from a database.

My questions is, if I want to provide the user with a way to reset the
form to the initial values which were populated from the database.





It sounds like you will be providing a button for this choice. If so,
then
wire it up to a Struts action which will get the values from the
database.
Or if those values are cached in application scope, just retrieve those
again.

Paul

-
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: Response already committed

2007-04-25 Thread Lance
The response is considered committed once you have written to the 
outputstream (perhaps in a jsp).

Once a response has been comitted, you can not redirect or forward etc.

The best solution is to redirect before you write anything to the output 
stream, sometimes this is not possible.
Another slightly dodgy solution (I have used this) is to write a script 
tag to the outputstream.



   document.location.href = 'loginPage.do';


You can check if the response has been comitted using response.isComitted()
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletResponse.html 



Gajbhe, Laxman (Contractor) wrote:

Hi,
 
 I've following global result to handle authentication.


 




login

/home

input



...



For most part this works fine. The only problem with this is that on
session timeout, it opens up the login page nested inside the page being
requested.

For example if there are tabs on the page and if the user clicks on one
of the tab when the session is timed out, it opens the login page as a
content of the current tab.

So, I figured changing result type to 'redirect-action' should fix it.
Now it started complaing about "response already commited" when I am
logging in first time itself.

Here is the snippets of my interceptor code:

public String intercept(final ActionInvocation invocation) throws
Exception {

final SessionMap session = (SessionMap)
ActionContext.getContext().get(ActionContext.SESSION);

final SessionSecureUser user = (SessionSecureUser)
session.get(Constants.AUTHORIZED_KEY);

if (user == null) {

return Action.LOGIN;

}

Could you please suggest where I could be going wrong with this?

thanks for your help!

Laxman

 

 


This e-mail and its attachments are confidential and solely for the
intended addressee(s). Do not share or use them without Fannie Mae's
approval. If received in error, contact the sender and delete them.

 

  



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



Re: Reset struts form values: Struts 1.3

2007-04-25 Thread Lance

You could use a reset button


Chaudhary, Harsh wrote:

Yea, that's what I was thinking too. I was just wondering if Struts (or
some other API) has a built-in caching mechanism. Thanks though,
Harsh.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Paul Benedict
Sent: Tuesday, April 24, 2007 4:55 PM
To: Struts Users Mailing List
Subject: Re: Reset struts form values: Struts 1.3


Chaudhary, Harsh <[EMAIL PROTECTED]> wrote:
  

Hi,

I am using Struts 1.3. We have several struts forms which are
pre-populated from a database.

My questions is, if I want to provide the user with a way to reset the
form to the initial values which were populated from the database.





It sounds like you will be providing a button for this choice. If so,
then
wire it up to a Struts action which will get the values from the
database.
Or if those values are cached in application scope, just retrieve those
again.

Paul

-
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: Somewhat OT: Forward to JSP in JAR file

2007-04-25 Thread Lance
I was doing this sort of dodgy thing at one stage, dynamically writing 
jsp's to the filesystem


To get the real path of the webroot you can use the following code:
String webroot = pageContext.getServletContext().getRealPath("/");
if (!webroot.endsWith("/")) {
  webroot += '/';
}

From memory this worked on jboss on windows but I think I came across 
problems when testing on weblogic or websphere (can't remember) on unix.
I was not allowed to write to the filesystem, i didn't resolve the issue 
which could have been down to file permissions, I ended up abandoning 
what I was doing.


Richard Wallace wrote:

Do you have anything on the forwarding to a JSP in a JAR file that you
can tell us about?  I'm running into the same situation where I work
and can't figure out a solution.  I had thought that maybe if I
forwarded to something like /struts/jsps/test.jsp and add the package
that jsps are contained in to the filter I could access it that way.
That sort of works.  What I wind up getting is the unparsed JSP.  So,
I was thinking that I could instead extract the JSP I'm trying to get
to the filesystem and forward to that, but that seems messy.

Did you find a good way to accomplish this?

Thanks,
Rich

Musachy Barroso wrote:
  

I'm working on an Struts plugin to try to work around (more like
hack around)  that and other fun stuff :)

musachy

On 4/10/07, Laurie Harper <[EMAIL PROTECTED]> wrote:


Frank W. Zammetti wrote:
  

Quick question... can anyone tell me if it's possible to
forward


to a
  

JSP that is stored in a JAR file (i.e., in a JAR located in
WEB-INF/lib), and if so, how?  I couldn't find a quick answer
on the first few pages of Googling, figured someone here would
probably


know
  

off the top of their heads.  Thanks!


Not in any standard way, no. There may be container-specific
solutions, but you'd be working outside the spec.

L.


-
 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: Disable datetimepicker

2007-04-24 Thread Lance
I'm not a struts2 user (unfortunately) but this seems bad to me. From 
what I see of the s2 tags, they abstract you from the fact that dojo is 
being used under the hood.
Should struts2 have it's own core js that proxies through to the dojo 
implementation?


Scott Nesbitt wrote:

Works great!

Thanks, Musachy.

Scott

--- Musachy Barroso <[EMAIL PROTECTED]> wrote:

  

Assign an id to your datepicker, lets say "dp1" and
do this:

dojo.widget.byId("dp1").disable();

to enable it:

dojo.widget.byId("dp1").enable();

musachy

On 4/24/07, Scott Nesbitt <[EMAIL PROTECTED]>
wrote:


I would like to enable/disable the datetimepicker
  

when


the user selects certain radio buttons.  Here is
  

my


tag:



I can disable (and clear) the textbox next to the
calendar icon like this:

   var ud = getField('mainForm', 'untildate');
   ud.value = "";
   ud.disabled = true;

But this does not disable the calendar icon:

   ud = getField('mainForm', 'dojo.untildate');
   ud.disabled = true;

Any ideas on this?  I do not see any other
  

applicable


elements in my form.

Thanks,

Scott

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam
  

protection around


http://mail.yahoo.com


  

-
  

To unsubscribe, e-mail:
  

[EMAIL PROTECTED]


For additional commands, e-mail:
  

[EMAIL PROTECTED]

  

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





__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.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]



Re: Use EL to access to a key from the MessageResources.properties

2007-04-23 Thread Lance

">Email Link

piloupy GOTTAPIL wrote:

Hi,

I'd like to do something like this in a JSP file :

Email Link

where contact.mail is a key from my MessageResources.properties.

I think the solution is quite simple, but I can't find how to do.

Thanks in advance,

piloupy

-
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: Load an .xml file when server start up

2007-04-19 Thread Lance
You could implement a javax.servlet.ServletContextListener that is 
notified when your webapp loads / reloads.

Needs to be attached to your webapp in web.xml.


zhangfan wrote:

On 4/18/07, Zhang, Larry (L.) <[EMAIL PROTECTED]> wrote:

I need to load an .xml file when Websphere server starts up. I am 
using Struts ActionServlet as the only servlet in the app and I do 
have a CustomProcessor extending TilesRequestProcessor. I am trying to 
load the .xml file when the server starts up. I configured to load 
ActionServlet when server starts up in web.xml. Where should I put my 
code to load the .xml file during the server starts up.


Thanks.
  


Maybe the PlugIn interface can provide what you want.
It's notified just before and after the application life cycle. 
http://struts.apache.org/1.3.8/apidocs/index.html

Also, you should configure to load ActionServlet when server starts up
in web.xml, so that the your plugin will be invoked before that.

Good luck.



-
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: How to get original query string after more than two forwards

2007-04-19 Thread Lance
Oh, and another thing, it looks like your action is redirecting to your 
jsp instead of forwarding. In struts config, remove the redirect="true" 
from your forward. With redirect = true, any request attributes you set 
in your action will not make it to your jsp, also request scoped forms 
won't work. By changing this, request.getQueryString()  will work as you 
expect in your jsp so you may not need a filter after all.


Lance.

Lance wrote:
You could implement a javax.servlet.Filter that is mapped to *.do that 
pushes and pops to a session based stack.


Deep Blue Li wrote:

Hi,

I'm using the way now, but just wonder if is there anyway I can do it 
using

serlvet API. Thanks!

Regards,
Deep Blue


On 4/19/07, piloupy GOTTAPIL <[EMAIL PROTECTED]> wrote:


One trick that can help you, is to create a variable (a bean) in an
action Struts, so that it can be used in the jsp file.

In step 4/5 (in the action struts), you can set :

request.setAttribute("myQuery", request.getQueryString());

And in your jsp file, you can use it, for example, like this :



I'm not perfectly sure that it works, but you can try it.

piloupy

On 4/19/07, Deep Blue Li <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm currently using an app. server that is using servlet 2.4. I 
cannot

get
> the original query string after doing more than two request forward.
>
> Here is the scenario:
> 1. Enter the URL in the browser : http://xxx/xxx.do?search=abc
> 2. Go to validator, validation failed
> 3. Validator forwards the request to "xxx.do"  (first forward)
> 4. Inside xxx.do action, I can still get the query string from
> request.getAttribute ("javax.servlet.forward.query_string")
> 5. xxx.do forward to xxx.jsp (second forward)
> 6. I couldn't get back the query string "search=abc" in xxx.jsp
>
> I have tried using both request.getAttribute ("
> javax.servlet.forward.query_string")  and request.getQueryString() in
step
> 6, but both are not working.
>
> Is there any kind soul who can help me?
>
> Thanks!
>
> Regards,
> Deep Blue
>

-
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: How to get original query string after more than two forwards

2007-04-19 Thread Lance
You could implement a javax.servlet.Filter that is mapped to *.do that 
pushes and pops to a session based stack.


Deep Blue Li wrote:

Hi,

I'm using the way now, but just wonder if is there anyway I can do it 
using

serlvet API. Thanks!

Regards,
Deep Blue


On 4/19/07, piloupy GOTTAPIL <[EMAIL PROTECTED]> wrote:


One trick that can help you, is to create a variable (a bean) in an
action Struts, so that it can be used in the jsp file.

In step 4/5 (in the action struts), you can set :

request.setAttribute("myQuery", request.getQueryString());

And in your jsp file, you can use it, for example, like this :



I'm not perfectly sure that it works, but you can try it.

piloupy

On 4/19/07, Deep Blue Li <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm currently using an app. server that is using servlet 2.4. I cannot
get
> the original query string after doing more than two request forward.
>
> Here is the scenario:
> 1. Enter the URL in the browser : http://xxx/xxx.do?search=abc
> 2. Go to validator, validation failed
> 3. Validator forwards the request to "xxx.do"  (first forward)
> 4. Inside xxx.do action, I can still get the query string from
> request.getAttribute ("javax.servlet.forward.query_string")
> 5. xxx.do forward to xxx.jsp (second forward)
> 6. I couldn't get back the query string "search=abc" in xxx.jsp
>
> I have tried using both request.getAttribute ("
> javax.servlet.forward.query_string")  and request.getQueryString() in
step
> 6, but both are not working.
>
> Is there any kind soul who can help me?
>
> Thanks!
>
> Regards,
> Deep Blue
>

-
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: How to make a SELECT list readonly? If set disabled, loses the value when submit.

2007-04-18 Thread Lance

Another option is to make a disabled style in your css and blur onfocus


:


Using a hidden element with the same name is slightly dodgy in that 
form.elements["id"] will return a different value depending if the 
hidden element is placed before or after the select.


Megani wrote:

Hey, i was having the same problem...
i needed a to the action servlet populate the form bean with it.


i just declared a 
(...)


 


works fine ;)




-
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: Map-backed forms in Struts2

2007-04-17 Thread Lance

Do you have a getValue(String key) method?
I am not a s2 user but I have read the OGNL spec so sorry if I'm wrong 
but OGNL needs

  public PropertyType getPropertyName(IndexType index)
  and public void setPropertyName(IndexType index, PropertyType value)

http://www.ognl.org/2.6.9/Documentation/html/LanguageGuide/indexing.html#N10189

James Navin wrote:

Hi all,

A system I am developing requires forms to be generated dynamically at
runtime based on data stored in a database. I have read that it is possible
to use map-backed forms in Struts1 to achieve this using something of the
form '' where the
associated Action class has a method of the form 'public void
setValue(String key, Object value)', resulting in name-value pairs being
submitted to the Action class.

Is this possible to achieve in Struts2? I have not been able to make it
work. When I use the above expression for the name attribute the setValue
method is never called (I have checked this with a few debug print
statements), but no exception is thrown either. It just appears that
nothing happens.

Is this something I am doing wrong, or is there some other way to do this
in Struts2, or is it a bug?

I am using Struts 2.0.6 with Java 1.5.3, Tomcat 5.5 and Internet Explorer
6.

Thanks a lot in advance,

James


-
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: Form data to Vector

2007-04-16 Thread Lance

ok, i hadn't realised you were a newb.
yes, vector is on your form... i'd use an ArrayList tho (Vector is 
synchronized = slower)


eg
public ActionForward execute(ActionMapping mapping, ActionForm f, 
javax.servlet.http.HttpServletRequest request, 
javax.servlet.http.HttpServletResponse response)  {

   MyForm form = (MyForm) f;

  if ("add".equals(mapping.getParameter()) {
  form.getVector().add(new Record());
  } else if ("save".equals(mapping.getParameter()) {
  saveRecords(form.getVector());
  }
}

try searching the web for struts CRUD examples / tutorials.

Balazs Michnay wrote:

OK, we're getting closer and closer to the solution... :)
It seems that only the first options works for me, because the data are held by two 
 controls that are created dynamically and are populated from the 
db. So when you click on the first one, the form is submitted by a Javascript 
function so that the second one can be populated with db data.

Yes, I have two different .do actions for each submit button.

  

Your add action adds an empty row to your vector then goes back to the page,
JSP magically draws the empty record.
  


OK, now I completely understand the logic, I just don't see how it can be 
implemented.
I really need to know where the vector should be stored (form bean?) and how 
exactly I can add an element to it (create a method in the form bean class to 
add elements?).
You say, that elements should be added in the action class, but how can I 
reference a bean method that performs the actual adding? I couldn't figure it 
out...
Of course, when you press the submit button (not the add button) all the 
previously added elements must be available...

I hope my goal is clear for you,

Thanks a lot,

MB

- Original Message 
From: Lance <[EMAIL PROTECTED]>
To: Struts Users Mailing List 
Sent: Monday, April 16, 2007 2:41:05 PM
Subject: Re: Form data to Vector

Ok, so your add button creates a new blank record on your page
Your save button posts the form to some save action which validates / 
saves to the db


Two options:
1.
When you click on your "add" button you submit the form
You submit the form to /add.do instead of /save.do
Your add action adds an empty row to your vector then goes back to the 
page, JSP magically draws the empty record.
When you hit save, the record is in the vector so struts can just 
populate it.

Worse user experience because of serverside hit

2.
Add button calls a javascript function which uses the DOM to create a 
row with the inputs in the same style as your jsp

No serverside hit for "add"
Need to use a LazyList / Factory so that when you post to /save.do, the 
empty record will be created before struts populates it.


Balazs Michnay wrote:
  

This is how I need to do it: I
have a form with two submit buttons. One should add the content of a text field 
to a Vector (which is therefore in the form bean) without leaving the page, and 
the other submit button should point to another page that has access to the 
Vector values.
So I have two action classes, one for each submit button. Pressing one of them 
should therefore add one value to the Vector. I try to do this in my JSP, 
because I don't know how to call a specific bean method from the action class...
Hope I could explain it clearly...

Thanks for you help,

MB

- Original Message 
From: Lance <[EMAIL PROTECTED]>
To: Struts Users Mailing List 
Sent: Monday, April 16, 2007 2:15:06 PM
Subject: Re: Form data to Vector

Ok, im not sure how exactly you are using it but this is how I tend to 
do it.


In your load() action, you hit the db and generate some object for each 
row and put them into your vector.
Your jsp loops over all of the objects in the vector and displays 
s for each object (row)


Sometimes, you may generate a row without a serverside call (javascript) 
then post the form. In this case the set(index, object) of your vector 
will cause an IndexOutOfBoundsException. For this case, I use a LazyList 
and a factory which creates an empty object at the new index, then 
struts can populate the object with the  values.


http://jakarta.apache.org/commons/collections/apidocs-COLLECTIONS_3_0/org/apache/commons/collections/list/LazyList.html

Balazs Michnay wrote:
  


Struts does not seem to accept a Vector-typed field as a property value. The 
form simply fails to load.
I'd happily use LazyList and a Factory together instead of a Vector if it's 
easy to implement...
First I wanted to get it working with Vector, then I can easily switch to a 
different container.


In my JSP:


In my bean:
private Vector vizsgalatEsOrvos;

public Vector getVizsgalatEsOrvos() {
return vizsgalatEsOrvos;
}

public void setVizsgalatEsOrvos(Vector vizsgalatEsOrvos) {
this.vizsgalatEsOrvos = vizsgalatEsOrvos;
}

Re: Form data to Vector

2007-04-16 Thread Lance

Ok, so your add button creates a new blank record on your page
Your save button posts the form to some save action which validates / 
saves to the db


Two options:
1.
When you click on your "add" button you submit the form
You submit the form to /add.do instead of /save.do
Your add action adds an empty row to your vector then goes back to the 
page, JSP magically draws the empty record.
When you hit save, the record is in the vector so struts can just 
populate it.

Worse user experience because of serverside hit

2.
Add button calls a javascript function which uses the DOM to create a 
row with the inputs in the same style as your jsp

No serverside hit for "add"
Need to use a LazyList / Factory so that when you post to /save.do, the 
empty record will be created before struts populates it.


Balazs Michnay wrote:

This is how I need to do it: I
have a form with two submit buttons. One should add the content of a text field 
to a Vector (which is therefore in the form bean) without leaving the page, and 
the other submit button should point to another page that has access to the 
Vector values.
So I have two action classes, one for each submit button. Pressing one of them 
should therefore add one value to the Vector. I try to do this in my JSP, 
because I don't know how to call a specific bean method from the action class...
Hope I could explain it clearly...

Thanks for you help,

MB

- Original Message 
From: Lance <[EMAIL PROTECTED]>
To: Struts Users Mailing List 
Sent: Monday, April 16, 2007 2:15:06 PM
Subject: Re: Form data to Vector

Ok, im not sure how exactly you are using it but this is how I tend to 
do it.


In your load() action, you hit the db and generate some object for each 
row and put them into your vector.
Your jsp loops over all of the objects in the vector and displays 
s for each object (row)


Sometimes, you may generate a row without a serverside call (javascript) 
then post the form. In this case the set(index, object) of your vector 
will cause an IndexOutOfBoundsException. For this case, I use a LazyList 
and a factory which creates an empty object at the new index, then 
struts can populate the object with the  values.


http://jakarta.apache.org/commons/collections/apidocs-COLLECTIONS_3_0/org/apache/commons/collections/list/LazyList.html

Balazs Michnay wrote:
  

Struts does not seem to accept a Vector-typed field as a property value. The 
form simply fails to load.
I'd happily use LazyList and a Factory together instead of a Vector if it's 
easy to implement...
First I wanted to get it working with Vector, then I can easily switch to a 
different container.


In my JSP:


In my bean:
private Vector vizsgalatEsOrvos;

public Vector getVizsgalatEsOrvos() {
return vizsgalatEsOrvos;
}

public void setVizsgalatEsOrvos(Vector vizsgalatEsOrvos) {
this.vizsgalatEsOrvos = vizsgalatEsOrvos;
}

Instantiating my Vector in the constructor won't help...
Struts should call

myForm.getMyVector().set(0, ?)

Do I need to implement this metod? Do I need to write my own setters/getters to 
do this?
How can I do this exactly? 


Thanks,

MB

- Original Message 
From: Lance <[EMAIL PROTECTED]>
To: user@struts.apache.org
Sent: Monday, April 16, 2007 12:12:00 PM
Subject: Re: Form data to Vector



Lance wrote:
  


Sorry, it helps if i read your question fully.

The way to do this is to name your html form elements using in the 
struts (BeanUtils) conventions
If you have a form element named "myVector[3]" then struts will call 
myForm.getMyVector().set(3, ?)


It is sometimes easiest to use the struts nested tags to do this


   
   


will produce





If you are adding elements to the vector (instead of just editing 
existing vector elements), you might want to use a LazyList and a 
Factory together instead of a Vector, if you do, I can give you a bit 
more help if you need.


Lance.


Lance wrote:

  

Only way to get data into a Vector is by a scriptlet or in your action.
Struts 2's OGNL has a nice way of doing this but unfortunately with 
S1 we're left with dirty scriptlets in JSPs some of the time.


JSTL has a  that sometimes comes in handy where you 
provide a comma separated list of Strings and iterate through the 
elements.


Balazs Michnay wrote:
  


Thanks for the reply.
Yes, I know how to use the  to display the elements 
of a Vector (or ArrayList), I just don't see how to put these values 
into the Vector. I mean if I have a Vector (or an ArrayList) 
property in my form bean, how do I put some of my form data into my 
bean property. Do I need to modify the setters/getters? There must 
be a way to do this...
And yes, you're right, one the data are in the Vector, I can use 
 to display them.

Thanks for your help,

Re

Re: Form data to Vector

2007-04-16 Thread Lance
Ok, im not sure how exactly you are using it but this is how I tend to 
do it.


In your load() action, you hit the db and generate some object for each 
row and put them into your vector.
Your jsp loops over all of the objects in the vector and displays 
s for each object (row)


Sometimes, you may generate a row without a serverside call (javascript) 
then post the form. In this case the set(index, object) of your vector 
will cause an IndexOutOfBoundsException. For this case, I use a LazyList 
and a factory which creates an empty object at the new index, then 
struts can populate the object with the  values.


http://jakarta.apache.org/commons/collections/apidocs-COLLECTIONS_3_0/org/apache/commons/collections/list/LazyList.html

Balazs Michnay wrote:

Struts does not seem to accept a Vector-typed field as a property value. The 
form simply fails to load.
I'd happily use LazyList and a Factory together instead of a Vector if it's 
easy to implement...
First I wanted to get it working with Vector, then I can easily switch to a 
different container.


In my JSP:


In my bean:
private Vector vizsgalatEsOrvos;

public Vector getVizsgalatEsOrvos() {
return vizsgalatEsOrvos;
}

public void setVizsgalatEsOrvos(Vector vizsgalatEsOrvos) {
this.vizsgalatEsOrvos = vizsgalatEsOrvos;
}

Instantiating my Vector in the constructor won't help...
Struts should call

myForm.getMyVector().set(0, ?)

Do I need to implement this metod? Do I need to write my own setters/getters to 
do this?
How can I do this exactly? 


Thanks,

MB

- Original Message ----
From: Lance <[EMAIL PROTECTED]>
To: user@struts.apache.org
Sent: Monday, April 16, 2007 12:12:00 PM
Subject: Re: Form data to Vector



Lance wrote:
  

Sorry, it helps if i read your question fully.

The way to do this is to name your html form elements using in the 
struts (BeanUtils) conventions
If you have a form element named "myVector[3]" then struts will call 
myForm.getMyVector().set(3, ?)


It is sometimes easiest to use the struts nested tags to do this


   
   


will produce





If you are adding elements to the vector (instead of just editing 
existing vector elements), you might want to use a LazyList and a 
Factory together instead of a Vector, if you do, I can give you a bit 
more help if you need.


Lance.


Lance wrote:


Only way to get data into a Vector is by a scriptlet or in your action.
Struts 2's OGNL has a nice way of doing this but unfortunately with 
S1 we're left with dirty scriptlets in JSPs some of the time.


JSTL has a  that sometimes comes in handy where you 
provide a comma separated list of Strings and iterate through the 
elements.


Balazs Michnay wrote:
  

Thanks for the reply.
Yes, I know how to use the  to display the elements 
of a Vector (or ArrayList), I just don't see how to put these values 
into the Vector. I mean if I have a Vector (or an ArrayList) 
property in my form bean, how do I put some of my form data into my 
bean property. Do I need to modify the setters/getters? There must 
be a way to do this...
And yes, you're right, one the data are in the Vector, I can use 
 to display them.

Thanks for your help,

Regards,

MB

- Original Message 
From: Martin Gainty <[EMAIL PROTECTED]>
To: Struts Users Mailing List 
Sent: Friday, April 13, 2007 3:45:17 PM
Subject: Re: Form data to Vector

Balazs

Take a look at
http://struts.apache.org/1.0.2/api/org/apache/struts/taglib/logic/package-summary.html 

you will see this example of implementing a vector via use of struts 
logic:iterate in your jsp


<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%
  java.util.Vector vector = new java.util.Vector();
  vector.add(new Integer(12));
  vector.add(new Integer(5));
 %>

 Do something with myCollectionElement

This email message and any files transmitted with it contain 
confidential
information intended only for the person(s) to whom this email 
message is
addressed.  If you have received this email message in error, please 
notify

the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

- Original Message - From: "Balazs Michnay" 
<[EMAIL PROTECTED]>

To: "Struts Users Mailing List" 
Sent: Friday, April 13, 2007 4:09 AM
Subject: Form data to Vector


 


Hi,

I have a form with two submit buttons. One should add the content 
of a text field to a Vector (which is in the form bean?), and the 
other one should point to another page that has access to the 
Vector values.

I'd like to know how to add form data to a Vector.
Any help would be appreciated.

Thanks a lot,

MB



___

Re: Form data to Vector

2007-04-16 Thread Lance



Lance wrote:

Sorry, it helps if i read your question fully.

The way to do this is to name your html form elements using in the 
struts (BeanUtils) conventions
If you have a form element named "myVector[3]" then struts will call 
myForm.getMyVector().set(3, ?)


It is sometimes easiest to use the struts nested tags to do this


   
   


will produce





If you are adding elements to the vector (instead of just editing 
existing vector elements), you might want to use a LazyList and a 
Factory together instead of a Vector, if you do, I can give you a bit 
more help if you need.


Lance.


Lance wrote:

Only way to get data into a Vector is by a scriptlet or in your action.
Struts 2's OGNL has a nice way of doing this but unfortunately with 
S1 we're left with dirty scriptlets in JSPs some of the time.


JSTL has a  that sometimes comes in handy where you 
provide a comma separated list of Strings and iterate through the 
elements.


Balazs Michnay wrote:

Thanks for the reply.
Yes, I know how to use the  to display the elements 
of a Vector (or ArrayList), I just don't see how to put these values 
into the Vector. I mean if I have a Vector (or an ArrayList) 
property in my form bean, how do I put some of my form data into my 
bean property. Do I need to modify the setters/getters? There must 
be a way to do this...
And yes, you're right, one the data are in the Vector, I can use 
 to display them.

Thanks for your help,

Regards,

MB

- Original Message 
From: Martin Gainty <[EMAIL PROTECTED]>
To: Struts Users Mailing List 
Sent: Friday, April 13, 2007 3:45:17 PM
Subject: Re: Form data to Vector

Balazs

Take a look at
http://struts.apache.org/1.0.2/api/org/apache/struts/taglib/logic/package-summary.html 

you will see this example of implementing a vector via use of struts 
logic:iterate in your jsp


<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%
  java.util.Vector vector = new java.util.Vector();
  vector.add(new Integer(12));
  vector.add(new Integer(5));
 %>

 Do something with myCollectionElement

This email message and any files transmitted with it contain 
confidential
information intended only for the person(s) to whom this email 
message is
addressed.  If you have received this email message in error, please 
notify

the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

- Original Message - From: "Balazs Michnay" 
<[EMAIL PROTECTED]>

To: "Struts Users Mailing List" 
Sent: Friday, April 13, 2007 4:09 AM
Subject: Form data to Vector


 

Hi,

I have a form with two submit buttons. One should add the content 
of a text field to a Vector (which is in the form bean?), and the 
other one should point to another page that has access to the 
Vector values.

I'd like to know how to add form data to a Vector.
Any help would be appreciated.

Thanks a lot,

MB



__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 



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







__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com   







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



Re: AW: AW: AW: HowTo Format Numbers in html:text tag?

2007-04-16 Thread Lance

Looks ok to me altho im not familiar with parse position

You might wanna allow blank too
   if (price != null && price.trim().length() != 0) {

And catch NumberFormatException / set an error

And setPriceDouble(null) in your forms reset() method

Peter Neu wrote:

OK so what I did is:

--jsp---
  format="##"/>" /> 

-> Value gets displayed with commas. 


--action-form-

NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.GERMAN);
DecimalFormat df = (DecimalFormat) nf;
df.setDecimalSeparatorAlwaysShown(false);
df.applyPattern("#,###,###,###,###.#");


if (price != null) {
if (price.contains(".")) {
ActionError msg = new
ActionError("servlets.jsp.error.edit1");
errors.add("uploadErr", msg);
System.out.println("error");
} else {
  ParsePosition pp2  = new ParsePosition(0);
Number inNbr = df.parse(price, pp2);
setPriceDouble(inNbr.doubleValue());
}
}

In my struts action form I check for null values and the copy the string
representation into a double value.

Does that make sense?


  

-Ursprüngliche Nachricht-
Von: Lance [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 16. April 2007 11:31
An: Struts Users Mailing List
Betreff: Re: AW: AW: HowTo Format Numbers in html:text tag?

Your brute force approach does not use  tho?
Also, I have a suspicion that struts will either throw an exception or
set nulls for inputted numbers that contain commas, you might need to
use Strings on your form and format / parse to numbers in your action(s).

Peter Neu wrote:


But that's more code than the brute force approach:

" />

If have about 20-30 items. :o(





  

-Ursprüngliche Nachricht-
Von: Lance [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 16. April 2007 11:05
An: Struts Users Mailing List
Betreff: Re: AW: HowTo Format Numbers in html:text tag?

You could combine with struts-el







Peter Neu wrote:



That looks cool but I need to embed the value in the html:text field
  

so


the



user is able to edit the value. That won't work with 2 tags. :o(



  

-Ursprüngliche Nachricht-
Von: Lance [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 16. April 2007 10:45
An: Struts Users Mailing List
Betreff: Re: HowTo Format Numbers in html:text tag?

You could use  in JSTL
http://bellsouthpwp.net/b/i/billsigg/jstl-quick-reference.pdf
<http://bellsouthpwp.net/b/i/billsigg/jstl-quick-reference.pdf>

Peter Neu wrote:




Hello,

I need to format a number string in a html:text tag because the

  

default



value must be written with a comma sperator. e.g. 4,5 while the
  

value


of



my




value bean is in fact like this: 4.5.

Normally I would use bean:message and the format attribute. But this


  

does




not work in html:text.

How can I do this?


Cheers,
Pete





  

-


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]

  



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



Re: Form data to Vector

2007-04-16 Thread Lance

Only way to get data into a Vector is by a scriptlet or in your action.
Struts 2's OGNL has a nice way of doing this but unfortunately with S1 
we're left with dirty scriptlets in JSPs some of the time.


JSTL has a  that sometimes comes in handy where you 
provide a comma separated list of Strings and iterate through the elements.


Balazs Michnay wrote:

Thanks for the reply.
Yes, I know how to use the  to display the elements of a Vector 
(or ArrayList), I just don't see how to put these values into the Vector. I mean if I 
have a Vector (or an ArrayList) property in my form bean, how do I put some of my 
form data into my bean property. Do I need to modify the setters/getters? There must 
be a way to do this...
And yes, you're right, one the data are in the Vector, I can use 
 to display them.
Thanks for your help,

Regards,

MB

- Original Message 
From: Martin Gainty <[EMAIL PROTECTED]>
To: Struts Users Mailing List 
Sent: Friday, April 13, 2007 3:45:17 PM
Subject: Re: Form data to Vector

Balazs

Take a look at
http://struts.apache.org/1.0.2/api/org/apache/struts/taglib/logic/package-summary.html
you will see this example of implementing a vector via use of struts 
logic:iterate in your jsp


<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%
  java.util.Vector vector = new java.util.Vector();
  vector.add(new Integer(12));
  vector.add(new Integer(5));
 %>

 Do something with myCollectionElement

This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

- Original Message - 
From: "Balazs Michnay" <[EMAIL PROTECTED]>

To: "Struts Users Mailing List" 
Sent: Friday, April 13, 2007 4:09 AM
Subject: Form data to Vector


  

Hi,

I have a form with two submit buttons. One should add the content of a 
text field to a Vector (which is in the form bean?), and the other one 
should point to another page that has access to the Vector values.

I'd like to know how to add form data to a Vector.
Any help would be appreciated.

Thanks a lot,

MB



__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 




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







__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
  



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



Re: AW: AW: HowTo Format Numbers in html:text tag?

2007-04-16 Thread Lance

Your brute force approach does not use  tho?
Also, I have a suspicion that struts will either throw an exception or 
set nulls for inputted numbers that contain commas, you might need to 
use Strings on your form and format / parse to numbers in your action(s).


Peter Neu wrote:
But that's more code than the brute force approach: 


" />

If have about 20-30 items. :o(




  

-Ursprüngliche Nachricht-----
Von: Lance [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 16. April 2007 11:05
An: Struts Users Mailing List
Betreff: Re: AW: HowTo Format Numbers in html:text tag?

You could combine with struts-el







Peter Neu wrote:


That looks cool but I need to embed the value in the html:text field so
  

the


user is able to edit the value. That won't work with 2 tags. :o(


  

-Ursprüngliche Nachricht-
Von: Lance [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 16. April 2007 10:45
An: Struts Users Mailing List
Betreff: Re: HowTo Format Numbers in html:text tag?

You could use  in JSTL
http://bellsouthpwp.net/b/i/billsigg/jstl-quick-reference.pdf
<http://bellsouthpwp.net/b/i/billsigg/jstl-quick-reference.pdf>

Peter Neu wrote:



Hello,

I need to format a number string in a html:text tag because the
  

default


value must be written with a comma sperator. e.g. 4,5 while the value
  

of


my



value bean is in fact like this: 4.5.

Normally I would use bean:message and the format attribute. But this

  

does



not work in html:text.

How can I do this?


Cheers,
Pete




-
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: AW: HowTo Format Numbers in html:text tag?

2007-04-16 Thread Lance

You could combine with struts-el


var="formattedNumber" />





Peter Neu wrote:

That looks cool but I need to embed the value in the html:text field so the
user is able to edit the value. That won't work with 2 tags. :o(

  

-Ursprüngliche Nachricht-
Von: Lance [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 16. April 2007 10:45
An: Struts Users Mailing List
Betreff: Re: HowTo Format Numbers in html:text tag?

You could use  in JSTL
http://bellsouthpwp.net/b/i/billsigg/jstl-quick-reference.pdf
<http://bellsouthpwp.net/b/i/billsigg/jstl-quick-reference.pdf>

Peter Neu wrote:


Hello,

I need to format a number string in a html:text tag because the default
value must be written with a comma sperator. e.g. 4,5 while the value of
  

my


value bean is in fact like this: 4.5.

Normally I would use bean:message and the format attribute. But this
  

does


not work in html:text.

How can I do this?


Cheers,
Pete




-
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: HowTo Format Numbers in html:text tag?

2007-04-16 Thread Lance

Oops, i mean 

Lance wrote:

You could use  in JSTL
http://bellsouthpwp.net/b/i/billsigg/jstl-quick-reference.pdf 
<http://bellsouthpwp.net/b/i/billsigg/jstl-quick-reference.pdf>


Peter Neu wrote:

Hello,

I need to format a number string in a html:text tag because the default
value must be written with a comma sperator. e.g. 4,5 while the value 
of my

value bean is in fact like this: 4.5.

Normally I would use bean:message and the format attribute. But this 
does

not work in html:text.
How can I do this?


Cheers,
Pete



-
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: HowTo Format Numbers in html:text tag?

2007-04-16 Thread Lance

You could use  in JSTL
http://bellsouthpwp.net/b/i/billsigg/jstl-quick-reference.pdf 



Peter Neu wrote:

Hello,

I need to format a number string in a html:text tag because the default
value must be written with a comma sperator. e.g. 4,5 while the value of my
value bean is in fact like this: 4.5.

Normally I would use bean:message and the format attribute. But this does
not work in html:text. 


How can I do this?


Cheers,
Pete 





-
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: ajax and struts 2

2007-04-13 Thread Lance
read my mail... on the serverside you can use 
WebContextFactory.get().getSession()


David Harland wrote:

Im using DWR. The problem is that the java class that the javascript
talks to does not have access to the session. What would be better would
be for the dwr javascript to talk to an action.   


-Original Message-
From: Lance [mailto:[EMAIL PROTECTED] 
Sent: 13 April 2007 16:35

To: Struts Users Mailing List
Subject: Re: ajax and struts 2

ew... that sounds icky!
have you considered DWR, it marshalls calls from javascript to java then
marshalls the result back into javascript objects for you.

http://getahead.org/dwr/overview/dwr
on the serverside you can use WebContextFactory.get().getSession()

Mahesh Parab wrote:
  

Hi David,
u can able to read the session variable in javascript, e.g var intId 
intId='<%=session.getValue("id")%>' ;


try this ,

Thanks,
mahesh.

On 4/12/07, David Harland <[EMAIL PROTECTED]> wrote:

I am new to ajax and have just written my first ajax function. In my 
function I am passing a user id into the function and are being 
returned a List of Contacts to populate a select. Presently I am 
putting the id in a hidden field in the jsp and then passing it from 
there. What I would prefer to do is have the javascript function call
  


  
an action so that the Java code can access the user id from the 
session.


How do I do this please?




 Don't be flakey.  Get Yahoo! Mail for Mobile and always stay
connected to friends.http://mobile.yahoo.com/mail

-
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]


- --
ML {UFI}

__
Ufi Limited 
Registered in England No.  3980770 
Registered Office:  Dearing House, 1 Young Street, Sheffield, S1 4UP 

learndirect Solutions Ltd 
Registered in England No. 5081669 
Registered Office:  Dearing House, 1 Young Street, Sheffield, S1 4UP 

UFI Charitable Trust 
Registered in England No.  3658378 
Registered Charity No.  1081028 
Registered Office:  Dearing House, 1 Young Street, Sheffield, S1 4UP 


This email has been scanned by the MessageLabs Email Security System.

__

-
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: ajax and struts 2

2007-04-13 Thread Lance

ew... that sounds icky!
have you considered DWR, it marshalls calls from javascript to java then 
marshalls the result back into javascript objects for you.


http://getahead.org/dwr/overview/dwr
on the serverside you can use WebContextFactory.get().getSession()

Mahesh Parab wrote:

Hi David,
u can able to read the session variable in javascript,
e.g
var intId
intId='<%=session.getValue("id")%>' ;

try this ,

Thanks,
mahesh.

On 4/12/07, David Harland <[EMAIL PROTECTED]> wrote:


I am new to ajax and have just written my first ajax function. In my
function I am passing a user id into the function and are being 
returned a
List of Contacts to populate a select. Presently I am putting the id  
in a
hidden field in the jsp and then passing it from there. What I would 
prefer
to do is have the javascript function call an action so that the Java 
code

can access the user id from the session.

How do I do this please?




 Don't be flakey.  Get Yahoo! Mail for Mobile and always stay
connected to friends.http://mobile.yahoo.com/mail

-
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: help me to use struts-layout

2007-04-13 Thread Lance

I hadn't heard of this before and it looks quite good.
Has anyone had good / bad experiences with it?

In particular with  is it possible to get a 
reference to the current object and use it in and onRowClick for example?


Antonio Petrelli wrote:

2007/4/13, OSMAN Mohamed AMINE <[EMAIL PROTECTED]>:

hi,
would you like help me to developping with struts-layout in my 
jdevelopper

thank you to give me a stepby step exemple.


http://struts.application-servers.com/

Antonio

-
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]



[S1] Validating spoofed fields

2007-03-30 Thread Lance
I want to validate user input to check for spoofed fields eg. a spoofing 
a value that was not in a select menu or a radio group etc. I'm thinking 
of doing this by:


Extending  to create a FormOptions object that represents the 
input names and options. It will also put a hidden formId field on the page.
Extending , ,  to add to the 
FormOptions object
Extend RequestProcessor or have a filter that uses the formId to look up 
the FormOptions object for the current POST and validate the request 
parameters against it.


Has anyone already solved this problem / have a different suggestion?

Cheers,
Lance.



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



Re: Filtering multipart content

2007-03-27 Thread Lance
My filter is only interested in text parameters, my struts action 
processes the file parameter. If I parse the request myself (in the 
filter), the file parameter does not make it through to my action. If I 
do not parse the request myself, I can not see the parameters in my filter.


Hope this clears things up a bit.

trad-ex wrote:

Hi Lance,

Sorry for my misunderstanding your issue.
What I understood is:

 Your Filter class works fine except file parameter.
 
Is this correct ?

So, after I looked over your implementation, I found the line below:

parameterMap = multipartHandler.getTextElements();

So, parameterMap has only "normal text parameters" (you called), doesn't 
it ?


Why doesn't you adopt "getAllElements()" ?
But I don't have tested it yet, but if my guess above is right, it does 
work.


Best regards,
trad-ex

  

Hi trad-ex,
In action code, the ActionServlet has already parsed the request for you 
so request.getParameterMap() magically works. In a filter scenario, the 
request has not yet been parsed. I have since abondened attempting to 
filter multipart requests in my filter. Luckily most of our actions 
extend a common BaseAction and I was able to plug the filtering logic in 
there. It would have been nice to do it in a filter. I'm still 
interested if someone else has an answer.


Cheers,
Lance.

trad-ex wrote:


Hi Lance,

Just curious, I implemented multipart request handler using Struts 1.2,
ActionForm and Actoin class ( not using Fileter...) .

like:

  protected ActionForward executeAction( 
ActionMapping mapping , 
ActionForm form ,
HttpServletRequest request , 
HttpServletResponse response )

  {
ActionErrors errors = new ActionErrors() ;
HttpSession session = request.getSession() ;

String contentType = request.getContentType() ;
if( contentType == null || !contentType.startsWith( "multipart/form-
data" ) )
  return null ;

MultiFilesImportForm multiFilesImportForm = 
(MultiFilesImportForm) form ;
Hashtable multiFormFileTable = 
 multiFilesImportForm.getMultiFilesTable() ;


..

** executeAction calls execute internally.

My ActionForm ( called MultiFilesImportForm ) is like:


public class MultiFilesImportForm extends ActionForm
{
  public MultiFilesImportForm()
  {
  }
  public Hashtable getAllRequestTable()
  {
return getMultipartRequestHandler().getAllElements() ;
  }
  
  public Hashtable getMultiFilesTable()

  {
Hashtable fileElements = 
  getMultipartRequestHandler().getFileElements() ;

Hashtable stringElements = getMultiStringTable() ;

for( Enumeration enumStrKey = stringElements.keys() ; enumStrKey.

hasMoreElements() ; )
  fileElements.remove( enumStrKey.nextElement() ) ;

return fileElements ;

  }
  
  public Hashtable getMultiStringTable()

  {
Hashtable multiStringTable = new Hashtable() ;
Hashtable allRequestTable  = getAllRequestTable() ;

for( Enumeration enumKey = allRequestTable.keys() ; enumKey.

hasMoreElements() ; )
{
  String key  = (String) enumKey.nextElement() ;
  Object elem = allRequestTable.get( key );
  
  if( elem instanceof String )

multiStringTable.put( key , elem ) ;
}

return multiStringTable ;

  }
  
  public ActionErrors validate( 
  ActionMapping mapping , 
  HttpServletRequest request )

  {
   ...

Best Regards,
trad-ex


  
  
Can someone tell me the best way to deal with multipart parameters in a 
Filter without affecting struts?


In my filter, request.getParameterMap() returns an empty map because the 
multipart content has not yet been parsed. I had a look in the struts 
code and saw references to a MultipartRequestWrapper and a 
CommonsMultipartRequestHandler. From what I can see, the requestHandler 
parses the request and calls MultipartRequestWrapper.setParameter().


So... in my filter I do the following:

protected void doFilter(HttpServletRequest request, HttpServletResponse 
response, FilterChain chain) throws IOException, ServletException {

   boolean isMultipart = isMultipart(request);
   Map parameterMap;
   if (isMultipart) {
   // wrap the request so that 
CommonsMultipartRequestHandler.handleRequest()
   // can call set parameter. the wrapped request is then passed 
down the filter chain

   request = new MultipartRequestWrapper(request);
   MultipartRequestHandler multipartHandler = new 
CommonsMultipartRequestHandler();
   ModuleConfig moduleConfig = (ModuleConfig) 
servletContext.getAttribute(Globals.MODULE_KEY);

   request.setAttribute(Globals.MODULE_KEY, moduleConfig);
   multipartHandler.handleRequest(request);
   request.removeAttribute(Globals.MODULE_KEY);
   parameterMap = multipartHandler.

Re: Filtering multipart content

2007-03-26 Thread Lance

Hi trad-ex,
In action code, the ActionServlet has already parsed the request for you 
so request.getParameterMap() magically works. In a filter scenario, the 
request has not yet been parsed. I have since abondened attempting to 
filter multipart requests in my filter. Luckily most of our actions 
extend a common BaseAction and I was able to plug the filtering logic in 
there. It would have been nice to do it in a filter. I'm still 
interested if someone else has an answer.


Cheers,
Lance.

trad-ex wrote:

Hi Lance,

Just curious, I implemented multipart request handler using Struts 1.2,
ActionForm and Actoin class ( not using Fileter...) .

like:

  protected ActionForward executeAction( 
ActionMapping mapping , 
ActionForm form ,
HttpServletRequest request , 
HttpServletResponse response )

  {
ActionErrors errors = new ActionErrors() ;
HttpSession session = request.getSession() ;

String contentType = request.getContentType() ;
if( contentType == null || !contentType.startsWith( "multipart/form-
data" ) )
  return null ;

MultiFilesImportForm multiFilesImportForm = 
(MultiFilesImportForm) form ;
Hashtable multiFormFileTable = 
 multiFilesImportForm.getMultiFilesTable() ;


..

** executeAction calls execute internally.

My ActionForm ( called MultiFilesImportForm ) is like:


public class MultiFilesImportForm extends ActionForm
{
  public MultiFilesImportForm()
  {
  }
  public Hashtable getAllRequestTable()
  {
return getMultipartRequestHandler().getAllElements() ;
  }
  
  public Hashtable getMultiFilesTable()

  {
Hashtable fileElements = 
  getMultipartRequestHandler().getFileElements() ;

Hashtable stringElements = getMultiStringTable() ;

for( Enumeration enumStrKey = stringElements.keys() ; enumStrKey.

hasMoreElements() ; )
  fileElements.remove( enumStrKey.nextElement() ) ;

return fileElements ;

  }
  
  public Hashtable getMultiStringTable()

  {
Hashtable multiStringTable = new Hashtable() ;
Hashtable allRequestTable  = getAllRequestTable() ;

for( Enumeration enumKey = allRequestTable.keys() ; enumKey.

hasMoreElements() ; )
{
  String key  = (String) enumKey.nextElement() ;
  Object elem = allRequestTable.get( key );
  
  if( elem instanceof String )

multiStringTable.put( key , elem ) ;
}

return multiStringTable ;

  }
  
  public ActionErrors validate( 
  ActionMapping mapping , 
  HttpServletRequest request )

  {
   ...

Best Regards,
trad-ex


  
Can someone tell me the best way to deal with multipart parameters in a 
Filter without affecting struts?


In my filter, request.getParameterMap() returns an empty map because the 
multipart content has not yet been parsed. I had a look in the struts 
code and saw references to a MultipartRequestWrapper and a 
CommonsMultipartRequestHandler. From what I can see, the requestHandler 
parses the request and calls MultipartRequestWrapper.setParameter().


So... in my filter I do the following:

protected void doFilter(HttpServletRequest request, HttpServletResponse 
response, FilterChain chain) throws IOException, ServletException {

   boolean isMultipart = isMultipart(request);
   Map parameterMap;
   if (isMultipart) {
   // wrap the request so that 
CommonsMultipartRequestHandler.handleRequest()
   // can call set parameter. the wrapped request is then passed 
down the filter chain

   request = new MultipartRequestWrapper(request);
   MultipartRequestHandler multipartHandler = new 
CommonsMultipartRequestHandler();
   ModuleConfig moduleConfig = (ModuleConfig) 
servletContext.getAttribute(Globals.MODULE_KEY);

   request.setAttribute(Globals.MODULE_KEY, moduleConfig);
   multipartHandler.handleRequest(request);
   request.removeAttribute(Globals.MODULE_KEY);
   parameterMap = multipartHandler.getTextElements();
   } else {
   parameterMap = request.getParameterMap();
   }

   // do some stuff with the parameters

   chain.doFilter(request, response);
}

The problem now is that when I upload a file, struts thinks the file is 
null. request.getParameter() works for normal text parameters on the 
multipart form.
I have also tried parsing the request and sending the non-wrapped 
request down the chain but struts does not re-parse the request if i do 
this.


I am using struts 1.3.5

Thanks,
Lance.


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



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

Re: auto-refreshing stock price

2007-03-23 Thread Lance
You could use DWR's reverse ajax which allows the server to push data to 
clients rather than the clients polling which can be inefficient.


http://getahead.org/dwr/changelog/dwr20m1
http://getahead.org/dwr/download

YagNesh wrote:

Hi,

We have been trying to create a trading portfolio page which lists about 20
stocks with prices.
We need that stock price to be refreshed every 20-30 seconds after fetching
the price from server, indirectly from database.

I had tried to use Struts2 tag one per stock data, but it overload
the server with lots of requests and fails.

Please provide some guideline with AJAX approach to refresh.

Thank you
  



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



Filtering multipart content

2007-03-22 Thread Lance
Can someone tell me the best way to deal with multipart parameters in a 
Filter without affecting struts?


In my filter, request.getParameterMap() returns an empty map because the 
multipart content has not yet been parsed. I had a look in the struts 
code and saw references to a MultipartRequestWrapper and a 
CommonsMultipartRequestHandler. From what I can see, the requestHandler 
parses the request and calls MultipartRequestWrapper.setParameter().


So... in my filter I do the following:

protected void doFilter(HttpServletRequest request, HttpServletResponse 
response, FilterChain chain) throws IOException, ServletException {

   boolean isMultipart = isMultipart(request);
   Map parameterMap;
   if (isMultipart) {
   // wrap the request so that 
CommonsMultipartRequestHandler.handleRequest()
   // can call set parameter. the wrapped request is then passed 
down the filter chain

   request = new MultipartRequestWrapper(request);
   MultipartRequestHandler multipartHandler = new 
CommonsMultipartRequestHandler();
   ModuleConfig moduleConfig = (ModuleConfig) 
servletContext.getAttribute(Globals.MODULE_KEY);

   request.setAttribute(Globals.MODULE_KEY, moduleConfig);
   multipartHandler.handleRequest(request);
   request.removeAttribute(Globals.MODULE_KEY);
   parameterMap = multipartHandler.getTextElements();
   } else {
   parameterMap = request.getParameterMap();
   }

   // do some stuff with the parameters

   chain.doFilter(request, response);
}

The problem now is that when I upload a file, struts thinks the file is 
null. request.getParameter() works for normal text parameters on the 
multipart form.
I have also tried parsing the request and sending the non-wrapped 
request down the chain but struts does not re-parse the request if i do 
this.


I am using struts 1.3.5

Thanks,
Lance.


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



RE: Upgrading to struts 1.3.5, nested tags are broken

2007-03-07 Thread Lance Semmens
Problem solved... it ended up being one of our own custom tags that wasn't 
cleaning up after itself. Have changed the tag to mimic the behavior in the 
standard nested tags.

Cheers,
Lance.

-Original Message-
From: Niall Pemberton [mailto:[EMAIL PROTECTED] 
Sent: 07 March 2007 14:22
To: Struts Users Mailing List
Subject: Re: Upgrading to struts 1.3.5, nested tags are broken

On 3/7/07, Lance Semmens <[EMAIL PROTECTED]> wrote:
> We are in the process of upgrading to struts 1.3.5, I have followed the 
> upgrade guide at http://wiki.apache.org/struts/StrutsUpgradeNotes12to13. Most 
> of the nested tags now seem to be broken.
>
> For example:
> 
>type="example.com.Record">
> 
>   
> 
>
> The following exception is thrown:
> javax.servlet.jsp.JspException: No getter method for property: 
> "investor.name" of bean: "someForm"
> at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:903)
> at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:230)
> at 
> org.apache.struts.taglib.nested.bean.NestedWriteTag.doStartTag(NestedWriteTag.java:60)
>
>
> It seems as if  is going to the  to get 
> "investor.name" instead of "record" in  as I would expect. 
> If I change my  tags to  it fixes 
> them. I have looked at the code and writeNesting uses 
> NestedPropertyHelper.getAdjustedProperty() whereas write uses 
> NestedPropertyHelper.setNestedProperties().
>
>  is broken too, looking at the similarities in all of the 
> nested tags I get the they're all broken in this way.

I'm not that familiar with the nested tags - are you saying that you
have pages that used these tags and worked in Struts 1.2.x and they no
longer do so when upgrading to Struts 1.3.5?

Niall

> Cheers,
> Lance.

-
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: Upgrading to struts 1.3.5, nested tags are broken

2007-03-07 Thread Lance Semmens
I want record.getInvestor().getName() to be called. My understanding of nested 
is that  does not need to mention "record" as it implicitly 
knows about it.

-Original Message-
From: nagesh.kumar [mailto:[EMAIL PROTECTED] 
Sent: 07 March 2007 09:25
To: 'Struts Users Mailing List'
Subject: RE: Upgrading to struts 1.3.5, nested tags are broken

Instead of using  investor.name use record.name 

Try  this will work

-Original Message-
From: Lance Semmens [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 07, 2007 2:54 PM
To: 'user@struts.apache.org'
Subject: Upgrading to struts 1.3.5, nested tags are broken

We are in the process of upgrading to struts 1.3.5, I have followed the
upgrade guide at http://wiki.apache.org/struts/StrutsUpgradeNotes12to13.
Most of the nested tags now seem to be broken.

For example:

  

  


The following exception is thrown:
javax.servlet.jsp.JspException: No getter method for property:
"investor.name" of bean: "someForm"
at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:903)
at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:230)
at
org.apache.struts.taglib.nested.bean.NestedWriteTag.doStartTag(NestedWriteTa
g.java:60)


It seems as if  is going to the  to get
"investor.name" instead of "record" in  as I would expect.
If I change my  tags to  it fixes
them. I have looked at the code and writeNesting uses
NestedPropertyHelper.getAdjustedProperty() whereas write uses
NestedPropertyHelper.setNestedProperties().

 is broken too, looking at the similarities in all of the
nested tags I get the they're all broken in this way. 

Cheers,
Lance.


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


DISCLAIMER:
The information in this e-mail is the property of InterGlobe and is 
confidential and privileged. It is intended solely for the addressee. Access to 
this email by anyone else is unauthorized. If you are not the intended 
recipient, any disclosure, copying, distribution or any action taken in 
reliance on it is prohibited and will be unlawful. If you receive this message 
in error, please notify the sender immediately and delete all copies of this 
message



-
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]



Upgrading to struts 1.3.5, nested tags are broken

2007-03-07 Thread Lance Semmens
We are in the process of upgrading to struts 1.3.5, I have followed the upgrade 
guide at http://wiki.apache.org/struts/StrutsUpgradeNotes12to13. Most of the 
nested tags now seem to be broken.

For example:

  

  


The following exception is thrown:
javax.servlet.jsp.JspException: No getter method for property: "investor.name" 
of bean: "someForm"
at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:903)
at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:230)
at 
org.apache.struts.taglib.nested.bean.NestedWriteTag.doStartTag(NestedWriteTag.java:60)


It seems as if  is going to the  to get 
"investor.name" instead of "record" in  as I would expect. If 
I change my  tags to  it fixes them. I 
have looked at the code and writeNesting uses 
NestedPropertyHelper.getAdjustedProperty() whereas write uses 
NestedPropertyHelper.setNestedProperties().

 is broken too, looking at the similarities in all of the 
nested tags I get the they're all broken in this way. 

Cheers,
Lance.


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



RE: Logging to db

2006-11-21 Thread Lance Semmens
It would be easy enough to do by writing a custom javax.servlet.Filter. You 
would map your Filter to "*.do" in web.xml.

Alternatively you could configure a JDBC appender in log4j for 
"org.apache.struts.action.RequestProcessor" at level "debug" although you might 
find a bit too much junk is being logged. 
(http://logging.apache.org/log4j/docs/api/org/apache/log4j/jdbc/JDBCAppender.html)


-Original Message-
From: Søren Blidorf [mailto:[EMAIL PROTECTED] 
Sent: 21 November 2006 13:19
To: user@struts.apache.org
Subject: Logging to db

Hi.

I what to log every user action on my application and save it in my sql
db.

Is there a build in function in STRUTS for that?

BR

Soren, DK



-
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: session maintenance in struts webapp

2006-11-21 Thread Lance Semmens
You could either do it client side in javascript
setTimeout("confirmSessionExpire()", timeoutPeriod);

Or you could have a serverside thread and use DWR's amazing reverse ajax to 
push alerts to the client(s) that are about to expire. Reverse ajax is part of 
DWR2.0 and is not yet production stable but it's pretty close.
 
http://getahead.ltd.uk/dwr/changelog/dwr20m1 

Lance.
-Original Message-
From: robin bajaj [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 21, 2006 2:41 PM
To: Struts Users Mailing List
Subject: session maintenance in struts webapp

Hi Folks,
In my Struts 1.2.x based webapp, I intend to maintain a session for
every logged in user.
-- More details --
Say after 'n' seconds of inactivity I want to pop up a message
saying the session will expire in another 'm' seconds. The user can
click on 'refresh' button to get some more grace time else the session
will expire and the next time user tries to do something on the page, he
gets redirected to the 'login' page with a message - 'your last session
has expired, please login again'

I have already implemented SSL using SSLext tag-library (release 0 for
Struts 1.2.x) in my webApp. Can it help me in this case,

What other alternatives can I consider in this case,
Any tips/ideas will be much appreciated,
Regards,
robin



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


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__

*** Disclaimer *** 

This electronic communication is confidential and for the exclusive use of the 
addressee. It may contain private and confidential information. The 
information, attachments and opinions contained in this E-mail are those of its 
author only and do not necessarily represent those of London Scottish Bank PLC 
or any other members of the London Scottish Group. 

If you are not the intended addressee, you are prohibited from any disclosure, 
distribution or further copying or use of this communication or the information 
in it or taking any action in reliance on it. If you have received this 
communication in error please notify the Information Security Manager at [EMAIL 
PROTECTED] as soon as possible and delete the message from all places in your 
computer where it is stored. 

We utilise virus scanning software but we cannot guarantee the security of 
electronic communications and you are advised to check any attachments for 
viruses. We do not accept liability for any loss resulting from any corruption 
or alteration of data or importation of any virus as a result of receiving this 
electronic communication. 

Replies to this E-mail may be monitored for operational or business reasons. 
London Scottish Bank PLC is regulated by the Financial Services Authority.
__
This email has been scanned by the MessageLabs Email Security System.

-
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: can not reach the jsp file

2006-11-17 Thread Lance Semmens
scrap that idea... I was being a stupid head. cdms is your context path which 
it ok.

-Original Message-
From: Lance Semmens [mailto:[EMAIL PROTECTED] 
Sent: 17 November 2006 13:01
To: 'Struts Users Mailing List'
Subject: RE: can not reach the jsp file

> The URL that I ask my browser to browse is:
> http://localhost:8080/cdms/ShowDocs.do

Try hitting http://localhost:8080/ShowDocs.do
Or change your action mapping to
mailto:[EMAIL PROTECTED] 
Sent: 17 November 2006 10:40
To: Struts Users Mailing List
Subject: RE: can not reach the jsp file

No , I am using firefox.
I can see no exception or warning in log file(tomcat's log).
My platform is Tomcat 5.5 on Debian Linux, I develope and test my code
in Netbeans IDE.

Ken

於 五,2006-11-17 於 10:22 +,Lance Semmens 提到:
> hmm... are you using IE?
> You may need to turn off "show friendly error messages" in the options 
> somewhere. I'm thinking you've got a server error that IE is hiding from you. 
> Any errors in the log?
> 
>  -Original Message-
> From: Ken Hu [mailto:[EMAIL PROTECTED] 
> Sent: 17 November 2006 01:39
> To: Struts Users Mailing List
> Subject: RE: can not reach the jsp file
> 
> well ... sorry for that , this is a wrong typing when I post this
> question.
> In my struts-config.xml , the slash is not missing.
> 
> I add log4J in my app to trace my code :
> 
> public class ShowDocsAct extends org.apache.struts.action.Action{
> private Category _cat = Category.getInstance(this.getClass());
> public ActionForward execute(ActionMapping mapping,
> ActionForm form,
> ServletRequest request,
> ServletResponse response)
> throws Exception{
> 
>//print out this line in log file to prove the process has come
> into this class
> _cat.info("come into Action");
> 
> return mapping.findForward("success");
> }
> }
> 
> But I can not find the evidence that the process has come into this
> Action class.
> My struts-config.xml is as following :
> 
> 
> 
>  type="com.kenhu.cdms.servlet.ShowDocsAct">
> 
> 
>  
> 
> The URL that I ask my browser to browse is :
> http://localhost:8080/cdms/ShowDocs.do
> 
> Help  !  what do I go wrong ?
> 
> Ken
> 
> 
> 於 四,2006-11-16 於 15:16 +,Lance Semmens 提到:
> > I think you're missing a '/'
> > 
> > 
> > To keep your webapp a bit cleaner, perhaps consider
> > 
> > 
> > -Original Message-
> > From: Ken Hu [mailto:[EMAIL PROTECTED] 
> > Sent: 16 November 2006 09:03
> > To: user@struts.apache.org
> > Subject: can not reach the jsp file
> > 
> > Dear All:
> > 
> > I'm doing a simple strus test, but all I can see after I try to visit
> > "ShowDocs.do" is a blank page.
> > 
> > struts-config.xml:
> > 
> > 
> >  > type="com.kenhu.cdms.servlet.ShowDocsAct">
> > 
> > 
> > 
> > 
> > My Action class:
> > public ActionForward execute(ActionMapping mapping,
> > ActionForm form,
> > ServletRequest request,
> > ServletResponse response)
> > throws Exception{
> > return mapping.findForward("success");
> > }
> > 
> > I can not find anything wrong , could someone please tell me what's
> > going on here ?
> > 
> > Thanks
-- 
研發部 胡重威 Ken Hu  [EMAIL PROTECTED]

孟華科技股份有限公司
http://www.mmti.com.tw

地址: 高雄市802苓雅區中正一路120號4F-7
電話: 07-7279337 分機: 120
傳真: 07-7279377
行動: 0937083880


-
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: can not reach the jsp file

2006-11-17 Thread Lance Semmens
> The URL that I ask my browser to browse is:
> http://localhost:8080/cdms/ShowDocs.do

Try hitting http://localhost:8080/ShowDocs.do
Or change your action mapping to
mailto:[EMAIL PROTECTED] 
Sent: 17 November 2006 10:40
To: Struts Users Mailing List
Subject: RE: can not reach the jsp file

No , I am using firefox.
I can see no exception or warning in log file(tomcat's log).
My platform is Tomcat 5.5 on Debian Linux, I develope and test my code
in Netbeans IDE.

Ken

於 五,2006-11-17 於 10:22 +,Lance Semmens 提到:
> hmm... are you using IE?
> You may need to turn off "show friendly error messages" in the options 
> somewhere. I'm thinking you've got a server error that IE is hiding from you. 
> Any errors in the log?
> 
>  -Original Message-
> From: Ken Hu [mailto:[EMAIL PROTECTED] 
> Sent: 17 November 2006 01:39
> To: Struts Users Mailing List
> Subject: RE: can not reach the jsp file
> 
> well ... sorry for that , this is a wrong typing when I post this
> question.
> In my struts-config.xml , the slash is not missing.
> 
> I add log4J in my app to trace my code :
> 
> public class ShowDocsAct extends org.apache.struts.action.Action{
> private Category _cat = Category.getInstance(this.getClass());
> public ActionForward execute(ActionMapping mapping,
> ActionForm form,
> ServletRequest request,
> ServletResponse response)
> throws Exception{
> 
>//print out this line in log file to prove the process has come
> into this class
> _cat.info("come into Action");
> 
> return mapping.findForward("success");
> }
> }
> 
> But I can not find the evidence that the process has come into this
> Action class.
> My struts-config.xml is as following :
> 
> 
> 
>  type="com.kenhu.cdms.servlet.ShowDocsAct">
> 
> 
>  
> 
> The URL that I ask my browser to browse is :
> http://localhost:8080/cdms/ShowDocs.do
> 
> Help  !  what do I go wrong ?
> 
> Ken
> 
> 
> 於 四,2006-11-16 於 15:16 +,Lance Semmens 提到:
> > I think you're missing a '/'
> > 
> > 
> > To keep your webapp a bit cleaner, perhaps consider
> > 
> > 
> > -Original Message-
> > From: Ken Hu [mailto:[EMAIL PROTECTED] 
> > Sent: 16 November 2006 09:03
> > To: user@struts.apache.org
> > Subject: can not reach the jsp file
> > 
> > Dear All:
> > 
> > I'm doing a simple strus test, but all I can see after I try to visit
> > "ShowDocs.do" is a blank page.
> > 
> > struts-config.xml:
> > 
> > 
> >  > type="com.kenhu.cdms.servlet.ShowDocsAct">
> > 
> > 
> > 
> > 
> > My Action class:
> > public ActionForward execute(ActionMapping mapping,
> > ActionForm form,
> > ServletRequest request,
> > ServletResponse response)
> > throws Exception{
> > return mapping.findForward("success");
> > }
> > 
> > I can not find anything wrong , could someone please tell me what's
> > going on here ?
> > 
> > Thanks
-- 
研發部 胡重威 Ken Hu  [EMAIL PROTECTED]

孟華科技股份有限公司
http://www.mmti.com.tw

地址: 高雄市802苓雅區中正一路120號4F-7
電話: 07-7279337 分機: 120
傳真: 07-7279377
行動: 0937083880


-
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: can not reach the jsp file

2006-11-17 Thread Lance Semmens
hmm... are you using IE?
You may need to turn off "show friendly error messages" in the options 
somewhere. I'm thinking you've got a server error that IE is hiding from you. 
Any errors in the log?

 -Original Message-
From: Ken Hu [mailto:[EMAIL PROTECTED] 
Sent: 17 November 2006 01:39
To: Struts Users Mailing List
Subject: RE: can not reach the jsp file

well ... sorry for that , this is a wrong typing when I post this
question.
In my struts-config.xml , the slash is not missing.

I add log4J in my app to trace my code :

public class ShowDocsAct extends org.apache.struts.action.Action{
private Category _cat = Category.getInstance(this.getClass());
public ActionForward execute(ActionMapping mapping,
ActionForm form,
ServletRequest request,
ServletResponse response)
throws Exception{

   //print out this line in log file to prove the process has come
into this class
_cat.info("come into Action");

return mapping.findForward("success");
}
}

But I can not find the evidence that the process has come into this
Action class.
My struts-config.xml is as following :






 

The URL that I ask my browser to browse is :
http://localhost:8080/cdms/ShowDocs.do

Help  !  what do I go wrong ?

Ken


於 四,2006-11-16 於 15:16 +,Lance Semmens 提到:
> I think you're missing a '/'
> 
> 
> To keep your webapp a bit cleaner, perhaps consider
> 
> 
> -Original Message-
> From: Ken Hu [mailto:[EMAIL PROTECTED] 
> Sent: 16 November 2006 09:03
> To: user@struts.apache.org
> Subject: can not reach the jsp file
> 
> Dear All:
> 
> I'm doing a simple strus test, but all I can see after I try to visit
> "ShowDocs.do" is a blank page.
> 
> struts-config.xml:
> 
> 
>  type="com.kenhu.cdms.servlet.ShowDocsAct">
> 
> 
> 
> 
> My Action class:
> public ActionForward execute(ActionMapping mapping,
> ActionForm form,
> ServletRequest request,
> ServletResponse response)
> throws Exception{
> return mapping.findForward("success");
> }
> 
> I can not find anything wrong , could someone please tell me what's
> going on here ?
> 
> Thanks
-- 
研發部 胡重威 Ken Hu  [EMAIL PROTECTED]

孟華科技股份有限公司
http://www.mmti.com.tw

地址: 高雄市802苓雅區中正一路120號4F-7
電話: 07-7279337 分機: 120
傳真: 07-7279377
行動: 0937083880


-
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: custom tag for localization

2006-11-17 Thread Lance Semmens
Not exactly what you asked for but LocaleAction can set the locale then 
redirect to a page.

http://struts.apache.org/1.x/struts-extras/apidocs/

-Original Message-
From: Mahmoud Saeed(RSW) [mailto:[EMAIL PROTECTED] 
Sent: 14 November 2006 23:30
To: user@struts.apache.org
Subject: custom tag for localization

 

Hi, 

I want an open-source custom tag for localizing struts-based application
using dispatch Action.

thanx




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



RE: RE: RE: [HELP] struts 1.2.9 multibox/checkbox in session scoped form

2006-11-17 Thread Lance Semmens
RequestProcessor is doing it's job by resetting the form. What should then 
happen is that your checkboxes should be set after reset() is called which 
doesn't seem to be happening.

Somethings not right here, esp since when you comment out reset, it works. Can 
you post your code? pls. include the relevant parts of struts-config.xml, your 
action and your form.

-Original Message-
From: Garner Shawn [mailto:[EMAIL PROTECTED] 
Sent: 14 November 2006 17:36
To: user@struts.apache.org
Subject: RE: RE: RE: [HELP] struts 1.2.9 multibox/checkbox in session scoped 
form

I am not explicitly calling the reset anywhere.
I've also debugged it and can not find anything out of the ordinary.
>From I can tell it is the request processor that is resetting my form
prior to the page displaying that ends up with the checkboxes not
checked.

Any help?


Shawn

------
From: Lance Semmens <[EMAIL PROTECTED]>
To: 'Struts Users Mailing List' 
Date: Tue, 14 Nov 2006 09:51:00 +
Subject: RE: RE: [HELP] struts 1.2.9 multibox/checkbox in session scoped form
The only thing I can think is maybe you're explicitly calling reset()
in your action (instead of letting struts do it automatically). If
not, I suggest putting a debug breakpoint on the setters for your
checkboxes and see what's going on.

-
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: can not reach the jsp file

2006-11-16 Thread Lance Semmens
I think you're missing a '/'


To keep your webapp a bit cleaner, perhaps consider


-Original Message-
From: Ken Hu [mailto:[EMAIL PROTECTED] 
Sent: 16 November 2006 09:03
To: user@struts.apache.org
Subject: can not reach the jsp file

Dear All:

I'm doing a simple strus test, but all I can see after I try to visit
"ShowDocs.do" is a blank page.

struts-config.xml:







My Action class:
public ActionForward execute(ActionMapping mapping,
ActionForm form,
ServletRequest request,
ServletResponse response)
throws Exception{
return mapping.findForward("success");
}

I can not find anything wrong , could someone please tell me what's
going on here ?

Thanks
-- 
研發部 胡重威 Ken Hu  [EMAIL PROTECTED]

孟華科技股份有限公司
http://www.mmti.com.tw

地址: 高雄市802苓雅區中正一路120號4F-7
電話: 07-7279337 分機: 120
傳真: 07-7279377
行動: 0937083880


-
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: Dynamically adding row!

2006-11-15 Thread Lance Semmens
Ah. gotcha. I use my own custom formBeans so don't get this nifty little trick.

-Original Message-
From: Ed Griebel [mailto:[EMAIL PROTECTED] 
Sent: 15 November 2006 14:48
To: Struts Users Mailing List
Subject: Re: Dynamically adding row!

It's worked for me using a LazyDynaBean as the formbean and
java.util.Map as the contained object for a given property, and the
framework does populate new records into the contained map for me.

-ed

On 11/15/06, Lance Semmens <[EMAIL PROTECTED]> wrote:
> I realize your field names have to comply with the struts naming (ie so that 
> BeanUtils.setProperty() will work. But if your form has a collection that you 
> are adding a record to, struts will not create a new record, add it to your 
> form's collection then set the properties on it.
>
> Once you do the create and add, struts will then do the populate. That's why 
> I suggested the ajax call to add the record to the server side struts form so 
> that the subsequent post will populate the fields.
>
> -Original Message-
> From: Ed Griebel [mailto:[EMAIL PROTECTED]
> Sent: 14 November 2006 14:24
> To: Struts Users Mailing List
> Subject: Re: Dynamically adding row!
>
> You can have a form auto-populate from the javascript-generated
> fields, you just need to be careful what you call the generated field
> names. It will be hard-coded and none too attractive, but it will
> work. Look at the rendered HTML to see what format the field names are
> as an example.
>
> HTH,
> -ed
>
> On 11/14/06, Lance Semmens <[EMAIL PROTECTED]> wrote:
> > The least messy way is to post to an addRecord action which adds a blank 
> > record to your form. Form must be in session scope. This requires a page 
> > redraw so is less responsive but this is the approach I often use.
> >
> > If you add a row to your table using javascript, struts will not 
> > automatically populate your form with the new record(s) upon save so you 
> > will need to handle this in your action. Unless of course you use ajax 
> > (which you have said you don't want to do) to add the record to your struts 
> > form on the server.
> >
> > Display tags will work for both suggestions. The javascript option usually 
> > involves cloning an existing row and blanking out the fields.
> >
> > Lance.
> >
> > -Original Message-
> > From: Balwinder [mailto:[EMAIL PROTECTED]
> > Sent: 14 November 2006 10:05
> > To: Struts Users Mailing List
> > Subject: Dynamically adding row!
> >
> > Hi All!
> >
> > I am trying to add a row in a table dynamically to add new record in
> > Struts web application.
> >
> > Iam using struts 1.1 and need to implement non-Ajax solution.
> >
> > Will display tags has solution to this situation?
> >
> > Any help  will be appreciated.
> >
> > Thanks and Regards,
> > Balwinder Kumar
> >
> > -
> > 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: Dynamically adding row!

2006-11-15 Thread Lance Semmens
I realize your field names have to comply with the struts naming (ie so that 
BeanUtils.setProperty() will work. But if your form has a collection that you 
are adding a record to, struts will not create a new record, add it to your 
form's collection then set the properties on it. 

Once you do the create and add, struts will then do the populate. That's why I 
suggested the ajax call to add the record to the server side struts form so 
that the subsequent post will populate the fields.

-Original Message-
From: Ed Griebel [mailto:[EMAIL PROTECTED] 
Sent: 14 November 2006 14:24
To: Struts Users Mailing List
Subject: Re: Dynamically adding row!

You can have a form auto-populate from the javascript-generated
fields, you just need to be careful what you call the generated field
names. It will be hard-coded and none too attractive, but it will
work. Look at the rendered HTML to see what format the field names are
as an example.

HTH,
-ed

On 11/14/06, Lance Semmens <[EMAIL PROTECTED]> wrote:
> The least messy way is to post to an addRecord action which adds a blank 
> record to your form. Form must be in session scope. This requires a page 
> redraw so is less responsive but this is the approach I often use.
>
> If you add a row to your table using javascript, struts will not 
> automatically populate your form with the new record(s) upon save so you will 
> need to handle this in your action. Unless of course you use ajax (which you 
> have said you don't want to do) to add the record to your struts form on the 
> server.
>
> Display tags will work for both suggestions. The javascript option usually 
> involves cloning an existing row and blanking out the fields.
>
> Lance.
>
> -Original Message-
> From: Balwinder [mailto:[EMAIL PROTECTED]
> Sent: 14 November 2006 10:05
> To: Struts Users Mailing List
> Subject: Dynamically adding row!
>
> Hi All!
>
> I am trying to add a row in a table dynamically to add new record in
> Struts web application.
>
> Iam using struts 1.1 and need to implement non-Ajax solution.
>
> Will display tags has solution to this situation?
>
> Any help  will be appreciated.
>
> Thanks and Regards,
> Balwinder Kumar
>
> -
> 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: Dynamically adding row!

2006-11-15 Thread Lance Semmens
I realize your field names have to comply with the struts naming (ie so that 
BeanUtils.setProperty() will work. But if your form has a collection that you 
are adding a record to, struts will not create a new record, add it to your 
form's collection then set the properties on it. 

Once you do the create and add, struts will then do the populate. That's why I 
suggested the ajax call to add the record to the server side struts form so 
that the subsequent post will populate the fields.

-Original Message-
From: Ed Griebel [mailto:[EMAIL PROTECTED] 
Sent: 14 November 2006 14:24
To: Struts Users Mailing List
Subject: Re: Dynamically adding row!

You can have a form auto-populate from the javascript-generated
fields, you just need to be careful what you call the generated field
names. It will be hard-coded and none too attractive, but it will
work. Look at the rendered HTML to see what format the field names are
as an example.

HTH,
-ed

On 11/14/06, Lance Semmens <[EMAIL PROTECTED]> wrote:
> The least messy way is to post to an addRecord action which adds a blank 
> record to your form. Form must be in session scope. This requires a page 
> redraw so is less responsive but this is the approach I often use.
>
> If you add a row to your table using javascript, struts will not 
> automatically populate your form with the new record(s) upon save so you will 
> need to handle this in your action. Unless of course you use ajax (which you 
> have said you don't want to do) to add the record to your struts form on the 
> server.
>
> Display tags will work for both suggestions. The javascript option usually 
> involves cloning an existing row and blanking out the fields.
>
> Lance.
>
> -Original Message-
> From: Balwinder [mailto:[EMAIL PROTECTED]
> Sent: 14 November 2006 10:05
> To: Struts Users Mailing List
> Subject: Dynamically adding row!
>
> Hi All!
>
> I am trying to add a row in a table dynamically to add new record in
> Struts web application.
>
> Iam using struts 1.1 and need to implement non-Ajax solution.
>
> Will display tags has solution to this situation?
>
> Any help  will be appreciated.
>
> Thanks and Regards,
> Balwinder Kumar
>
> -
> 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: Validation + multiple Submit buttons

2006-11-14 Thread Lance Semmens
A JS free application? You can assume today's browsers have javascript, the web 
would break otherwise. Sure there are some cross platform issues but to go JS 
free is a tall order and will limit you to a clunky UI.

If JS free is your direction, you could wrap your back button in a  
that posts to a different action to your save.

Lance.

-Original Message-
From: Andrew Martin [mailto:[EMAIL PROTECTED] 
Sent: 14 November 2006 13:36
To: Struts Users Mailing List
Subject: Validation + multiple Submit buttons

Hi,

I have just begun to add validation to my forms using struts validator, which 
is quite nice. I have however a problem when I have more than one submit button 
on a form.

For example I have a Save button and a Back button.
The Back button is also a submit (instead of a standard button - basically 
because we are creating a JS free applciation!)

Within the struts configuration the validate is set to true for this action 
with an input page defined.
The validation is set to check certain fields are not empty.

As both buttons call the same action the validation is called on both, but I do 
not want validation to occur on certain submit actions (namely the Back button)

Ideally I would like to configure this in the XML Struts-config.xml or 
validation.xml but I am not sure if this is actually possible (I fear the worst)

If anyone has any tips, much appreciated.

Andrew



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



RE: setInput method of ActionMapping

2006-11-14 Thread Lance Semmens
A possible solution might be to 
1. Set validate="false" for your action.
2. Configure forwards for each of your error pages
2. Explicitly call form.validate() in your action 
3. Call saveErrors() if validation fails
4. Redirect to the appropriate forward

Lance.

-Original Message-
From: Nuwan Chandrasoma [mailto:[EMAIL PROTECTED] 
Sent: 14 November 2006 11:41
To: Struts Users Mailing List
Subject: Re: setInput method of ActionMapping

As for my understanding this cantnot be set after the struts-config is 
loaded.,


- Original Message - 
From: "chamal desilva" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, November 14, 2006 7:37 AM
Subject: setInput method of ActionMapping


> Hi,
>
>
> I want to call
>
> mapping .setInput() method inside my validate method
> of a form bean.
>
> But it throws an Exception.
>
> 
> java.lang.IllegalStateException: Configuration is
> frozen at
> org.apache.struts.config.ActionConfig.setInput(ActionC
> 
>
> Please help me to correct this issue.
>
> Thanking You,
> Chamal.
>
>
>
> 
> Do you Yahoo!?
> Everyone is raving about the all-new Yahoo! Mail beta.
> http://new.mail.yahoo.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]



RE: how to add edit/add/delete functionality

2006-11-14 Thread Lance Semmens
I found this by googling struts crud
http://www.learntechnology.net/struts-crud.do 

-Original Message-
From: santas [mailto:[EMAIL PROTECTED] 
Sent: 14 November 2006 12:03
To: user@struts.apache.org
Subject: how to add edit/add/delete functionality


Hi all
i am new to struts
can anybody give me any idea for addind 
add/edit/delete functionality in a struts application

it will be great if i can get the flow 


thank you

-- 
View this message in context: 
http://www.nabble.com/how-to-add-edit-add-delete-functionality-tf2629040.html#a7336292
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]



RE: RE: [HELP] struts 1.2.9 multibox/checkbox in session scoped form

2006-11-14 Thread Lance Semmens
The only thing I can think is maybe you're explicitly calling reset() in your 
action (instead of letting struts do it automatically). If not, I suggest 
putting a debug breakpoint on the setters for your checkboxes and see what's 
going on.
 
-Original Message-
From: Garner Shawn [mailto:[EMAIL PROTECTED] 
Sent: 13 November 2006 20:19
To: user@struts.apache.org
Subject: RE: RE: [HELP] struts 1.2.9 multibox/checkbox in session scoped form

1. Yes
2. Yes
3  In ActionForm.reset

If I comment out my reset method then it populates the checkboxes
based on the form values like I want however I then loose the ability
to only get the checked value put into my action form after the page
is submitted.

----

From: Lance Semmens <[EMAIL PROTECTED]>
To: 'Struts Users Mailing List' 
Date: Mon, 13 Nov 2006 17:08:00 +
Subject: RE: [HELP] struts 1.2.9 multibox/checkbox in session scoped form
A couple of things to check
1. Is your get action using the same form as your post action?
2. Do the names of the checkboxes in the html match your form?
3. Where are you resetting the checkboxes? I'm hoping you're doing it
by overriding ActionForm.reset().

-
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: Dynamically adding row!

2006-11-14 Thread Lance Semmens
The least messy way is to post to an addRecord action which adds a blank record 
to your form. Form must be in session scope. This requires a page redraw so is 
less responsive but this is the approach I often use.

If you add a row to your table using javascript, struts will not automatically 
populate your form with the new record(s) upon save so you will need to handle 
this in your action. Unless of course you use ajax (which you have said you 
don't want to do) to add the record to your struts form on the server. 

Display tags will work for both suggestions. The javascript option usually 
involves cloning an existing row and blanking out the fields. 

Lance.

-Original Message-
From: Balwinder [mailto:[EMAIL PROTECTED] 
Sent: 14 November 2006 10:05
To: Struts Users Mailing List
Subject: Dynamically adding row!

Hi All!

I am trying to add a row in a table dynamically to add new record in 
Struts web application.

Iam using struts 1.1 and need to implement non-Ajax solution.

Will display tags has solution to this situation?

Any help  will be appreciated.

Thanks and Regards,
Balwinder Kumar

-
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: [HELP] struts 1.2.9 multibox/checkbox in session scoped form

2006-11-13 Thread Lance Semmens
A couple of things to check
1. Is your get action using the same form as your post action?
2. Do the names of the checkboxes in the html match your form?
3. Where are you resetting the checkboxes? I'm hoping you're doing it by 
overriding ActionForm.reset().

-Original Message-
From: Garner Shawn [mailto:[EMAIL PROTECTED] 
Sent: 13 November 2006 16:47
To: user@struts.apache.org
Subject: [HELP] struts 1.2.9 multibox/checkbox in session scoped form

I reset my checkboxes and a multibox in a form reset method but then
when I come back to the page the values arn't checked.
If I don't reset them then it won't register them as not checked anymore.

How do I fix this?

Shawn

-
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: without writing a in the resultant HTML

2006-11-10 Thread Lance Semmens
That worked a treat... thanks for the quick response.
I did a quick check with  and  and the *hack* 
seems to work there too.

-Original Message-
From: Wendy Smoak [mailto:[EMAIL PROTECTED] 
Sent: 10 November 2006 17:08
To: Struts Users Mailing List
Subject: Re:  without writing a  in the resultant HTML

On 11/10/06, Lance Semmens <[EMAIL PROTECTED]> wrote:
> 1. Can I use struts tags (eg ) without wrapping them in an 
>  (I'm pretty sure the answer is no).
>
> 2. Can I wrap my tags in  but somehow not output  to the 
> resultant HTML.
>
> I was hoping for a render="false" or similar. eg:
>
> 
> 
> 
> 
> 
>
> Any other suggestions welcome.

Officially... http://struts.apache.org/1.x/struts-taglib/tlddoc/html/select.html

"This tag is only valid when nested inside a form tag body."

What happens if you leave off  and use the 'name' attribute
of the select tag?  If the form bean (or some other bean) is in scope,
it might work.  I'd also review the code for the select tag and see
what else it expects to get from the enclosing form tag.

'name' - The attribute name of the bean whose properties are consulted
to determine which option should be pre-selected when rendering this
input field. If not specified, the bean associated with the enclosing
 tag is utilized.

-- 
Wendy

-
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]



without writing a in the resultant HTML

2006-11-10 Thread Lance Semmens
Hi, I'm wanting to use the struts tags to render my inputs. The only problem is 
that my JSP page only draws a small section of the form (perhaps a single 
) and is called via AJAX. So, I have 2 questions:

1. Can I use struts tags (eg ) without wrapping them in an 
 (I'm pretty sure the answer is no).

2. Can I wrap my tags in  but somehow not output  to the 
resultant HTML.

I was hoping for a render="false" or similar. eg:







Any other suggestions welcome.

Thanks,
Lance.




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



RE: How to make dropdown box editable.

2006-11-06 Thread Lance Semmens
Dojo has a control that sounds like what you're after.

http://dojotoolkit.org/

go to:
see it in action --> form widgets --> form tour and look at the "state" field.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 26 October 2006 14:30
To: user@struts.apache.org
Subject: How to make dropdown box editable.


Hi all,


I have requirement where in I want drop down box to be editable. Is this
possible using struts html tag lib.
Please let me know how to go about making drop down box editable.


Regards,
Vinodh













The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments.


WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.


www.wipro.com



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



RE: [OT] Identify file type

2006-11-03 Thread Lance Semmens
On your upload form, your property that maps to your file upload input should 
be of type org.apache.struts.upload.FormFile. Then save the FormFile 
.getFileData() and FormFile.getContentType() to the database.

-Original Message-
From: Vijay Venkataraman [mailto:[EMAIL PROTECTED] 
Sent: 03 November 2006 09:11
To: Struts Users Mailing List
Subject: [OT] Identify file type

Hi,
I have requirement where uploaded files exists in database as blobs. Now 
i need to retrieve the file and push this to the browser.
I have no clue as to what the file type is. So i am not in a position to 
set the content type clearly. Does any one know of a utility which can 
identify the file type?

Thanks,
Vijay Venkataraman

-
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: [OT] Identify file type

2006-11-03 Thread Lance Semmens
On your upload form, your property that maps to your file upload input should 
be of type org.apache.struts.upload.FormFile. Then save the FormFile 
.getFileData() and FormFile.getContentType() to the database.

-Original Message-
From: Vijay Venkataraman [mailto:[EMAIL PROTECTED] 
Sent: 03 November 2006 09:11
To: Struts Users Mailing List
Subject: [OT] Identify file type

Hi,
I have requirement where uploaded files exists in database as blobs. Now 
i need to retrieve the file and push this to the browser.
I have no clue as to what the file type is. So i am not in a position to 
set the content type clearly. Does any one know of a utility which can 
identify the file type?

Thanks,
Vijay Venkataraman

-
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: R: Dynamically Generated html:Text

2006-09-18 Thread Lance
Try 

-Original Message-
From: Marcello Savino [mailto:[EMAIL PROTECTED] 
Sent: 18 September 2006 13:29
To: Struts Users Mailing List
Subject: R: R: Dynamically Generated html:Text

Something like that:

public class myMapForm extends ActionForm {

  public void setTxt(int index, Object value) {
  a[i]=value;
  }

  public String getTxt() {
  return (String)a[i];
  }

}

JSP file(test.jsp)=


  

Google Client
  
  
  
 <%
 for(i=0;i<1;i++)
 %>
 
  



Please  take a look a the struts documentation on-line for further details o
other examples.
Marcello
-Messaggio originale-
Da: Aftab Vhora [mailto:[EMAIL PROTECTED] 
Inviato: lunedì 18 settembre 2006 12.30
A: Struts Users Mailing List
Oggetto: Re: R: Dynamically Generated html:Text

Hi Savino,

Thanks for the reply. Could u please provide me an example my test.jsp 
using indexed properties.

Thanks & Regards,
Aftab Vhora




Marcello Savino wrote:

>1) You have some kind of getter and setter for txt property not for txt1,
txt2, txt3 property
>You'd better look for indexed properties
>
>-Messaggio originale-
>Da: Aftab Vhora [mailto:[EMAIL PROTECTED] 
>Inviato: lunedì 18 settembre 2006 12.06
>A: Struts Users Mailing List
>Oggetto: Dynamically Generated html:Text
>
>Hi,
>
>I m dynamically generating the html:text , i have made correct entry in 
>the struts config.xml and also implemented the Action Form and Action 
>class.
>
>But I m getting below error, request you to kindly provide me the solution.
>
>===ERROR
>
>javax.servlet.jsp.JspException: No getter method for property txt1 of 
>bean org.apache.struts.taglib.html.BEAN
>at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:968)
>at 
>org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.java:176
)
>at _test._jspService(_test.java:63)
>[/test.jsp]
>.
>
>=action form=
>public class myMapForm extends ActionForm
>{
>  private final Map values = new HashMap();
>
>  public void setTxt(String key, Object value) {
>  values.put(key, value);
>  }
>
>  public String getTxt(String key) {
>  return (String)values.get(key);
>  }
>
>}
>
>JSP file(test.jsp)=
>
>
>  
>
>Google Client
>  
>  
>  
> <%
> for(i=0;i<1;i++)
> %>
> 
>  
>
>
>
>
>  
>

-
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]



Hot deployable actions

2006-09-18 Thread Lance
Hi, I've written a utility that uses a proxy to re-load a class if the
.class file has a later modified date than the last loaded date. I'd like to
plug this into struts so that my action classes can be hot-deployed.

I'm wanting some guidance about what classes I should interface / extend and
where this should be plugged into struts. Also any problems I may come
across. I realize that only 1 instance of each action is loaded per
application. This is fine, my proxy will be loaded once and the delegate
action (which of course has no member variables) will be re-loaded.

Cheers,
Lance.



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



RE: Best practice for external webapp configuration ?

2006-08-30 Thread Lance
On jboss, this can be done by configuring the SystemPropertiesService.
@see jboss\server\all\deploy\properties-service.xml

Properties can be configured inline in the xml file or can be declared in a
separate file which is referenced by properties-service.xml.

> Hello,
>
> I'm searching for best practice in JEE applications to put 
> configuration elements outside the war/ear.
>
> Here is what I mean : My webapp requires some filesystem path to work 
> (logs dir, system-dependent config files...). I'm using a java sytem 
> property to setup a root path for external configuration, but this 
> requires to customize the container JVM ("-Dxxx=yyy"). Is there a 
> better "JEE" way to do such things ?
>
> Nico.




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



RE: pagination

2006-08-01 Thread Lance
Displaytag will do it
http://displaytag.sourceforge.net/11/displaytag/tagreference.html

See the pagesize attribute.

-Original Message-
From: Medicherla Lakshmi [mailto:[EMAIL PROTECTED] 
Sent: 01 August 2006 08:20
To: user@struts.apache.org
Subject: pagination

Hi All,
   
  Am using struts in my project.  Can anyone tel me how to implement
pagination in struts.  I dont have any idea how to do that.  Any links or
examples will be of great value.
   
  Thanks in Advance.


-
 Here's a new way to find what you're looking for - Yahoo! Answers 



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



  1   2   >