basic problem in java

2004-04-17 Thread birendar . waldiya

Hi, 
this may be a slightly silly
question for people working on struts etc but im facing it
and i dont have the clue why im getting it.. can anyone suggest me why
im getting proble..
while compiling a java program my
javac is unable to resolve the standard java classes like java.io.*
 java.util.* ; 


C:\biren\javajavac jaba1.java
jaba1.java:2: cannot resolve symbol
symbol : class io
location: class java
import java.io.*;

whats the problem please
help !

 ^
Birendar Singh Waldiya
DISCLAIMER: The information contained in this message is intended only and solely for 
the addressed individual or entity indicated in this message and for the exclusive use 
of the said addressed individual or entity indicated in this message (or responsible 
for delivery
of the message to such person) and may contain legally privileged and confidential 
information belonging to Tata Consultancy Services. It must not be printed, read, 
copied, disclosed, forwarded, distributed or used (in whatsoever manner) by any person 
other than the addressee. 
Unauthorized use, disclosure or copying is strictly prohibited and may constitute 
unlawful act and can possibly attract legal action, civil and/or criminal. The 
contents of this message need not necessarily reflect or endorse the views of Tata 
Consultancy Services on any subject matter.
Any action taken or omitted to be taken based on this message is entirely at your risk 
and neither the originator of this message nor Tata Consultancy Services takes any 
responsibility or liability towards the same. Opinions, conclusions and any other 
information contained in this message 
that do not relate to the official business of Tata Consultancy Services shall be 
understood as neither given nor endorsed by Tata Consultancy Services or any affiliate 
of Tata Consultancy Services. If you have received this message in error, you should 
destroy this message and may please notify the sender by e-mail. Thank you.


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

Re: Locale=true in html:html tag

2004-04-17 Thread Craig McClanahan
Stjepan Brbot wrote:

