Re: ActionErrors configuration

2003-11-03 Thread Mikael Eriksson - Swedish Connection
You should have the name of the jsp with the form (or possible the
action that leads to the form page, with the .do extension) as the input.
So your action would have input=/systemDetails.jsp  if that is the
name of your jsp page.
Regards

At 13:10 2003-11-03 -0800, you wrote:
Hi,



I am trying to configure my app so that when some of the text fields are
not populated, I show errors and redisplay the same page. The
configuration I have is:


action path=/systemDetails
type=com.paycycle.profile.actions.SystemDetailsAction
name=systemDetailForm scope=request input=/systemDetails
.

/action



When I try to run the app with this configuration and there are errors,
I get:


The requested resource (/profile/systemDetails) is not available.



Can you help me out here?



Thanks,



Ramesh.


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


RE: ActionErrors configuration

2003-11-03 Thread Mikael Eriksson - Swedish Connection
Hi

That sound like another problem than what you wrote about first :-)
But anyway
ActionErrors has both an add(String, ActionMessage), defined in the
superclass ActionMessages, and an  add(String,ActionError) ,
defined in ActionErrors class which just calls the superclass version.
That call works fine sinse ActionError inherits from ActionMessage.
Regards

At 13:28 2003-11-03 -0800, you wrote:
Hi,

Turns out that even though the documentation says I should use
ActionErrors.add(String, ActionMessage), using (String, ActionError)
solved the problem! Any ideas why?
Ramesh.

-Original Message-
From: Mikael Eriksson - Swedish Connection [mailto:[EMAIL PROTECTED]
Sent: Monday, November 03, 2003 1:11 PM
To: Struts Users Mailing List
Subject: Re: ActionErrors configuration
You should have the name of the jsp with the form (or possible the
action that leads to the form page, with the .do extension) as the
input.
So your action would have input=/systemDetails.jsp  if that is the
name of your jsp page.
Regards

At 13:10 2003-11-03 -0800, you wrote:
Hi,



I am trying to configure my app so that when some of the text fields
are
not populated, I show errors and redisplay the same page. The
configuration I have is:



 action path=/systemDetails
type=com.paycycle.profile.actions.SystemDetailsAction
name=systemDetailForm scope=request input=/systemDetails

 .

 /action



When I try to run the app with this configuration and there are errors,
I get:



The requested resource (/profile/systemDetails) is not available.



Can you help me out here?



Thanks,



Ramesh.


-
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: ForwardAction not picking up Tiles defs?

2003-11-03 Thread Mikael Eriksson - Swedish Connection
One thing to try might be to use tile names that does not start with a dot.
I have done things that look pretty similar but the tilenames was things like
output.page1.  The parsing might get confused or by the starting '.'
My actions look like:
action path=/tiles_page1_in
   type=org.apache.struts.actions.ForwardAction
   parameter=output.page1 /
Regards

At 15:26 2003-11-03 -0600, you wrote:
I'm ripping my hair out here, guys ... what's going on with my config?! I 
can't see anything wrong in the debug output, yet Struts still is balking 
at actions that use the ForwardAction class and don't have a parameter 
that starts with a '/' ...

Please, please help!! (currently in begging mode, bribing is next :))

Ruth, Brice wrote:

OK, I have simplelog set to debug and I don't see any errors - it seems 
to parse my tiles-def.xml just fine, from what I can see.

?!?

Hubert Rabago wrote:

I got this yesterday.  It means Tiles didn't intercept your forward request
because 1) Tiles wasn't called or 2) Tiles didn't recognize your tile.
If you turn debug on for Tiles (org.apache.struts.tiles), it'll dump the 
tiles
it'll recognize when you app starts up.  Make sure yours is listed.

I'm using a tile with a ForwardAction now, so I know it works.  Hope you 
find it.

--- Ruth, Brice [EMAIL PROTECTED] wrote:


I'm following the instructions provided here: 
http://jakarta.apache.org/struts/userGuide/building_view.html (section 
3.4.3) for incorporating tiles definitions in struts-config.xml, and 
when the ActionServlet receives a request for an action who's parameter 
is a tile definition name (such as .baseLayout), I get the following exception:

javax.servlet.ServletException: Path .baseLayout does not start with a 
/ character

My action is defined like so:

   action
   path=/US/tilestest
   type=org.apache.struts.actions.ForwardAction
   parameter=.baseLayout/
And I've defined the plug-in for the Tiles requestor.

 plug-in
   className=org.apache.struts.tiles.TilesPlugin
   set-property
   property=definitions-config
   value=/WEB-INF/tiles-defs.xml/
 /plug-in
My tiles-defs.xml has one simple entry:

   definition name=.baseLayout path=/common/layouts/baseLayout.jsp/

within the tiles-definitions node.

Any ideas? Thanks!

--
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.


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



__
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

--
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.


-
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: html in ActionMessage resource keys?

2003-08-25 Thread Mikael Eriksson - Swedish Connection
Hi!

Try to do the bean:write like this

   bean:write filter=false name=msg /

The filter=false tells it to not replace special characters to entities.

Regards
Mikael
At 17:04 2003-08-25 -0400, you wrote:
Hi,

I am wondering if html tags, such as br, be used in the message
resource bundle keys? I want to have some formatting for an
ActionMessage, similar to what one gets using the ActionErrors and the
errors.prefix, errors.header and errors.footer keys (by default = BR,
UL, /UL respectively).
When I create a message key in my resource bundle, such as
messages.warning.general=Warning,the following problem occurred BR {0}
and use the following type of tag to display the message:
 html:messages message =true property=warning id=msg
   libean:write name=msg/
 /html:messages
I get the following in the html source:
liWarning,the following problem occurred:lt;BRgt; access problem
What I want is the following:
liWarning,the following problem occurred:BR access problem
Thanks,
Nancy
-
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: Java Question

2003-08-25 Thread Mikael Eriksson - Swedish Connection
The error messages says that stmt/rs already have been declared.
This is done in these lines in the beginning of the method
//Declare and initialize variables
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
Change the later lines and remove the Statement and ResultSet words 
respectively
and it should compile

