RE: Help needing regarding implementing JAAS for a Web application

2002-04-03 Thread Mike Finn

Sudhir,
Are you deploying your webapp outside of WebLogic? The answer to your
question really depends on the web container you are using. For example, I
don't *think* there is any 'production' ready support for a JAAS Realm in
Tomcat. If you are deploying to the WebLogic web container, then RTFM the
WebLogic security docs. They are pretty good. JAAS is an integral part of
J2EE and is provided by the container ( I don't think WL 6.x provides
*authorization* with their JAAS implementation, however  - only
authentication ). If you are using/can use container security, there should
be no need to write your own LoginContext and callback handler, AFAIK. Also,
if you are using container (declarative) security, if your security
requirements are simple enough, you won't have to write ANY code. That's the
idea behind JAAS being in the J2EE spec.

BTW - your JAAS config file is located by
using: -Djava.security.auth.login.config=file://path/to/a/config/file on the
command line.

HTH,
Mike


-Original Message-
From: Sudhir S. Shetty [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 03, 2002 7:20 AM
To: Struts Users Mailing List
Subject: Help needing regarding implementing JAAS for a Web application


Hello Everyone,
 I need your help regarding Implementing JAAS for a
web app based on Struts, I have made a class which instantiates the Login
context, and has an inner class callback handler(for receiving  the user
name and password).
But I get an error when the login context is instantaiated , that the Config
file cant be found.
Could anyone please send me some code which depicts clearly how JAAS can be
implemented in a Web app (my application server is Weblogic).
I need it urgently as I have a deadline to meet.
Thanks in advance,
regards,
Sudhir


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



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




RE: Struts 1.0.2 checkbox - Error Message: No collection found

2002-04-02 Thread Mike Finn

Yanhui,

I too am still having this problem. When there is data in the Collection,
_it works_. When no data/empty, I get the JspException: No collection found
error - even when wrapped with present tag. Hard to believe we're the only
ones having this issue. Makes me think it's us, but what could it be?

Frag from JSP:
logic:present name=OrderForm property=svcEquips/
  logic:iterate name=OrderForm property=svcEquips id=svcEquip
bean:write name=svcEquip property=some key/
  /logic:iterate
logic:present/

The parent form (OrderForm):
  .
  public void
setSvcEquips(com.frontiercorp.bss.cap.proto.bpo.web.OrderSvcEquipForm[]
svcEquips)
  {  this.svcEquips = svcEquips;  }

  public com.frontiercorp.bss.cap.proto.bpo.web.OrderSvcEquipForm[]
getSvcEquips()
  {  return svcEquips;  }
  
}

(Most of) the stack trace:
13:19:09,557 ERROR [EmbeddedCatalinaServiceSX] - Root Cause -
javax.servlet.jsp.JspException: No collection found
at
org.apache.struts.taglib.logic.IterateTag.doStartTag(IterateTag.java:305)
at
org.apache.jsp.oe_0005fsvcequip$jsp._jspService(oe_0005fsvcequip$jsp.java:22
0)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:202)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:683)   at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatch
er.java:431)
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher
.java:355)
at
org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.ja
va:1759)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1596)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)

Anyone have any clues? This is Struts 1.0.2.

Frustrated,
Mike