Craig McClanahan [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 

You don't need it at all if you're willing to let the user's language 
selection in the browser control everything (which is the default 
behavior).  If you want to offer a change Language control, you'll 
need to use either lang=true or locale=true (and make sure there's a 
session) so that Struts can keep track of the user's non-default locale 
choice.

Craig
   

If both lang=true (Struts v1.2) and locale=true (Struts v1.1) work on the same way, what's the reason of changig this parameter from locale to lang in new version of Struts?

 

The locale=true attribute forced the creation of a session if it 
didn't exist, which made it tough for applications that wanted to 
support mutiple locales but wanted the scalability advantage of not 
requiring sessions.  The lang=true attribute does not do this -- you 
can have the benefit of automatically adapting to the browser's 
preferred language setting without having to create a session.

With the lang attribue, you only need a session if you want to offer a 
Change Language option to your users that allows selecting a language 
other than whatever they've configured their browser to.

SB
 

Craig

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


Re: Struts for fatclient-server applications

2004-04-17 Thread Craig McClanahan
Andrew Petro wrote:

Struts could be used for the server portion of your client-server
application -- the server could be implemented as a standard web
application, perhaps providing XML to the client.  The client would play the
role of the web browser -- be the web browser -- in interacting with the
webapplication server.
Never done it.  Duncan notes, Struts is tied to the Servlet API and so a
choice to use Struts for the server portion is really a decision to use a
servlet container contained webapplication as the server portion of your
client-server design.
[[
I've used Struts before for web applications but at the moment I'm
evaluating if it would be possible to use Struts for Java Client-Server
applications (Java fat client). Any thoughts? Has some one seen Struts ever
used in that way?
]]
 

One approach to evaluate would be using XML-based data exchanges between 
your Java client and the server webapp.  You can see pointers to several 
Struts based extensions in this space at:

 http://struts.sourceforge.net/community/views.html

Craig

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


Retaining Textbox values even after form submit

2004-04-17 Thread Nilesh
In my Struts application I am implementing Search, It is working fine with the 
relevant results being displayed.
In the result page I again have the same SearchForm.
The user can search any number of times because he is always provided with SearchForm.
I want to retain (display ) the last searched text in the resultpage textbox.
Does Struts provide any facility for this or do I need to  use a bean or something 
like that.
Please suggest options.

Thanks in advance, for your interest in answering my question

Regards,
Nilesh.


Re: Converting DTO into formBean and vice versa

2004-04-17 Thread Adam Hardy
String - java.sql.Date is possible with BeanUtils. Write a plugin to
register a Converter with ConvertUtils at app startup.
Actually I believe there are skeleton classes for LocaleBeanUtils to do
what you want, but they haven't been programmed yet. Perhaps you should
check on jakarta about their status. Somebody might have done it.
I had this issue a year ago or so and due to time constraints I dropped
the localized dates and I force my users to enter date format -MM-DD.
Adam

On 04/14/2004 08:16 PM Stjepan Brbot wrote:
I have DTO (transfering the data from my EJB) with the following
fields:
id (java.lang.Integer), name (java.lang.String), birth
(java.sql.Date)
also I have a ActionForm bean with the same fields but of String
types:
id (java.lang.String), name (java.lang.String), birth
(java.lang.String)
my web application implements I18N and deals with German and English
locales so when user must insert a date in HTML form german user
inserts the date into String field of ActionForm bean in dd.mm.
format (according to DateFormat (MEDIUM) of de locale) and english
user inserts the date in mm/dd/ format (according to DateFormat
(MEDIUM) of en locale).
To transfer all data fields from FORM into DTO where I do not have
date field I can use:
BeanUtils.copyProperties(myDto,myActionForm)

Now I'd like to have the similar functionlity where I will be able to
have java.sql.Date field in my DTO object providing BeanUtils with
particular DateFormat of current Locale. Is there anything like that?
E.g. LocaleBeanUtils(myDto,myActionForm,dateFormat)?
Stjepan Brbot

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



--
struts 1.2 + tomcat 5.0.19 + java 1.4.2
Linux 2.4.20 Debian


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


Pls help on request parameter

2004-04-17 Thread sougata
Hi Guys,
I am facing a problem.I have a country drop down.I am showing the
corresponding country details from the drop downs options selected.Now I
have a country name like
 Nepal  Bhutan When I am trying to get the value of the country name
using request.getParameter(country) it is showing only Nepal.Is there any
way to solve.Pls help me
Thanks
Sougata



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



Re: Pls help on request parameter

2004-04-17 Thread birendar . waldiya

User  URLEncoder and URLDecoder
to encode  decode the variable wher the paramater are having
character  etc ..
BTW Nepal  Bhutan aret ow
separate country.

Birendar Singh Waldiya






sougata [EMAIL PROTECTED]

17-04-04 05:16 PM




Please respond to
Struts Users Mailing List [EMAIL PROTECTED]





To
Struts Users Mailing
List [EMAIL PROTECTED]


cc



Subject
Pls help on request parameter








Hi Guys,
I am facing a problem.I have a country drop down.I am showing the
corresponding country details from the drop downs options selected.Now
I
have a country name like
 Nepal  Bhutan When I am trying to get the value of the
country name
using request.getParameter(country) it is showing only Nepal.Is
there any
way to solve.Pls help me
Thanks
Sougata



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


ForwardSourceID:NT4326
 
DISCLAIMER: The information contained in this message is intended only and solely for 
the addressed individual or entity indicated in this message and for the exclusive use 
of the said addressed individual or entity indicated in this message (or responsible 
for delivery
of the message to such person) and may contain legally privileged and confidential 
information belonging to Tata Consultancy Services. It must not be printed, read, 
copied, disclosed, forwarded, distributed or used (in whatsoever manner) by any person 
other than the addressee. 
Unauthorized use, disclosure or copying is strictly prohibited and may constitute 
unlawful act and can possibly attract legal action, civil and/or criminal. The 
contents of this message need not necessarily reflect or endorse the views of Tata 
Consultancy Services on any subject matter.
Any action taken or omitted to be taken based on this message is entirely at your risk 
and neither the originator of this message nor Tata Consultancy Services takes any 
responsibility or liability towards the same. Opinions, conclusions and any other 
information contained in this message 
that do not relate to the official business of Tata Consultancy Services shall be 
understood as neither given nor endorsed by Tata Consultancy Services or any affiliate 
of Tata Consultancy Services. If you have received this message in error, you should 
destroy this message and may please notify the sender by e-mail. Thank you.


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

Re: [OT] Oracle JDev 10g Final (9.0.5.1 build 1605) is out!

2004-04-17 Thread Erik Price
On Apr 14, 2004, at 4:24 AM, Christian Bollmeyer wrote:

Finally!

http://otn.oracle.com/software/products/jdev/index.html (249MB)

-- Chris
No MacOSX version?

:(



--
Erik Price
http://erikprice.com/

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


RE: javascript -check all

2004-04-17 Thread Kruse, Matt
but i ahve a jsp using struts that has a table with rows.each row has a
check box.I have a checkbox at the top of the table, clicking which, i
want all below checkboxes to be checked..has anyone implemented this
code..

I have a javascript library which makes this functionality very easy to
implement: http://www.mattkruse.com/javascript/checkboxgroup/

Hope that helps,

Matt


Re: Pls help on request parameter

2004-04-17 Thread Prashanth.S
hi...
this is because when u forward to next page ur request parameter will go as 
country=nepalbhutan but it will be interpreted as country=nepalbhutan
where country and bhutan becomes 2 name pairs...so urlencode  that value and than 
decode it
cheers
prashanth


sougata [EMAIL PROTECTED] wrote:
Hi Guys,
I am facing a problem.I have a country drop down.I am showing the
corresponding country details from the drop downs options selected.Now I
have a country name like
Nepal  Bhutan When I am trying to get the value of the country name
using request.getParameter(country) it is showing only Nepal.Is there any
way to solve.Pls help me
Thanks
Sougata



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


-
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th

Re: Strange problem with the validator.

2004-04-17 Thread Nathan Maves
No ... it was the fact that I was missing the resource=false 
attribute.  So the validator was looking for the var:maxLength key in 
the application.properties which of course is not there.

Nathan

On Apr 17, 2004, at 6:02 AM, Erik Price wrote:

But what was it, for the sake of the archives?  It wasn't the fact 
that the L in maxLength wasn't capitalized, was it?  (Because this 
recently bit one of our developers, as apparently JavaScript expects 
it to be capitalized [even though IIRC XHTML says it shouldn't be].)

Erik

On Apr 14, 2004, at 6:15 PM, Nathan Maves wrote:

Never mind!  found the problem...  one of those ID10T  errors.

Nathan
On Apr 14, 2004, at 3:33 PM, Nathan Maves wrote:
Anyone know why the error message does not show the maxlength 
argument.

# Purpose can not be greater than characters.
# Description can not be greater than characters.
notice it places the first argument (name of the field) but not the 
max length.

from the validation.xml

field property=purpose depends=required, maxlength
arg0 key=request.purpose /
arg1 name=maxlength key=${var:maxlength} /
var
var-namemaxlength/var-name
var-value2000/var-value
/var
/field


form-bean name=requestForm 
type=org.apache.struts.validator.DynaValidatorActionForm
form-property name=name type=java.lang.String /
form-property name=description 
type=java.lang.String /
form-property name=purpose type=java.lang.String /
form-property name=format type=java.lang.String /
form-property name=status type=java.lang.String /
form-property name=queueId type=java.lang.String /
form-property name=id type=java.lang.String /
/form-bean

action path=/Submit 
type=reporting.request.presentation.actions.SubmitRequest 
name=requestForm scope=request validate=true 
input=.request.Form
forward name=success redirect=true 
path=/Welcome.do /
forward name=view redirect=true path=/View.do /
/action

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





--
Erik Price
http://erikprice.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: basic problem in java

2004-04-17 Thread David Friedman
  What is your CLASSPATH variable set to and is java installed in
c:\biren\java?

  Regards,
  David
  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
  Sent: Saturday, April 17, 2004 2:47 AM
  To: Struts Users Mailing List
  Subject: basic problem in java



  Hi,
   this may be  a slightly silly question for  people working on struts etc
but im facing it and i dont have the clue why im getting it.. can anyone
suggest me  why im getting proble..
  while compiling a java program  my javac is unable to resolve the standard
java classes  like  java.io.*   java.util.* ;


  C:\biren\javajavac jaba1.java
  jaba1.java:2: cannot resolve symbol
  symbol  : class io
  location: class java
  import java.io.*;

  whats  the problem  please help !
  ^
  Birendar Singh Waldiya


Detrmining which module from within JSP

2004-04-17 Thread Josh Holtzman
Hello,

 

Can anyone suggest a means to determine the current struts application
module from within a JSP?  

 

Would it be possible to use a Bean or Logic tag to make this determination?

 

Thanks again for any suggestions.

 

Regards,

 

Josh Holtzman

American Data Company

[EMAIL PROTECTED]

Voice: (310) 470-1257

Fax:(310) 362-8454

 

Sun Microsystems iForce Partner

 



Re: [OT] Oracle JDev 10g Final (9.0.5.1 build 1605) is out!

2004-04-17 Thread Christian Bollmeyer
On Saturday 17 April 2004 14:13, Erik Price wrote:
 On Apr 14, 2004, at 4:24 AM, Christian Bollmeyer wrote:
  Finally!
 
  http://otn.oracle.com/software/products/jdev/index.html (249MB)
 
  -- Chris

 No MacOSX version?

  :(

Hi Erik,

though MacOS X is not an officially supported platform, it should
still run fine if you have a 1.4.2 JSDK installed. This OTN thread

http://forums.oracle.com/forums/thread.jsp?forum=134thread=221840message=614003

should get you started. From what I can see, people ran
into some minor problems, but that was the preview
version which also had some problems with Linux which
are gone now. I would give it a try. Basically, JDev 10g is
an 'xcopy' install; everything comes in a huge .zip archive
and only has to be extracted to some directory. Then find
the /jdev/bin subdir and check jdev.conf. Uncomment the
line starting with SetJavaHome (in my version, it's line 94)
and change it to pointing at your JAVA_HOME. That should
be it. After all, I'm running the Windows version this way
at home under SuSE 9.0, for I didn't want to download twice,
and I strongly suspect all those different versions just contain
the same files in the end. So I ended up with a surplus
Windows JSDK (in the /jdk subdir) which can be safely
deleted under Linux, but otherwise it runs just perfectly.

HTH,
-- Chris

NB. If you look closer at the /jdev/bin directory, there
even is a mysterious file named jdev-Darwin.conf.
Sounds kind of Apple-related to me :-) 

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



Re: tiles and custom RequestProcessor

2004-04-17 Thread Dean A. Hoover
Sorry, I should probably have included the exception:

javax.servlet.ServletException: TilesPlugin : Specified RequestProcessor not 
compatible with TilesRequestProcessor

org.apache.struts.tiles.TilesPlugin.initRequestProcessorClass(TilesPlugin.java:360)
org.apache.struts.tiles.TilesPlugin.init(TilesPlugin.java:164)

org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:1158)
org.apache.struts.action.ActionServlet.init(ActionServlet.java:473)
javax.servlet.GenericServlet.init(GenericServlet.java:256)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:339)
org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:415)
org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:716)
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:650)
org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:829)