Regards
Mikael
At 13:20 2003-08-24 -0500, you wrote:
I've been trying to compile my BLB (Business Logic Bean) and have been 
getting errors during compilation.  I haven't a clue as to how I could 
debug this.  Any assistance would be appreciated.

Thanks in advance.

- Mitesh

Error Messages during compilation:

[javac] Compiling 2 source files to 
C:\jakarta-tomcat-4.1.27\webapps\benchmark\WEB-INF\classes
[javac] 
C:\jakarta-tomcat-4.1.27\webapps\benchmark\WEB-INF\src\net\reumann\OrgIdService.java:56: 
stmt is already defined in execute(net.reumann.DataHash)
[javac] Statement stmt = 
conn.createStatement();
[javac]   ^
[javac] 
C:\jakarta-tomcat-4.1.27\webapps\benchmark\WEB-INF\src\net\reumann\OrgIdService.java:57: 
rs is already defined in execute(net.reumann.DataHash)
[javac] ResultSet rs = 
stmt.executeQuery(SELECT FACIL_ID, FACIL_NAME, FACIL_NAME_SHORT, ORG_ID 
FROM FACILITY WHERE FACIL_ID = ' + facilId + ');
[javac]   ^
[javac] 2 errors

Here is the code from my BLB:

package net.reumann;