-Original Message-
From: Yu, Yanhui [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 2:13 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Struts 1.0.2 checkbox - Error Message: No collection found


Thanks for quite a few very kind people who spent a lot of time trying to
help, but I've not found the solution yet.  Here is our problem again,
please help us if you find a way to solve this problem:

1. There is a class called ConflictBean which has a few String attributes
and a boolean attribute called isChecked to record if the jsp user checked
this bean.
2. The Action constructs a few of these ConflictBean objects, stores them in
an ArrayList, then sets this ArrayList in the ActionForm bean.
3. The JSP page iterates through the ArrayList to build a table so that each
row of this table represents an element  on the ArrayList (a ConflictBean
object).  All the attributes of the ArrayList element, the ConflictBean
object are displayed in different column (cells) of this row.  A checkbox is
provided somewhere in each row (say in the most left column) so that the
user can view all the rows, then he can select all/some/none of the rows
(the ConflictBean objects).  After the form was submitted, the Action needs
to get the list back out and see which ConflictBean were checked.

Please tell us if we have to use an indexed property such as the checkbox in
the newer version to accomplish this or there is a way to do it with version
1.0.2?  Answering this question will point us to the right direction.
THANKS!

Yanhui





-Original Message-
From: Yu, Yanhui
Sent: Wednesday, March 27, 2002 12:03 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Struts 1.0.2 checkbox - Error Message: No collection found


Sorry I forgot that the reset method in the ActionForm looks like this:
==
public void reset(ActionMapping mapping, HttpServletRequest request)
{
cat.debug(ConflictResolutionForm reset);
/*
this.checked = false;
this.linenum = null;
this.field = null;
this.level = null;
this.currentValue = null;
this.overrideValue = null;
*/

 if(conflicts != null) {
for(int i=0; i conflicts.size(); i++) {
((ConflictBean) conflicts.get(i)).setChecked(false);
}
}
}
==
Looking forward to hearing any hints, thank you very much,
Yanhui



-Original Message-
From: Yu, Yanhui
Sent: Wednesday, March 27, 2002 12:00 PM
To: [EMAIL 

RE: Struts Config Problem - Ryan Norman

2002-03-28 Thread Mike Finn

Ryan,

Please include more detail than  it is not working, like what the error or
exception thrown is. Otherwise we can't help troubleshoot.

Also, if it's an option, you may want to take a look at declarative
security. The container manages the authentication and authorization
procedures. You have an option of FORM (HTML login form, in which you
basically post j_username and j_password to j_security_check), or BASIC, in
which case the user is prompted by the browser (popup window) for user and
passwd.

Mike

-Original Message-
From: Ryan Norman [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 7:42 PM
To: [EMAIL PROTECTED]; LA Java User Group
Subject: Struts Config Problem - Ryan Norman


Hi All,

I am Ryan Norman

I am trying to put together a simple sample application.
Right now I have a login page upon submitting the user name and password I
want it to be transferred
to another page.

For some reason, it is not working.

Can somebody help me with this?

I am pasting my code and struts-config.xml file contents.

Thanks in advance

struts-config.xml

?xml version=1.0 encoding=ISO-8859-1 ?

!DOCTYPE struts-config PUBLIC
  -//Apache Software Foundation//DTD Struts Configuration 1.0//EN
http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd;

!--
 This is a blank Struts configuration file based on the example
application,
 with commented examples of some items.

 NOTE: If you have a generator tool to create the corresponding Java
classes
 for you, you could include the details in the form-bean declarations.
 Otherwise, you would only define the form-bean element itself, with
the
 corresponding name and type attributes, as shown here.
--

struts-config
  !-- == Data Source Configuration
=== --
  data-sources
data-source autoCommit=false description=Struts Test1 DB
  driverClass=sun.jdbc.odbc.JdbcOdbcDriver maxCount=4 minCount=2
password=TIGER url=jdbc:odbc:DEVELOPMENT
user=SCOTT /
  /data-sources

  !-- == Form Bean Definitions
=== --
  form-beans
!-- Example logon form bean --
   form-bean name=loginForm type=strutstest1.LoginForm/
  /form-beans

  !-- == Global Forward Definitions
== --
  global-forwards
   !-- Example logon forward --
   forward name=login path=/login.jsp/
forward name=failure path=/login.jsp/
forward name=success path=/mainmenu.jsp/
  /global-forwards

  !-- == Action Mapping Definitions
== --
  action-mappings
!-- Example logon action --
action path=/login type=strutstest1.LoginAction
  name=loginForm scope=request input=/login.jsp
/action

!-- The standard administrative actions available with Struts --
!-- These would be either omitted or protected by security --
!-- in a real application deployment --
action path=/admin/addFormBean
type=org.apache.struts.actions.AddFormBeanAction/
action path=/admin/addForward
type=org.apache.struts.actions.AddForwardAction/
action path=/admin/addMapping
type=org.apache.struts.actions.AddMappingAction/
action path=/admin/reload
type=org.apache.struts.actions.ReloadAction/
action path=/admin/removeFormBean
type=org.apache.struts.actions.RemoveFormBeanAction/
action path=/admin/removeForward
type=org.apache.struts.actions.RemoveForwardAction/
action path=/admin/removeMapping
type=org.apache.struts.actions.RemoveMappingAction/

  /action-mappings
/struts-config

LoginAction.java

package strutstest1;

import java.io.PrintWriter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;

public class LoginAction extends Action
{
 public ActionForward perform( ActionServlet servlet,
   ActionMapping mapping,
  ActionForm form,
  javax.servlet.http.HttpServletRequest request,
  javax.servlet.http.HttpServletResponse response )
  {
  String userID = ;
String password = ;

PrintWriter out = null;

   ActionForward actionForward = null;

try
{
 userID = ( ( LoginForm ) form ).getUserID();
 password = ( ( LoginForm ) form ).getPassword();

  out = response.getWriter();

  out.println( User ID  = [ + userID + ] br );
  out.println( Password = [ + password + ] br );
}
catch( Exception error )
{
 System.out.println( Error Occurred:  + error.toString() );
}

actionForward = mapping.findForward( success );

return( actionForward );
  }
}


LoginForm.java
===
package strutstest1;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import 

logic:iterate and no collection found

2002-03-27 Thread Mike Finn



Hi 
All,

I have a 
form with an array of subforms on it, like so:

class 
BigForm extends ActionForm
{
SubForm subFormX[];

public SubForm[] getSubFormX() { return 
subFormX; }
public void setSubFormX(SubForm[] 
newSubFormX) { this.subFormX = newSubFormX; }
// 
other attributes...
}

When this 
has no data in it, and I use iterator on it, like so: 
(assume 
"TheBigForm" is declared w/ type BigForm in 
struts-config.xml)

logic:iterate name="TheBigForm" property="subFormX" 
id="subForm"
bean:write 
property="subFormPropOne" name="subForm"/
/logic:iterate

I get "No 
Collection found" ServletException. The BigForm is in request scope, and 
in fact if I force-feed it with data, everything works OK. I also wrapped the 
iterate block with logic:present to no avail:
logic:present name="TheBigForm" 
property="subFormX"
...
/logic:present

Also, I 
initialized the array to new SubFormX[0] - again, no luck.

What is 
the correct way to handle this situation - where you have a sub or child form 
with an empty array?

TIA,
Mike

 


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


RE: Why Struts - Ryan Norman

2002-03-27 Thread Mike Finn

Ryan,

1) There may be MVC frameworks available as value-adds to WebSphere,
WebLogic, etc. They may not port from one app server to another. Struts
should run in any JSP/Servlet spec-compliant web container. With proprietary
frameworks, you risk getting precisely what many hope to avoid by
implementing J2EE solutions: vendor lock-in. Plus, with Struts, you have the
(IMHO) benefits of Open Source.

2) We are using Struts with JBoss 3.0b/Tomcat 4.02 integrated.

Mike

-Original Message-
From: Ryan Norman [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 12:48 PM
To: [EMAIL PROTECTED]; LA Java User Group
Subject: Why Struts - Ryan Norman


Hi,

I am Ryan Norman.

Are there frameworks available in other commercial Java Web Servers like Web
Sphere, iPlanet, JRun, etc.

. If so why should somebody use struts framework rather than using the Web
Server's native framework?
. Are there people who are using struts with commercial Java Web Server like
Web Sphere, iPlanet, JRun, etc.

Thanks in advance

Ryan Norman



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




RE: Struts 1.0.2 checkbox - Error Message: No collection found

2002-03-27 Thread Mike Finn

Yu,
This looks like the same problem I posted this AM (subject = logic:iterate
and no collection found). I found that if the array actually has data in
it, everything works OK. It's only when it's empty or null that it blows up.
Post if you find a solution and I will do the same. I am going to try to
step through the source this afternoon.
Mike

-Original Message-
From: Yu, Yanhui [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 1:03 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Struts 1.0.2 checkbox - Error Message: No collection found


Sorry I forgot that the reset method in the ActionForm looks like this:
==
public void reset(ActionMapping mapping, HttpServletRequest request)
{
cat.debug(ConflictResolutionForm reset);
/*
this.checked = false;
this.linenum = null;
this.field = null;
this.level = null;
this.currentValue = null;
this.overrideValue = null;
*/

 if(conflicts != null) {
for(int i=0; i conflicts.size(); i++) {
((ConflictBean) conflicts.get(i)).setChecked(false);
}
}
}
==
Looking forward to hearing any hints, thank you very much,
Yanhui



-Original Message-
From: Yu, Yanhui
Sent: Wednesday, March 27, 2002 12:00 PM
To: [EMAIL PROTECTED]
Subject: Struts 1.0.2 checkbox - Error Message: No collection found


Hi All,

We are using struts verions 1.0.2 here.  I have a problem using checkbox in
a jsp, getting No collection found error.  Here is my sample code and I
really appreciate if anyone can give me a hand on this.

in jsp
=
logic:iterate id=conflicts name=ConflictResolutionForm
property=conflicts
 type=com.pioneer.sales.terrmaint.demo.ConflictBean
tr
tdhtml:checkbox name=conflicts  property=checked
//td
tdbean:write name=conflicts property=field / /td
tdbean:write name=conflicts property=level / /td
tdbean:write name=conflicts property=currentValue
//td
tdbean:write name=conflicts property=overrideValue /
/td
/tr
/logic:iterate
===

in ConflictBean class

private String linenum = null;
private String field = null;
private String level = null;
private String currentValue = null;
private String overrideValue = null;
private boolean checked = false;

// all public getters and setters for all the String attributes

public boolean getChecked() {
return checked;
}
public void setChecked(boolean _checked){
checked = _checked;
}
==

in Action class
==
ConflictResolutionForm conFlictForm = new ConflictResolutionForm();
ArrayList conflicts = new ArrayList();
// Fill in the list here

ConflictBean cb = new ConflictBean();
cb.setLinenum(1);
cb.setField(Field 1);
cb.setLevel(Area);
cb.setCurrentValue(012345678);
cb.setOverrideValue(012345678);
conflicts.add(cb);

conFlictForm.setConflicts(conflicts);
return (mapping.findForward(conflictresolution));   //set up in
struts-config.xml


in ActionForm
=
private ArrayList conflicts = null;

public ArrayList getConflicts() {
return conflicts;
}

public void setConflicts(ArrayList _conflicts) {
conflicts = _conflicts;
}

public ConflictBean getConflicts(int index) {
return (ConflictBean) conflicts.get(index);
}

public void setConflicts(int index, ConflictBean conflict) {
conflicts.set(index,conflict);
}
==


Any help would be greatly appreciated.  What I did wrong here? Maybe
multibox is what I need?

Yanhui




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



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




iterate and no collection found

2002-03-26 Thread Mike Finn



Hi 
All,

I have a 
form with an array of subforms on it, like so:

class 
BigForm extends ActionForm
{
SubForm subFormX[];

public SubForm[] getSubFormX() { return 
subFormX; }
public void setSubFormX(SubForm[] 
newSubFormX) { this.subFormX = newSubFormX; }
// 
other attributes...
}

When this 
has no data in it, and I use iterator on it, like so: 
(assume 
"TheBigForm" is declared w/ type BigForm in 
struts-config.xml)

logic:iterate name="TheBigForm" property="subFormX" 
id="subForm"
bean:write 
property="subFormPropOne" name="subForm"/
/logic:iterate

I get "No 
Collection found" ServletException. The BigForm is in request scope, and 
in fact if I force-feed it with data, everything works OK. I also wrapped the 
iterate block with logic:present to no avail:
logic:present name="TheBigForm" 
property="subFormX"
...
/logic:present

Also, I 
initialized the array to new SubFormX[0] - again, no luck.

What is 
the correct way to handle this situation - where you have a sub or child form 
with an empty array?

TIA,
Mike
 




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