org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:688)
java.lang.Thread.run(Thread.java:536)
Dean A. Hoover wrote:

I am using tiles *and* I want to use a custom
RequestProcessor to handle HttpSession stuff.
It seems that tiles uses its own request processor.
I wrote a simple subclass of RequestPorcessor
and configured as follows:
controller contentType=text/html;charset=UTF-8 nocache=true
 processorClass=fi.els.util.SessionRequestProcessor/
 message-resources parameter=resources.application/

 plug-in className=org.apache.struts.tiles.TilesPlugin
   set-property property=definitions-config
 value=/WEB-INF/tiles-defs.xml/
   set-property property=moduleAware value=true/
   set-property property=definitions-parser-validate value=true/
 /plug-in
How can I get in front of the tiles request processor?
Dean Hoover
-
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: JSTL + isUserInRole

2004-04-17 Thread Christian Bollmeyer
On Friday 16 April 2004 21:58, Paulo Alvim wrote:
 Hi!

 Is it possible to test isUserInRole using JSTL 1.0 (like the struts
 logic present role tag)?

 Thanks in Advance...

 Alvim.

Hi,

AFAIK that's not possible in plain JSTL, so your options
are either to use scriptlets or stick to the logic tags.
An alternative approach would be the ora:ifUserInRole
tag that accompanies Hans Bergsten's excellent JSP book
(O'Reilly). If you don't have it, you can still download
the sources from www.thejspbook.com. Respecting
Hans' copyright, I won't post the code here; all I can
tell is that it's not longer than 42 lines (including
comments).