import java.io.*;
import java.util.ArrayList;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import javax.sql.*;
import net.reumann.*;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import org.apache.log4j.*;
import org.apache.commons.beanutils.BeanUtils;
public class OrgIdService implements Serializable {

//Declare and initialize variables
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
ArrayList facilList = new ArrayList();
//The execute() method of OrgIdService is called by OrgIdAction 
to execute a query against the SS Test DB
public ArrayList execute(DataHash beanHash) {

//Get mode from DataHash
int mode = beanHash.getMode();
try{
switch (mode)   {
case 0:
Class.forName(oracle.jdbc.driver.OracleDriver);
conn = 
DriverManager.getConnection(jdbc:oracle:thin:@sources:1521:TEST,Test1234,Test1234);
Statement stmt = 
conn.createStatement();
ResultSet rs = 
stmt.executeQuery(SELECT DISTINCT FACIL_ID FROM FACILITY);

//Read ResultSet into instance of 
FacilBean and add to facilList Array object
while (rs.next()) {
FacilBean facil = new 
FacilBean();

facil.setFacilId(rs.getString(FACIL_ID));
facilList.add(facil);
}
//Close ResultSet and Connection 
objects
rs.close();
conn.close();
case 1:
//Extract the facilId from the 
DataHash to query the FACILITY table
String facilId = (String) 
beanHash.get(FacilId);

Class.forName(oracle.jdbc.driver.OracleDriver);
conn = 
DriverManager.getConnection(jdbc:oracle:thin:@sources:1521:TEST,Test1234,Test1234);
Statement stmt = 
conn.createStatement();
ResultSet rs = 
stmt.executeQuery(SELECT FACIL_ID, FACIL_NAME, FACIL_NAME_SHORT, ORG_ID 
FROM FACILITY WHERE FACIL_ID = ' + facilId + ');

//Read ResultSet into instance of 
FacilBean and add to facilList Array object
while (rs.next()) {
FacilBean facil = new 
FacilBean();

facil.setFacilId(rs.getString(FACIL_ID));

facil.setFacilName(rs.getString(FACIL_NAME));

facil.setFacilName(rs.getString(FACIL_NAME_SHORT));

facil.setOrgId(rs.getString(ORG_ID));
facilList.add(facil);
}
//Close ResultSet and Connection 
objects
rs.close();
conn.close();
  

Re: [OT] EXTREMELY URGENT: JBoss JAAS/Container Security issue

2003-04-03 Thread Mikael Eriksson
Hello!

Try changing this line in login-config.xml

module-option name = rolesQuerySELECT user_roles, 
user_group FROM USER_ROLES WHERE USERNAME=?/module-option

To

 module-option name = rolesQuerySELECT user_roles, 'Roles' FROM 
USER_ROLES WHERE USERNAME=?/module-option

or change the value of user_group in all rows to Roles.

My understanding of the second parameter that the rolesquery should return 
is that
you can somhow categorize users in diffent ways, but that the default 
user/role handling
should return Roles.

It also sounds like you might have misunderstood how the run-as identity 
is used.
That identity does not affect the callers of a bean or who can call it, it 
says that
when the bean tries to access other beans it will do so with the run-as 
identity.
This is so you can define beans that only can be called by internal 
identities so
that noone can call them directly from the outside.

Regards
/Mikael
At 09:51 2003-04-03 +0200, [EMAIL PROTECTED] wrote:
I appologize for this Off-Topic message, but I desperatly need help!

I have been fighting with the JBoss DatabaseServerLoginModule for almost 2 
months now without success.
I have tried an infinite number of combinations to try to get to a 
_SIMPLE_ solution as outlined by the JBoss manual, the JAAS article in 
JavaWorld, and hundreds of documents and examples from all over the internet.

Well, I just don't have anymore time to waste as my deadline is now 48 
hours away!
I desperately need help:

1. Find someone to offer some help to resolve this by Friday.
2. Direct me somewhere to find the help I need
3. Tell who would be willing to have me hire them for the help I need.
Here is my current situation:
I am using JBoss 3.0.6 with Catalina on NT 4.0, MySql, XDoclet 1.2, Struts 
1.1rc1, JDK 1.4.
I create a beans.jar, common.jar, app.war and package everything into 
app.ear. The only things that are not in my EAR are the mysql-service.xml, 
auth.conf, login-config.xml, and server.policy which reside in the 
$JBOSS_HOME\server\default\conf and the $JBOSS_HOME\server\default\deploy 
directories.
I also attached all the above file in a zip file here in this message.

I have the DatabaseServerLoginModule configured and it seems to be 
operating, but not correctly.
When I try to access a page under /private/* I get forwarded to /logon.jsp 
correctly.

My MySql Database has 2 tables:
TABLE_USER: columns: username, password
TABLE_USER_ROLES: columns: username, user_roles, user_group
TABLE_USER: data: mick, mickPassword
TABLE_USER_ROLES: data1: mick, user, user
TABLE_USER_ROLES: data2: mick, admin, admin
I then type in j_username: mick, j_password: mickPassword and click ENTER.
I seem to be logged in successfully as the console shows that I have 3 
Principals: mick, user, admin and when I attempt to navigate to 
pages in the private area that do not require EJB access, I continue to 
see that my Principal is kept successfully through each page. So I do 
_not_ currently have the Principal=null issue.
I do however have a UserPreferenceFilter that I check if the user is in 
role user, admin, or guest and all 3 come up as NO.

Also, when I attempt to access a page that goes to my EJB layer, I get a 
Security violation error that states user must belong to [ANYONE] role. 
But I have added a run-as = InternalUser for all my EJB's so far. But 
that does not seem to work. When I remove the run-as=InternalUser, I get 
a Security Violation that states the user must belong to the role I specified.

So it seems that my main 2 issues are getting the Roles to stick to the 
user when they login, and the EJB's to be able to use the user Roles, or 
the run-as=InternalUser



-
Thank You
Mick Knutson
Sr. Designer - Project Trust
aUBS AG, Financial - Zürich
Office: +41 (0)1/234.42.75
Internal: 48194
Mobile: 079.726.14.26
-


Visit our website at http://www.ubswarburg.com

This message contains confidential information and is intended only
for the individual named.  If you are not the named addressee you
should not disseminate, distribute or copy this e-mail.  Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.
E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses.  The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission.  If
verification is required please request a hard-copy version.  This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL 

RE: [OT] EXTREMELY URGENT: JBoss JAAS/Container Security issue

2003-04-03 Thread Mikael Eriksson

I will try the module-option ... in about 30 minutes. Thanks.
Ok,

Hope that it will work as it should


On the run-as, I do understand that this bean will run other beans as 
this identity. My Session Facade actually have permission unchecked so 
anyone should be able to get to my session facade currently. It is not 
what I want, but it is a start at least. Then I can get the user Roles 
issue resolved.
I guess I misunderstood your first mail then.


I am very grateful for your help!
This JAAS has been so difficult!


Yes, everything would be much easier without security :-)

Regards
/Mikael

-Original Message-
From: Mikael Eriksson [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 03, 2003 11:17 AM
To: Struts Users Mailing List
Cc: Knutson, Mick
Subject: Re: [OT] EXTREMELY URGENT: JBoss JAAS/Container Security issue
Hello!

Try changing this line in login-config.xml

 module-option name = rolesQuerySELECT user_roles,
user_group FROM USER_ROLES WHERE USERNAME=?/module-option
To

  module-option name = rolesQuerySELECT user_roles, 'Roles' FROM
USER_ROLES WHERE USERNAME=?/module-option
or change the value of user_group in all rows to Roles.

My understanding of the second parameter that the rolesquery should return
is that
you can somhow categorize users in diffent ways, but that the default
user/role handling
should return Roles.
It also sounds like you might have misunderstood how the run-as identity
is used.
That identity does not affect the callers of a bean or who can call it, it
says that
when the bean tries to access other beans it will do so with the run-as
identity.
This is so you can define beans that only can be called by internal
identities so
that noone can call them directly from the outside.
Regards
/Mikael


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


RE: [OT] EXTREMELY URGENT: JBoss JAAS/Container Security issue

2003-04-03 Thread Mikael Eriksson
At 14:08 2003-04-03 +0200, you wrote:
OK, that worked. Also, that seemed to remove the errors I had with the 
EJB's as well.
I really appreciate your help!
Great!

I am sorry if this seemed trivial to you and others, but the documentation 
did _not_ seem to be telling me what you mentioned about 'Roles'. I 
assumed 'Roles' ment I could call the 'Roles' what I understand as 
'Roles'. Not the literal 'Roles'.
Anyway, thanks very much.


The trivial questions are best because I can answer them :-)

Seriously  I can see how the descriptoin can be misread, the jboss docs are 
a bit
terse sometimes.

Regards



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


Re: No getter method for pro perty message

2002-11-07 Thread Mikael Eriksson
I've looked at the sent files and they seemed ok.

But, the JSP you have sent is different from the JSP fragment
in the first mail, the action in sent jsp i /newReception
and not /filterMails.

Are you sure that you are looking in  the right place 
in the right beans? The /newReception uses the bean class
com.bpam.mail.forms.MailFilterForm and not ReadMailForm.

Regards
/Mikael


I've added the missing closing quote.
I'm still getting the No getter method for property error.

Meissa
mSbf in my jsp, the form is defined like this :
mSbf  html:form action=/filterMails
mSbf  html:hidden property=taskAction value=save/
mSbf   table border=0  width=90% align=center CELLPADDING=0
CELLSPACING=
mSbf 1 border=0 claform

mSbftr height=40
mSbf td width=3%nbsp;/td
mSbf tdbean:message key=libelle.repertoire//td
mSbf td
mSbf  html:text property=targetDir size=30
maxlength=
50/nbsp;*
mSbf /td
mSbf/tr
mSbf   /table
mSbf   /html:form



===
Skickat genom Swedish Connection WebMail
===



--
To unsubscribe, e-mail:   mailto:struts-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org




Re: Help - xml to pdf using struts

2002-08-15 Thread Mikael Eriksson

I have used fop (http://xml.apache.org/fop/) to create PDF.
The fop distribution contains an example servlet that delivers
PDF to a browswer, its fairly easy to adapt that servlet to
be an action class.

I guess the XML to fo is best done with XSLT but we crated
to fo part directly so we did not have to do that transformation.

 Regards

output as HTML or PDF. I have the HTML side covered (I am using jakarta
XTags) but how do I render an xml to fo transformation to pdf by using
struts. I am aware of stxx but as far as I can see you have to override 
the
actionservlet etc and this seems an overhead for what is a small 
part of the
app. Can anyone please give some suggestions. 




===
Skickat genom Swedish Connection WebMail
===



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




Re: preview view of a form

2002-07-09 Thread Mikael Eriksson


The reset() method of the formbean is called when you get back
to the form. So if you clean things up there your form gets empty.

You can avoid this by leaving the reset() method empty.

  /Mikael


At 15:00 2002-07-09 +0200, you wrote:
Hi,

after filling in the form I want to present the user a preview of what 
she/he entered. Pushing save will make data persistance, pushing edit 
brings back the form with the data in the form fields.

How can I realize this with struts?
When I send the control back to the form it always is empty! All data are 
lost. the scope of the action is session.

Rainer



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




Re: Elegant way of displaying error message - Ryan Norman

2002-03-28 Thread Mikael Eriksson

The elegant way to do this is to have a placeholder for the user id.

Why would you not want to do that?

  Regards
  Mikael


I have a login screen. I authenticate the the user id and password.
When the authentication fails, I want to display an error message saying 
User ID X does not exist.
Where X is the typed user id. My error message is coming from the 
ApplicationResource.properties file.
I can always have a place holder for the user id in the error message and 
replace it with the current user id.
But I don't want to do that.

Is there an elegant way of doing this?

Thanks in advance

Ryan Norman



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




Re: Automatic way of transferring to login screen - Ryan Norman

2002-03-28 Thread Mikael Eriksson


Check out this link

http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Security4.html#67530

Regards

The standard J2EE web security does all the things you want.
At 11:03 2002-03-28 -0800, you wrote:
Hi,

I am running Win 2K advanced server, JDK 1.3, Tomcat 4.0 and struts framework.

I would like to know whether there is an automatic way of transferring the 
user to the login screen in the below given scenarios.
. The first time he enters the application.
. When the session variables expire.
. When an intruder tries to get into the application by typing an valid 
URL without loging into the application.

Thanks in advance

Ryan Norman



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




Svar: Convert from JSP to Struts.How?

2002-03-26 Thread Mikael Eriksson

Hi!

 I'm guessing a bit here since you did not tell what problem
you had but one thing to check is that the forward strings
in the html:link is declared as global forwards.

(When I first did this I mistakenly thought that the string
in forward would refer to an action declaration, which
it did not :-))

 Regards
 Mikael


 html:link forward=updKonsulent paramName=konsBean
paramProperty=ansattnrString paramId=ansnr 
  IMG alt= src=images/endre.gif border=0/html:link/td


   html:link forward=mainMenubean:message
key=goto.mainMenu//HTML:LINK

  /TD/TR
 /TABLE



===
Skickat genom Swedish Connection WebMail
===



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




Re: setparameter

2002-03-17 Thread Mikael Eriksson

Hi

If you mean getParameter() in the request you should be looking
at the getAttribute and setAttribute methods to (hopefully) get
what you want.

  Regards
  Mikael


At 07:25 2002-03-17 -0800, you wrote:
Subject: setparameter
From: Vic Cekvenich [EMAIL PROTECTED]
  ===
I need to implement setparameter(string,string), opposite of
getParameter(string).
Can you suggest how?
tia,
Vic


--
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: Action: how can i Forward with parameter at perform method.

2002-03-16 Thread Mikael Eriksson


The simplest way (IMHO) to get something from an action class to the
following JSP is to set it as a request attribute

I.e, in action:
request.setAttribute(ID, 11);

In jsp
   Use ID as a bean with struts tags. Get it with a jsp:useBean if you want it
in scriptlets.

That of course assumes that your forward does not do a redirect.

  Regards
  Mikael


At 13:00 2002-03-16 +0800, you wrote:
Hi all,

I would like to know, how can i forward a page with parameter... my
problem detail like that:

A action class...
---

public ActionForward perform(.) {
...
... do what i have to do.. like update/delete/insert operation...
...
if ( every ok ) {
return (mapping.findForward(success);
// problem here... success is map to a jsp ListDetailwith_ID.jsp...
}
}

---
The ListDetailwith_ID.jsp accord the parameter (?ID=11) to list out
the detail ... but i don't how can i pass the parameter at my Action class.

Please help.

Gordon


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
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: Svar: How make a forward when redirect=true

2002-03-16 Thread Mikael Eriksson


  Damn, you are on to us :-)

Another place to look is the server log, does it anything that might look 
strange?

The problem is strange because the thing should work... and has worked for
me. It probably need some experimenting :-)

If the forward is changed to some other page... just an ordinary html page
or something, does it work then?

At 04:59 2002-03-16 -0800, you wrote:
Have you solved this yet?
Did your 404 message display the URL it couldn't find? That's vital evidence.
K.

PS. We need more kiwis on this list - swedish plot to take over.



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




Svar: How make a forward when redirect=true

2002-03-14 Thread Mikael Eriksson


Hi

 The config looks good to me (except a spurions = in the forward
but I assume that is a copy paste error).

Since it works when redirect is not true a long shot might be
that it is your Error page that is not found. At least if
you are putting something in the request inside your action
class and looking for it in the page.

Possible scenario with redirect
   Action class puts stuff in request
   Redirect goes to browser, new request object without stuff
   Page called, tries to find stuff in request
 fails to do that... exception, resends to error page
   Error page not found 
   404 to browser

Hmm, on the other hand you write that giving the page url
directly in the browser works and if the request-object theory
is correct that should not work either.

If it is something with the request you could either try to
put the object into the session instead or avoid the redirect
if that can be done.

 Regards
 Mikael

PS
 Good to see more Swedes on this list :-)
DS

Hi,

This is how struts-config looks like

 action path=/ChangePassword/doChangePassword 

type=se.amfpension.prototyp.action.DoChangePasswordAction 
   name=changePasswordForm 
   scope=request 
   input=/ChangePassword/changePassword.jsp
   validate=true
   forward name=success
path==/ChangePassword/changePasswordConfirmed.jsp redirect=true/

/action

In  my action class I return: mapping.findForward(success);

But I get an error message, HTTP 404, file not found.
mReturn.getPath() writes the correct path and if I copy this path 
inte the
browser's address field the page will be displayed.

If I remove redirect=true from struts-config the page will be 
found. What
is the problem, how can I solve this? I have done this in another 
project
and that worked.

Ulrika





===
Skickat genom Swedish Connection WebMail
===



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




Re: Why no struts.jar on the classpath?

2002-03-12 Thread Mikael Eriksson


The long answer (or several long answers, at least one good written by Craig)
can be found by searching the archives of this list.

The short answer is that it is a classloader issue.

The classes in struts.jar instantiates your action classes and formbean 
classes.
Those classes _really_ _really_ should be packaged with the webapp and
stored below the WEB-INF/classes dir (or inside a jar in WEB-INF/lib if you
really want to jar them).
  If struts.jar is in WEB-INF/lib it will find your classes and everything will
be good :-).
  If struts.jar is somewhere else in the classpath, the classes inside your 
webapp
will not be found by the struts.jar classes and you will see strange errors 
when
trying to run things.

  Regards
  Mikael




At 11:14 2002-03-12 -0600, you wrote:
I want to start out by saying that I have read the fine manual and realise 
that the struts FAQ says that the struts.jar must not be placed on the 
application server's CLASSPATH.

My question to this list is why is this the case? I have a build manager 
who very much wants only a single instance of any jar file to exist on a 
server and they are asking why I am talking about putting multiples of the 
same file on their machine?

Simon

-
Simon P. Chappell [EMAIL PROTECTED]
Java Programming Specialist  www.landsend.com
Lands' End, Inc.   (608) 935-4526

--
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: I'm bagging my head on the keyboard on this one: Cannot retrieve definition for form bean PlayerMessageForm

2002-03-10 Thread Mikael Eriksson

Hi

  The problem should be in your mapping for the editMessage action, since
that is what the form refers to. Since the error message has 
PlayerMessageForm
with a capital 'P' and the name in the struts-config for the bean is
playerMessageForm with a 'p', you might have that misspelling in the
editMessage mapping.

  Regards.


At 13:57 2002-03-10 -0500, you wrote:
I'm getting this error message:

Cannot retrieve definition for form bean PlayerMessageForm

(PlayerMessageForm is a form bean in my project)

Here is that path I am following (struts-config entries to follow:
1) (other actions.. omitted for brevity)
2) /messageTypePRE.do, which forwards to...
3) /messaging/start.jsp, which submits to
4) /messageTypePOST.do, which forwards to...
5) /playerListPRE.do, which forwards to...
6) /messaging/playerList.jsp, where I get the error message

I know for a fact that the action playerListPRE.do does complete its
processing. I verified this with the debugger and also with
System.out statements. Its when it tries to load the JSP page,
player_list.jsp. that it craps out. Even with the following bare-
bones version of player_list.jsp:

-- snip --
   body
   html:form action=/editMessage.do

   /html:form
   /body
-- snip --

I have the following mappings (among others) in my struts-config.xml
file:

-- snip --
..
form-beans type=org.apache.struts.action.ActionFormBean
   form-bean name=playerMessageForm
  ype=com.dceg.webapps.messaging.PlayerMessageForm /
/form-beans
..
action path=/messageTypesPOST
type=com.dceg.webapps.messaging.MessageTypeAction
name=playerMessageForm
scope=request
parameter=POST
validate=false
   forward name=allPlayers path=/allPlayers.do /
   forward name=playerList path=/playerListPRE.do /
   forward name=gameTypes  path=/gameTypesPRE.do /
/action

action path=/playerListPRE
type=com.dceg.webapps.messaging.PlayerListAction
name=playerMessageForm
scope=request
validate=false
parameter=PRE
forward name=next path=/messaging/player_list.jsp/
/action

-- snip --


So what is causing Cannot retrieve definition for form bean
PlayerMessageForm error??? Anyone?

--
Kevin J. Turner / dot com Entertainment Group
150 Randall Street, Oakville, Ontario L6J 1P4
telephone: 905.337.8524 fax: 905.337.8630




--
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: Application Scope Variables

2002-03-07 Thread Mikael Eriksson

Hi

  The HttpSession does not have a servletcontext, the servlet has, and you
can get to the servlet from the ActionForm with the getServlet() method.

So
Object o =
 getServlet().getServletContext().getAttribute(attribute_name);

should work
  (has not tried it live though :-) )


  Regards
  Mikael


At 14:24 2002-03-06 -0700, you wrote:
Hello,

I was searching around in the struts-user list archives for the correct
getServletContext() syntax and found Robert's response to a post:
http://www.mail-archive.com/struts-user@jakarta.apache.org/msg22768.html

I am trying to compile an ActionForm and I need to access the *application*
scoped bean (not a session bean).

I tried:

public ActionErrors validate(ActionMapping mapping, HttpServletRequest
request)
{
 
 Object o =
request.getSession().getServletContext().getAttribute(attribute_name);

}



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




Re: logic:iterate String.

2002-03-01 Thread Mikael Eriksson

Hi

Use

  bean:write name=val /

Inside your iterate
As I understand you you just want to display things... Bean:write does a 
toString
(or something like that) of the bean if not property is mentioned.

  Regards
  Mikael


At 14:50 2002-03-01 +0100, you wrote:
Hi!
I use a Vector object which contains String Object.
This Vector is in a JavaBeans, so I've got a getter method, which returns
the Vector.
When I want to iterate the list by:
logic:iterate id=val type=java.lang.String name=user
property=infoDB
 
/logic:iterate
How replace the ? by a good code?!
I haven't idea! If my Vector contains some other complex object (others
beans for examples), this works well.
How do I to diplay my String(s)?

Thx for your answers



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




Re: Invalid attribute Prefix error

2001-10-25 Thread Mikael Eriksson

It looks like there is no space character between the @ and taglib.
If it is not there try to add it.

 Regards

Hitesh Parashar wrote:

 Hi:

 I am trying to run a struts sample with VisualAge 4.0
 WTE. I get an error as follows:

 Message: Directive: Invalid attribute, prefix

 My JSP file is:

 %@taglib uri=/WEB-INF/struts-html.tld
 prefix=html%
 html:html locale=false
 html:errors/
 html:form action=processNewEmployee.do
 *First Name: html:text property=firstName/BR
 *Last Name: html:text property=lastName/BR
 *Phone Number: html:text property=phoneNumber/BR
 Office Number: html:text
 property=officeNumber/BR
 Backup: html:text property=backup/BR
 Backup Phone Number: html:text
 property=backupPhoneNumber/BR
 html:submit /
 /html:form
 /html:html

 Any idea, what might be going wrong.

 Thanks,

 Hitesh.

 The detailed error message is:

 Error 500
 An error has occured while processing
 request:http://localhost:8080/jsp/employeesearch.jsp
 Message: Directive: Invalid attribute, prefix

 Target Servlet: jsp
 StackTrace:
 
 Root Error-1: Directive: Invalid attribute, prefix

 com.ibm.servlet.engine.webapp.WebAppErrorReport:
 Directive: Invalid attribute, prefix
 java.lang.Throwable(java.lang.String)
 java.lang.Exception(java.lang.String)
 javax.servlet.ServletException(java.lang.String)

 com.ibm.websphere.servlet.error.ServletErrorReport(java.lang.String)

 com.ibm.servlet.engine.webapp.WebAppErrorReport(java.lang.String)
 void
 com.ibm.servlet.engine.webapp.WebAppDispatcherResponse.sendError(int,
 java.lang.String)
 void
 
com.sun.jsp.runtime.JspServlet.unknownException(javax.servlet.http.HttpServletResponse,
 java.lang.Throwable)
 void
 com.sun.jsp.runtime.JspServlet.service(javax.servlet.http.HttpServletRequest,
 javax.servlet.http.HttpServletResponse)
 void
 javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest,
 javax.servlet.ServletResponse)
 void
 
com.ibm.servlet.engine.webapp.StrictServletInstance.doService(javax.servlet.ServletRequest,
 javax.servlet.ServletResponse)
 void
 
com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(javax.servlet.ServletRequest,
 javax.servlet.ServletResponse)
 void
 
com.ibm.servlet.engine.webapp.IdleServletState.service(com.ibm.servlet.engine.webapp.StrictLifecycleServlet,
 javax.servlet.ServletRequest,
 javax.servlet.ServletResponse)
 void
 
com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(javax.servlet.ServletRequest,
 javax.servlet.ServletResponse)
 void
 com.ibm.servlet.engine.webapp.ServletInstance.service(javax.servlet.ServletRequest,
 javax.servlet.ServletResponse,
 com.ibm.servlet.engine.webapp.WebAppServletInvocationEvent)
 void
 
com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(com.ibm.servlet.engine.webapp.ServletInstanceReference,
 javax.servlet.ServletRequest,
 javax.servlet.ServletResponse,
 com.ibm.servlet.engine.webapp.WebAppServletInvocationEvent)
 void
 
com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(javax.servlet.ServletRequest,
 javax.servlet.ServletResponse,
 com.ibm.servlet.engine.webapp.WebAppServletInvocationEvent)
 void
 
com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(com.ibm.servlet.engine.webapp.WebAppRequest,
 javax.servlet.http.HttpServletResponse, boolean)
 void
 
com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(javax.servlet.ServletRequest,
 javax.servlet.ServletResponse, boolean)
 void
 
com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(javax.servlet.ServletRequest,
 javax.servlet.ServletResponse)
 void
 com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(java.lang.Object)
 void
 com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(java.lang.Object)
 void
 com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(java.lang.String,
 com.ibm.servlet.engine.srp.ISRPConnection)
 void
 
com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(com.ibm.servlet.engine.oselistener.api.IOSEConnection)
 void
 
com.ibm.servlet.engine.http_transport.HttpTransportHandler.handleConnection(java.net.Socket)
 void
 com.ibm.servlet.engine.http_transport.HttpTransportHandler.run()
 void java.lang.Thread.run()

 __
 Do You Yahoo!?
 Make a great connection at Yahoo! Personals.
 http://personals.yahoo.com





Re: Error 500--Internal Server Error

2001-09-09 Thread Mikael Eriksson


Hi!

 Assuming that the class it cannot find really is where it should be :-),
this sounds like that you have struts.jar somewhere in the classpath
of weblogic. Make sure that it is only present in WEB-INF/lib (and
that the classpath does not point it out there)

 Regards
 Mikael


Chandana Perera wrote:

 Hi Steven

 Sep 7, 2001 1:40:57 PM GMT+06:00 Error HTTP
 [WebAppServletContext(6591192,struct)] Root cause of ServletException
 javax.servlet.jsp.JspException: Exception creating bean of class
 com.jspinsider.struts.lesson1.logonform: java.lang.ClassNotFoundException:
 com.jspinsider.struts.lesson1.logonform
 at
 org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:568)
 at jsp_servlet._lesson1._logon._jspService(_logon.java:159)
 at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
 at
 weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
 :213)
 at
 weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
 ntext.java:1265)
 at





Re: Multipart Request

2001-08-17 Thread Mikael Eriksson

(Pasted from an earlier answer)

Hello

 I noticed the same problem when moving to 1.0. It seems that
the requesthandler notices that the request is a multi-part and
tries to find the multi-part data, even when the request are
already handled and you are only forwarding to the next
action. (I only got the problem when going to another action.)

 The way I handled it was to set redirect=true in struts-config.xml
for the action that I forwarded to, this made the multi-part info
go away from the request (and all other parameters too of course,
so if you are expecting request parameters in the next action this
will not work.)

 I guess this could be fixed in the code too, maybe by having the request
reader setting a request attribute so that it knows the next time
that it already has gotten the data. But I did not go deep enough
into the code to know if that is feasible or not.

 Regards
 Mikael



MacKellar, Kimberly wrote:

 I have a form that submits a file to an action (UploadImageAction).  After
 the action has finished processing the file it forwards to another Action
 that retrieves data to display a page.  When the forward is invoked in
 UploadImageAction I get the following error
 javax.servlet.ServletException: MultipartIterator: no multipart request data
 sent at
 org.apache.struts.upload.MultipartIterator.parseRequest(MultipartIterator.ja
 va:341) at
 org.apache.struts.upload.MultipartIterator.(MultipartIterator.java:152)

 Is there a way to reset something in the request to prevent this from
 happening?

 Kimberly MacKellar
 Thomson Financial Publishing
 [EMAIL PROTECTED]
 (847) 933-8005




Re: Error - MultipartIterator: no multipart request data sent

2001-07-01 Thread Mikael Eriksson

Hello

 I noticed the same problem when moving to 1.0. It seems that
the requesthandler notices that the request is a multi-part and
tries to find the multi-part data, even when the request are
already handled and you are only forwarding to the next
action. (I only got the problem when going to another action.)

 The way I handled it was to set redirect=true in struts-config.xml
for the action that I forwarded to, this made the multi-part info
go away from the request (and all other parameters too of course,
so if you are expecting request parameters in the next action this
will not work.)

 I guess this could be fixed in the code too, maybe by having the request
reader setting a request attribute so that it knows the next time
that it already has gotten the data. But I did not go deep enough
into the code to know if that is feasible or not.

 Regards
 Mikael


[EMAIL PROTECTED] wrote:

 Hi everbody,

 I am writing a program that needs to process form data. I have an uploadForm
 (that is an insatance of org.apache.struts.action.ActionForm). I have no
 problem with uploading a file via this form. After uploading the file, I am
 executing a couple of procedures inside the uploadAction(instance of
 org.apache.struts.action.Action) and afterwards forwarding the request to
 another page. While it is forwarding the request, it gives the following error:

 javax.servlet.ServletException: MultipartIterator: no multipart request data
 sent
 java.lang.Throwable(java.lang.String)
 java.lang.Exception(java.lang.String)
 javax.servlet.ServletException(java.lang.String)
 void org.apache.struts.upload.MultipartIterator.parseRequest()

 org.apache.struts.upload.MultipartIterator(javax.servlet.http.HttpServletRequest
 , int, long, java.lang.String)
 void
 org.apache.struts.upload.DiskMultipartRequestHandler.handleRequest(javax.servlet
 .http.HttpServletRequest)
 void org.apache.struts.util.RequestUtils.populate(java.lang.Object,
 java.lang.String, java.lang.String, javax.servlet.http.HttpServletRequest)
 void
 org.apache.struts.action.ActionServlet.processPopulate(org.apache.struts.action.
 ActionForm, org.apache.struts.action.ActionMapping,
 javax.servlet.http.HttpServletRequest)
 void
 org.apache.struts.action.ActionServlet.process(javax.servlet.http.HttpServletReq
 uest, javax.servlet.http.HttpServletResponse)
 void
 com.ubs.cristal.actions.CristalActionServlet.process(javax.servlet.http.HttpServ
 letRequest, javax.servlet.http.HttpServletResponse)
 void
 org.apache.struts.action.ActionServlet.doPost(javax.servlet.http.HttpServletRequ
 est, javax.servlet.http.HttpServletResponse)
 void
 javax.servlet.http.HttpServlet.service(javax.servlet.http.HttpServletRequest,
 javax.servlet.http.HttpServletResponse)
 void
 javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest,
 javax.servlet.ServletResponse)
 void
 org.apache.tomcat.core.ServletWrapper.doService(org.apache.tomcat.core.Request,
 org.apache.tomcat.core.Response)
 void
 org.apache.tomcat.core.Handler.service(org.apache.tomcat.core.Request,
 org.apache.tomcat.core.Response)
 void
 org.apache.tomcat.core.ServletWrapper.service(org.apache.tomcat.core.Request,
 org.apache.tomcat.core.Response)
 void
 org.apache.tomcat.facade.RequestDispatcherImpl.forward(javax.servlet.ServletRequ
 est, javax.servlet.ServletResponse)
 void
 org.apache.struts.action.ActionServlet.processActionForward(org.apache.struts.ac
 tion.ActionForward, org.apache.struts.action.ActionMapping,
 org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest,
 javax.servlet.http.HttpServletResponse)
 void
 org.apache.struts.action.ActionServlet.process(javax.servlet.http.HttpServletReq
 uest, javax.servlet.http.HttpServletResponse)
 void
 com.ubs.cristal.actions.CristalActionServlet.process(javax.servlet.http.HttpServ
 letRequest, javax.servlet.http.HttpServletResponse)
 void
 org.apache.struts.action.ActionServlet.doPost(javax.servlet.http.HttpServletRequ
 est, javax.servlet.http.HttpServletResponse)
 void
 javax.servlet.http.HttpServlet.service(javax.servlet.http.HttpServletRequest,
 javax.servlet.http.HttpServletResponse)
 void
 javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest,
 javax.servlet.ServletResponse)
 void
 org.apache.tomcat.core.ServletWrapper.doService(org.apache.tomcat.core.Request,
 org.apache.tomcat.core.Response)
 void
 org.apache.tomcat.core.Handler.service(org.apache.tomcat.core.Request,
 org.apache.tomcat.core.Response)
 void
 org.apache.tomcat.core.ServletWrapper.service(org.apache.tomcat.core.Request,
 org.apache.tomcat.core.Response)
 void
 org.apache.tomcat.core.ContextManager.internalService(org.apache.tomcat.core.Req
 uest, org.apache.tomcat.core.Response)
 void
 

Re: DTD Incompatibility With WebLogic 5.1 and Struts 1.0?

2001-06-26 Thread Mikael Eriksson

Hello!

 This was a bug that existed in earlier versions of 5.1 but it was fixed at
around service pack 5. So it seems that your configuration are not
picking up the service pack properly.
  When I manage to fail to pick up a service pack its usually becuase
I misremember where the service pack jar files are :-)
 You can use the weblogic console to find out what service pack
that really is loaded on a server.

  Regards
  Mikael Eriksson

usual-disclamer
  no-I-dont-speak-for-BEA/
  somtimes-not-even-for-myself/
/usual-disclaimer


Hohlen, John wrote:

 Has anyone ever seen the following Document Type Definition (DTD) error
 message upon starting the WebLogic 5.1 (SP 8) server using Struts 1.0 on NT?
 This occurs using both the Struts-Example and Struts-Documentation war
 files:

 [ExternalEntity] : Could not resolve entity '-//Sun Microsystems, Inc.//DTD
 Web
 Application 2.2//EN'.  Check your dtd reference.

 The way I fixed this error was modifying the DocType data in the web.xml
 file.  Specifically, the line:

 !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application
 2.2//EN http: //java.sun.com/j2ee/dtds/web-app_2_2.dtd

 If I change the DTD Web Application 2.2 to DTD Web Application 1.2, the
 error message no longer occurs.  Notice, I only changed the comment portion.
 Not the URL.  Any explanations to this?

 Thanks,

 JOHN




Re: tool for the struts-config.xml

2001-05-24 Thread Mikael Eriksson

Hello

I think the portability has to do with that the file is read from the WEB-INF
directory and that it is not always possible to store thing there. So probably
a struts-config-config application would not have the same problem, depending
on how it wanted to handle the file.

 A way to handle it, without having to store anything persistent on the server
would be that the user starts with selecting a struts-config.xml to upload
(or selects to work with a completely new configuration). Then do all
the wanted changes and finally request the web-app to generate a struts-config
with the current configuration, the file could then be delivered to the
browser and saved/viewed just as any other file.

 Mikael


Gogineni, Pratima wrote:

 Hi,

 This could be done similar to the way they serialize the user database xml
 file in the struts example but this is what I saw under the changes and bug
 fixes section of the struts example application:

 Removed any attempt to save the pseudo-database at application shutdown,
 because there is no portable mechanism to accomplish this task. 

 a. does anyone know why the mechanism is not portable?
 b. if above is true we will face the same problem when you try to serialize
 the struts-config.xml file?

 pratima




Re: Access to ApplicationResources.properties from Action class?

2001-03-13 Thread Mikael Eriksson


 Your right of course. Seems that I answered the question a bit too
quickly, my eyes focues on the code example and I lept to conclusions
from that :-(


 Regards
 Mikael

Martijn Spronk wrote:

  I think that the best thing to do would be to not use the text of
 the button at all. If you use the text you will need to change the
 code as well if you decide to change the text on the button by
 editing the property file. (And if you get internationalization into
 the picture it will be even worse.)

 I disagree on this.

 By accessing the properties file I am actually avoiding having
 to modify the code if the button text changes. After all, I am accessing
 the property from the JSP using a tag, and what I try to do in the perform
 method is the same: access the value of the property.




Re: Access to ApplicationResources.properties from Action class?

2001-03-12 Thread Mikael Eriksson

Hello,

 I think that the best thing to do would be to not use the text of
the button at all. If you use the text you will need to change the
code as well if you decide to change the text on the button by
editing the property file. (And if you get internationalization into
the picture it will be even worse.)

I think the solution would be to have different names on the
buttons (using the 'property' attribute of the html:submit tag) and
check the button used by having properties for all the possible names
in the Form bean and see which property that is different from null.
(Or by doing a request.getParameter() as you do in your example, but
I like the automatic way better :-) )

The downside of that is of course that you need extra properties in the
Form bean class but I still think it will be worth it.

 To come back to the original question I do not know how to do it
but I guess that it would be possible to find by checking the source
of the bean:message tag.

 Regards
 Mikael




Martijn Spronk wrote:

 Hi all,

 I'm pretty new to struts, and just started developing a fairly
 simple app, however taking a bit beyond the standard example functionality.

 I have a (probably) pretty simple question:
 I'm in the perform method of the Action class, processing a form submit, but
 want to
 forward to different mappings depending on which button was pressed.
 In the JSP I am using the ApplicationResources.properties file to create the
 button text for the
 different buttons, so now I need to access this text also to determine which
 action to
 take.

 So how do I access the descriptions from the properties file in the Action
 class?

 my form:
 ---
 tr
td colspan="5" align="right"
   html:submit styleClass="bodyform"
 bean:message key="button.cancel"/
   /html:submitnbsp;/td
td
   html:submit styleClass="bodyform"
 bean:message key="button.edit"/
   /html:submitnbsp;/td
td
   html:submit styleClass="bodyform"
 bean:message key="button.confirm"/
   /html:submit/td
   /tr
 ---

 So what do I put at the ... in the following fragment of the perform()
 method to
 be able to get the textual value of the button.cancel and button.edit?
 ---
 String submit = request.getParameter("submit");
 // Forward control depending on which button was pressed
 if (submit.equals(...))
 return (mapping.findForward("cancel"))
 else if (submit.equals(...))
 return (mapping.findForward("edit"))
 ---

 Thanks,
 Martijn.




Re: java.io.NotSerializableException again

2000-12-21 Thread Mikael Eriksson

Hi

 I got the same problem, I had to make the following changes
(excerpt from a mail to Craig follows).

 The change in MessageResourcesFactory is that I changed
the "setDefaultWriter" method to just set the writer to null.
I was not able to make the writer used to be serializable.
(It's a subclass of PrintWriter that did not have an appropriate
constructor and includes a ServletContext that was not serializable...)

So I lost logging, but at least I was able to get the example-app up
and running. Would love to see a serializable variant of the writer...

 Regards
 Mikael

DISCLAIMER
 Nothing in this letter is in any way BEA's official view on anything...
And so on
/DISCLAIMER




The classes I had to change was the following (from the 1216 build)

org.apache.struts.util.MessageResourcesFactory
   Made the class Serializable (not sure if its really necessary)
   Never allow setting of the defaultwriter, keeps it as null always

And the following classes where made Serializable:

All are in package org.apache.struts.action.
   Action
   ActionFormBean
   ActionFormBeans
   ActionForward
   ActionForwards
   ActionMapping
   ActionMappings
   ActionServlet


--
"Punyansky, Alex" wrote:

 Hi,

 I tried to run struts example app with a modified version of struts.jar (
 the one that uses factories for MessageResources ) on Weblogic 6.0 but I got
 the following exception.

 I can't figure out where and why Weblogic accesses
 org.apache.struts.util.PropertyMessageResourcesFactory instance instead of
 org.apache.struts.util.PropertyMessageResources. Did anyone have this
 problem?