HTH,
-- Chris

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



Re: html:form

2004-04-17 Thread Christian Bollmeyer
On Saturday 17 April 2004 05:13, as as wrote:
 Hi

 Has anyone implemented two html:form in a same jsp..

 I wish to do this to implement two tables.each table displaying
 values in a row, of a bean...

 so there are two beans...

 for some reason, it gives me error saying it cnat find getter for my
 second bean...though I did add getters and setters for all attributes
 in my struts form class.

 thanks in advance for the help,

 Sam

Hi,

could well be I'm not fully understanding the exact problem again,
but generally, two htlm:forms in a single JSP page are no
problem. The one you submit ends up in the request, and
html:form gets renderered to just a normal HTML form
tag in the end. On to the beans. I'm not sure what kind of
bean you mean here. If it's the form bean (and it's the same
table), try referring to it in your second html:form via
the token you used for the first one. If we're talking about
two different beans here, you have to make sure both of
them are actually there and bear different token names.
In this case, you have to manually create the 'second'
instance and put it in request or whatever scope so that
it can be found.

HTH,
-- Chris.
   

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



RE: Retaining Textbox values even after form submit

2004-04-17 Thread Khalid K.
You can presist the lastSearchTerm in HttpSession and update your form
object with it.

In Action something like

If(session.getAttribute(lastSearchTerm) != null)
myform.setSearchTerm((String)
session.getAttribute(lastSearchTerm));


-Original Message-
From: Nilesh [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 16, 2004 1:57 AM
To: Struts Users Mailing List
Subject: Retaining Textbox values even after form submit


In my Struts application I am implementing Search, It is working fine with
the relevant results being displayed. In the result page I again have the
same SearchForm. The user can search any number of times because he is
always provided with SearchForm. I want to retain (display ) the last
searched text in the resultpage textbox. Does Struts provide any facility
for this or do I need to  use a bean or something like that. Please suggest
options.

Thanks in advance, for your interest in answering my question

Regards,
Nilesh.

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.659 / Virus Database: 423 - Release Date: 4/15/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.659 / Virus Database: 423 - Release Date: 4/15/2004
 


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



RE: Struts Application Security within the Controller Layer

2004-04-17 Thread Josh Holtzman
Joe,

Your suggestion sounds interesting, but I'm not sure if I fully understand
it.

Correct me if I'm wrong.  

You suggest extending the ActionMapping class and adding the fields to this
class that I will need for checking the user group that may access this
path/resource.  Let's say this is a simple application, and there is an
integer or string that is stored, identifying the access level to this
resource.  So, when this class is built, would it represent an action within
my struts config file, and with the changes permit me to somehow specify the
permission level that has access to the action?

I'm a little confused about the SecureActionMapping interface you
mentioned.

However, if what you are suggesting is that the extended ActionMapping would
now contain the role that has access to this action, I could then extend the
RequestProcessor to inspect the permitted user group that is stored in the
new ActionMapping class, and compare it to the permission level stored in
the User's session.  If these don't agree with one another, the user does
not have access to the path/resource, and will be directed to an error page.

Is this what you had in mind?  If so, I'm still a little confused about how
to extend the ActionMapping so it would contain the correct permission level
info for access to the resource.  How/where would this information be
configured.  I think you might be suggesting additional XML elements or
attributes may be added to the Action element in the StrutsConfig file, but
I'm not sure.

Please let me know your thoughts.  Everyone else is also free to comment.

Regards,

Josh

-Original Message-
From: Joe Germuska [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 16, 2004 9:07 AM
To: Struts Users Mailing List
Subject: RE: Struts Application Security within the Controller Layer

The way to configure this flexibly for each action would be to define 
an extension of ActionMapping that was a bean with whatever config 
properties you need (for instance, a role or list of roles permitted 
to access the action.)  Of course, since each path gets only one 
ActionMapping, you may need to use a SecureActionMapping interface 
that you could implement with various mapping classes.  (It seems to 
take Struts users a while to get into the idea of using ActionMapping 
to provide extended configuration information to an Action class, but 
it can be a very nice way to avoid re-coding the same logic over and 
over.)

Once you have this, you could either find another spot in the request 
processor to enforce this logic (very easy with a chainable 
processor, of course), or use a SecureAction base class from which 
you extend for any paths which must be controlled, which would do 
authorization before passing control to the subclass.

Joe


I'll look into the ComposableRequestProcessor for future projects.  This
seems like it could be a very powerful feature, if used correctly.

Since we are on the subject of Control and security, let me throw in
another
question. 

My application has three different user permission levels.
1) User
3) Super User
2) Admin

Each account in the DATABASE is classified with one of these permission
levels.

I want to also inspect each request before an Action is dispatched to
confirm that the User should be granted access to execute the Action.

At first thought, it seems that I cannot use the processRoles() feature of
the RequestProcessor, because my permission levels are not stored into the
config file, but rather in the database.  Or should I say, I cannot take
this approach without overriding this method (which may be a solid
approach.. but I haven't thought it out much. I imagine this would require
a
way for me to map each action with the correct access groups).

I could put this logic into each Action class, but, for obvious reasons,
this will be a maintenance nightmare.

Can anyone offer any suggestions on these or other approaches? 

Your assistance is greatly appreciated as it always is.

-- 
Joe Germuska
[EMAIL PROTECTED]  
http://blog.germuska.com
   Imagine if every Thursday your shoes exploded if you tied them 
the usual way.  This happens to us all the time with computers, and 
nobody thinks of complaining.
 -- Jef Raskin

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


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



Re: Struts Application Security within the Controller Layer

2004-04-17 Thread Niall Pemberton
You don't need to add additional XML elements to the Action in the
struts-config.xml to use a custom ActionMapping

If you create your own custom ActionMapping with an additional
securityLevel property:


public class MyActionMapping extends ActionMapping {

   protected String securityLevel;

   public void setSecurityLevel(String securityLevel) {
  this.securityLevel = securityLevel;
   }

   public String getSecurityLevel() {
   return securityLevel;
   }

}

The in your struts-config.xml you can configure struts to use your custom
mapping using the type on the action-mappings element and set the new
attribute for one of your actions using set-property:

action-mappings type=mypackage.MyActionMapping 

action path=myPathValue name=myForm
set-property property=securityLevel  value=high/
/action

/action-mappings


Niall

- Original Message - 
From: Josh Holtzman [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Sent: Saturday, April 17, 2004 10:41 PM
Subject: RE: Struts Application Security within the Controller Layer


 Joe,

 Your suggestion sounds interesting, but I'm not sure if I fully understand
 it.

 Correct me if I'm wrong.

 You suggest extending the ActionMapping class and adding the fields to
this
 class that I will need for checking the user group that may access this
 path/resource.  Let's say this is a simple application, and there is an
 integer or string that is stored, identifying the access level to this
 resource.  So, when this class is built, would it represent an action
within
 my struts config file, and with the changes permit me to somehow specify
the
 permission level that has access to the action?

 I'm a little confused about the SecureActionMapping interface you
 mentioned.

 However, if what you are suggesting is that the extended ActionMapping
would
 now contain the role that has access to this action, I could then extend
the
 RequestProcessor to inspect the permitted user group that is stored in the
 new ActionMapping class, and compare it to the permission level stored in
 the User's session.  If these don't agree with one another, the user does
 not have access to the path/resource, and will be directed to an error
page.

 Is this what you had in mind?  If so, I'm still a little confused about
how
 to extend the ActionMapping so it would contain the correct permission
level
 info for access to the resource.  How/where would this information be
 configured.  I think you might be suggesting additional XML elements or
 attributes may be added to the Action element in the StrutsConfig file,
but
 I'm not sure.

 Please let me know your thoughts.  Everyone else is also free to comment.

 Regards,

 Josh

 -Original Message-
 From: Joe Germuska [mailto:[EMAIL PROTECTED]
 Sent: Friday, April 16, 2004 9:07 AM
 To: Struts Users Mailing List
 Subject: RE: Struts Application Security within the Controller Layer

 The way to configure this flexibly for each action would be to define
 an extension of ActionMapping that was a bean with whatever config
 properties you need (for instance, a role or list of roles permitted
 to access the action.)  Of course, since each path gets only one
 ActionMapping, you may need to use a SecureActionMapping interface
 that you could implement with various mapping classes.  (It seems to
 take Struts users a while to get into the idea of using ActionMapping
 to provide extended configuration information to an Action class, but
 it can be a very nice way to avoid re-coding the same logic over and
 over.)

 Once you have this, you could either find another spot in the request
 processor to enforce this logic (very easy with a chainable
 processor, of course), or use a SecureAction base class from which
 you extend for any paths which must be controlled, which would do
 authorization before passing control to the subclass.

 Joe


 I'll look into the ComposableRequestProcessor for future projects.
This
 seems like it could be a very powerful feature, if used correctly.
 
 Since we are on the subject of Control and security, let me throw in
 another
 question.
 
 My application has three different user permission levels.
 1) User
 3) Super User
 2) Admin
 
 Each account in the DATABASE is classified with one of these permission
 levels.
 
 I want to also inspect each request before an Action is dispatched to
 confirm that the User should be granted access to execute the Action.
 
 At first thought, it seems that I cannot use the processRoles() feature
of
 the RequestProcessor, because my permission levels are not stored into
the
 config file, but rather in the database.  Or should I say, I cannot take
 this approach without overriding this method (which may be a solid
 approach.. but I haven't thought it out much. I imagine this would
require
 a
 way for me to map each action with the correct access groups).
 
 I could put this logic into each Action class, but, for obvious reasons,
 

Re: Retaining Textbox values even after form submit

2004-04-17 Thread Craig McClanahan
Nilesh wrote:

In my Struts application I am implementing Search, It is working fine with the relevant results being displayed.
In the result page I again have the same SearchForm.
The user can search any number of times because he is always provided with SearchForm.
I want to retain (display ) the last searched text in the resultpage textbox.
Does Struts provide any facility for this or do I need to  use a bean or something like that.
Please suggest options.
 

The simplest thing would be to make the form bean for your search form 
be in session scope instead of request scope -- then it will retain its 
field value(s) in between requests with no extra work.

Thanks in advance, for your interest in answering my question

Regards,
Nilesh.
 

Craig

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


Re: Detrmining which module from within JSP

2004-04-17 Thread Craig McClanahan
Josh Holtzman wrote:

Hello,



Can anyone suggest a means to determine the current struts application
module from within a JSP?
As long as you have correctly gone through an action first, the 
ModuleConfig object for the selected
module has been stored as a request attribute under the key 
org.apache.struts.action.MODULE (from Java code, you would use 
Globals.MODULE_KEY to reference this string).  So, you could say 
something like this in a JSP page:

 The current module prefix is
 bean:write name=org.apache.struts.action.MODULE property=prefix/
The Javadocs for org.apache.struts.Globals describe many other attribute 
names that Struts uses to store interesting things while processing a 
request.

 



Would it be possible to use a Bean or Logic tag to make this determination?



Thanks again for any suggestions.



Regards,



Josh Holtzman

 

Craig

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


A better exception-handling strategy?

2004-04-17 Thread Frank Burns
I want to have a consistent display of exceptions that occur in my
Struts-based applciation.

For exceptions that occur in my Action classes, I use the declarative
exception handling mechanism and forward to a set of exception pages that
I have created. However, the declarative exception handling mechanism is
only applicable to Action classes.

My problem is that I call some JSPs that utilize beans (via JSTL) that have
getter methods which perform database access. These getter methods can
generate exceptions. When these exceptions occur I'd like to display one of
the set of exception pages that I've created.

The best solution I have thought of so far is to place JSTL catch tags
into the JSPs and when they catch exceptions I use a JSTL redirect tag to
redirect to one of my exception pages.

It works. But is there a better strategy than this?

Thanks,

Frank


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



Re: A better exception-handling strategy?

2004-04-17 Thread Craig McClanahan
Frank Burns wrote:

I want to have a consistent display of exceptions that occur in my
Struts-based applciation.
For exceptions that occur in my Action classes, I use the declarative
exception handling mechanism and forward to a set of exception pages that
I have created. However, the declarative exception handling mechanism is
only applicable to Action classes.
My problem is that I call some JSPs that utilize beans (via JSTL) that have
getter methods which perform database access. These getter methods can
generate exceptions. When these exceptions occur I'd like to display one of
the set of exception pages that I've created.
The best solution I have thought of so far is to place JSTL catch tags
into the JSPs and when they catch exceptions I use a JSTL redirect tag to
redirect to one of my exception pages.
It works. But is there a better strategy than this?
 

You might want to experiment with the standard exception mapping 
facilities that web.xml supports, for use whenever an exception ripples 
all the way up to the servlet container.  For example, you can deal with 
any NPE that gets thrown with an entry like this:

 error-page
   exception-typejava.lang.NullPointerException/exception-type
   location/error-page.jsp/location
 /error-page
Thanks,

Frank

 

Craig

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


what should i do to set the session in the pageContext in a Action class?

2004-04-17 Thread Ricky Lee
hi, thanks for reading..

i have a problem about set the seesion(pageContext) in
the action class.. 

i know that set the seesion in the request, just like 
request.getSession().setAttribute(login_username,userForm.getUsername());

and in the JSP page, we can use the code to get the
seesion:

%=request.getSession().getAttribute(login_username)%

but, i want to use the pageContext to set the session
so as to load the attribute in JSTL 

c:if test=${}}.../c:if

if i use c:if test=${session.login_username ==
null}.../c:if  it can't work...

because there isn't login_username in the session
pageContext.

if i use c:if
test=${request.getSession().getAttribute(login_username)
== null}../c:if

it still cause a errorsyntax error...

i know in the custom taglib, we can use the the

 pageContext.setAttribute(String,Object,scope) the
scope can set to session

and in the JSP page, we can use the JSTL to get the
attribute..


but in the Action class , there isn't pageContext
object to set the session in the pageContext, just has
the request to set pageContext, what should i do to
set the session in the pageContext?


please help methanks! 






__
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25ยข
http://photos.yahoo.com/ph/print_splash

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