RE: html:frame Problem, very Urgent!

2003-10-21 Thread krishnamohan
Hi Andrew,
 we are trying to send objects instead of string
variables,request.getParameter() fetch's only string variable. but my
requirement is ,i need to retrieve ArrayList object from by using
request.getAttribute().its possible by using html:frame??,i am using
session.setAttribute() to pass ArrayList Object,but its cause performance
problems(tomcat got freezeed,i think because of tomcat VM memory filled
up,if restart tomcat its working fine for 3,4 complete executions of
application ,then problem is reappearing)

Thanks
Mohan

-Original Message-
From: Andrew Hill [mailto:[EMAIL PROTECTED]
Sent: Monday, October 20, 2003 12:23 PM
To: Struts Users Mailing List
Subject: RE: html:frame Problem, very Urgent!
Importance: Low


Hmm... No. Doesnt look that urgent to me mate.
http://www.catb.org/~esr/faqs/smart-questions.html#urgent

snip
html:frame page=/displayQuestion.jsp frameName=first
scrolling=auto frameborder=0 paramId=sample1 paramName=sample1
name=sample1 /
/snip

snip
request.getAttribute(sample1);
/snip

If your passing it as a parameter you should use
request.getParameter(sample1) to get its value. (Attributes and parameters
arent the same thing).



-Original Message-
From: krishnamohan [mailto:[EMAIL PROTECTED]
Sent: Monday, 20 October 2003 14:37
To: '[EMAIL PROTECTED]'
Cc: Mohan Reddy
Subject: html:frame Problem, very Urgent!
Importance: High


Hi all,


The following is my jsp page where I want to pass values to another jsp
using html:frame tag.

This is my code snipplet,

jsp:useBean id=test1 class=com.xx.XX.QuestionInfo /

ArrayList al=(ArrayList)request.getAttribute(QuestionsDB);
request.getSession().getServletContext().setAttribute(QuestionsDB,al);
//HashMap hash=new HashMap();
//hash.put(QuestionsDB,al);
test1.setValue(al);
%
bean:define id=sample name=test1 property=value toScope=request/
%
java.util.HashMap params = new java.util.HashMap();
params.put(QuestionsDB, sample);

pageContext.setAttribute(sample1, params);

%

frameset rows=44%,43%,13% name=mainframe
html:frame page=/displayQuestion.jsp frameName=first
scrolling=auto frameborder=0 paramId=sample1 paramName=sample1
name=sample1 /
/frameset
br

in displayQuestion.jsp page i am trying to retrive value sample1 by using
request.getAttribute(sample1);

This is not giving any values for me

please help me ,and please correct code, if any thing is wrong

Its very very Urgent.


regards

Mohan.

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



html:frame Problem, very Urgent!

2003-10-20 Thread krishnamohan
Hi all,


The following is my jsp page where I want to pass values to another jsp
using html:frame tag.

This is my code snipplet,

jsp:useBean id=test1 class=com.xx.XX.QuestionInfo /

ArrayList al=(ArrayList)request.getAttribute(QuestionsDB);
request.getSession().getServletContext().setAttribute(QuestionsDB,al);
//HashMap hash=new HashMap();
//hash.put(QuestionsDB,al);
test1.setValue(al);
%
bean:define id=sample name=test1 property=value toScope=request/
%
java.util.HashMap params = new java.util.HashMap();
params.put(QuestionsDB, sample);

pageContext.setAttribute(sample1, params);

%

frameset rows=44%,43%,13% name=mainframe
html:frame page=/displayQuestion.jsp frameName=first
scrolling=auto frameborder=0 paramId=sample1 paramName=sample1
name=sample1 /
/frameset
br

in displayQuestion.jsp page i am trying to retrive value sample1 by using
request.getAttribute(sample1);

This is not giving any values for me 

please help me ,and please correct code, if any thing is wrong 

Its very very Urgent.


regards

Mohan.

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



data disappearing in jsp

2003-10-06 Thread krishnamohan
Hi,

In my jsp page I have 5 fields out of which 2 fields are required.   When
the jsp is submitted I am displaying the error messages for the required
fields using Action Error in the form bean's validate method.  When the jsp
page is displayed with the error messages, the data for the remaining 3
fields is disappearing.  Can anyone let me know why this is happening.   In
the reset method all the fields are made to null.   

Thanks,
Krishna

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



RE: data disappearing in jsp

2003-10-06 Thread krishnamohan
Max, 

Thanks for your inputs.  But all the fields are declared as properties in
the form with setters and getters.   These fields are resetted in the
reset() method.   I tried with commenting them in the reset() method, but
this does not seem to solve the problem.  Is this a struts default feature
that on validation errors when the request goes to jsp page, it does not
retain the values of the fields.   This will be tedious for a user, that if
one required field is missed, he has to retype for all other fields.  I
found by debug statements in my formbean that in the validate method, the
values are available but when the jsp page is populated, the values are not
available in the get methods.   What can I do to get them back.

Thanks,
Krishna



-Original Message-
From: Max Cooper [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 07, 2003 5:23 AM
To: Struts Users Mailing List
Subject: Re: data disappearing in jsp


If the missing fields are display-only, you might need to add hidden fields
to carry their values along in the request when the page is submitted so
that they will be available on a validation error.

reset() is called before the ActionForm is populated with the values from
the request, so I don't think it matters what you do to them there. As long
as they are in the request (and the names in the HTML form match your
ActionForm), they should be populated in the ActionForm when a validation
error occurs.

-Max

- Original Message - 
From: krishnamohan [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, October 06, 2003 6:10 AM
Subject: data disappearing in jsp


 Hi,

 In my jsp page I have 5 fields out of which 2 fields are required.   When
 the jsp is submitted I am displaying the error messages for the required
 fields using Action Error in the form bean's validate method.  When the
jsp
 page is displayed with the error messages, the data for the remaining 3
 fields is disappearing.  Can anyone let me know why this is happening.
In
 the reset method all the fields are made to null.

 Thanks,
 Krishna

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



dynamic properties in jsp

2003-09-29 Thread krishnamohan
Hi,

I am working on a page where the user will dynamically add new rows at
runtime and there is  no limit.   This will be on a button 'Add New Option'.
So I do not know what properties to create at compile time.  If anybody has
worked on this type of scenario in struts, pl. help me how to do this or
with some code. I am using struts1.1 and tomcat.

Thanks,
Krishna


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



RE: javax.servlet.ServletException: BeanUtils.populate

2003-09-28 Thread krishnamohan
Hi Gaurav,

It's me.   Are you working on Struts?

Thanks,
Krishna

-Original Message-
From: Gaurav Gupta [mailto:[EMAIL PROTECTED]
Sent: Saturday, September 27, 2003 4:18 PM
To: 'Struts Users Mailing List'
Subject: RE: javax.servlet.ServletException: BeanUtils.populate


Is it Krishna Mohan , previously with MTC India ??

sorry for botheration



-Original Message-
From: krishnamohan [mailto:[EMAIL PROTECTED]
Sent: Saturday, September 27, 2003 3:56 PM
To: [EMAIL PROTECTED]
Subject: javax.servlet.ServletException: BeanUtils.populate


Hi,
I am writing a small page based on struts guidelines for creating map-backed
forms. I am using struts 1.1. I have a jsp in which I have some dynamic
fields. I used a for loop for these,currently. In the ActionForm, I have
declared a HashMap for collecting values of these fields. However, when I
submit the page, I am getting the error- javax.servlet.ServletException:
BeanUtils.populate Root cause: java.lang.IllegalArgumentException: No bean
specified. Pl. help me understand what went wrong.


The following is the jsp page
%@ page language=java session=true%
!-- Imports--
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %
%@ taglib uri=/WEB-INF/struts-html.tld prefix=html %
%@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic %
html:html locale=true
!--Apply Stylesheet-- head
link href=./layouts/PrimeCss.css type=text/css rel=stylesheet
/head
body norepeat bottommargin=0 leftmargin=0 rightmargin=0 topmargin=0
bgproperties=fixed
html:form action=/createQuestion focus=questionName
name=createQuestionForm
type=com.trx.kms.questionbank.CreateQuestionForm
bean:message key=questionbank.createquestion.pagetitle/

bean:message key=questionbank.createquestion.name/ html:text
property=questionName style=width:195px maxlength=100/
bean:message key=questionbank.createquestion.description/ html:textarea
property=questionDesc cols=65 rows=12/
% for (int i=0; i =2; i++) { String name = value(foo- + i + ); %
bean:message key=questionbank.createquestion.option/ html:text
property=%= name % /

%} % html:image page=/layouts/submit.jpg property=submit
onclick=onSubmitClick();/ html:image page=/layouts/cancel.jpg
property=reset /
/html:form /body /html:html

The following is the ActionForm class

package com.trx.kms.questionbank; import
javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import java.util.HashMap;
import java.util.Map;
import java.util.Iterator;


public final class CreateQuestionForm extends ActionForm{
private String questionName=null;
private String questionDesc=null;
private String submit=null;
private String reset=null;
private final Map values = new HashMap();


public void setValue(String key, Object value) {
values.put(key, value); }
public Object getValue(String key) {
return values.get(key); }
public String getQuestionDesc() {
return questionDesc; }
public String getQuestionName() {
return questionName; }
public void setQuestionDesc(String string) {
questionDesc = string; }
public void setQuestionName(String string) {
questionName = string; }
public String getReset() {
return reset; }
public String getSubmit() {
return submit; }
public void setReset(String string) {
reset = string; }
public void setSubmit(String string) {
submit = string; }


public String getQuestions()
{
StringBuffer sb = new StringBuffer();
if ((values!=null  !values.isEmpty())) {
Iterator it = values.keySet().iterator();
while (it.hasNext()) {
String paramName = (String)it.next();
String paramValue = (String)values.get(paramName);
sb.append(paramName);
sb.append(paramValue);
} } return sb.toString();
}


public void reset(ActionMapping mapping, HttpServletRequest request) {
this.questionName=null;
this.questionDesc=null;
}


public ActionErrors validate(ActionMapping mapping, HttpServletRequest
request) {
ActionErrors errors = new ActionErrors();
return errors; } }


The following is the action class


package com.trx.kms.questionbank;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import javax.servlet.http.*;
import javax.servlet.*;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Iterator;

public final class CreateQuestionAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws
IOException, ServletException {
String questions=((CreateQuestionForm)form).getQuestions();
ActionErrors errors = new ActionErrors();
if (!errors.isEmpty()) {
saveErrors(request, errors);
return (new ActionForward(mapping.getInput())); }
return (mapping.findForward(success)); }
}



-
To unsubscribe

javax.servlet.ServletException: BeanUtils.populate

2003-09-27 Thread krishnamohan
Hi, 
I am writing a small page based on struts guidelines for creating map-backed
forms. I am using struts 1.1. I have a jsp in which I have some dynamic
fields. I used a for loop for these,currently. In the ActionForm, I have
declared a HashMap for collecting values of these fields. However, when I
submit the page, I am getting the error- javax.servlet.ServletException:
BeanUtils.populate Root cause: java.lang.IllegalArgumentException: No bean
specified. Pl. help me understand what went wrong. 


The following is the jsp page
%@ page language=java session=true%
!-- Imports--
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %
%@ taglib uri=/WEB-INF/struts-html.tld prefix=html %
%@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic %
html:html locale=true
!--Apply Stylesheet-- head
link href=./layouts/PrimeCss.css type=text/css rel=stylesheet
/head
body norepeat bottommargin=0 leftmargin=0 rightmargin=0 topmargin=0
bgproperties=fixed 
html:form action=/createQuestion focus=questionName
name=createQuestionForm
type=com.trx.kms.questionbank.CreateQuestionForm 
bean:message key=questionbank.createquestion.pagetitle/ 

bean:message key=questionbank.createquestion.name/ html:text
property=questionName style=width:195px maxlength=100/ 
bean:message key=questionbank.createquestion.description/ html:textarea
property=questionDesc cols=65 rows=12/ 
% for (int i=0; i =2; i++) { String name = value(foo- + i + ); %
bean:message key=questionbank.createquestion.option/ html:text
property=%= name % / 

%} % html:image page=/layouts/submit.jpg property=submit
onclick=onSubmitClick();/ html:image page=/layouts/cancel.jpg
property=reset / 
/html:form /body /html:html 

The following is the ActionForm class 

package com.trx.kms.questionbank; import
javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import java.util.HashMap;
import java.util.Map;
import java.util.Iterator;


public final class CreateQuestionForm extends ActionForm{ 
private String questionName=null;
private String questionDesc=null;
private String submit=null; 
private String reset=null; 
private final Map values = new HashMap(); 


public void setValue(String key, Object value) {
values.put(key, value); } 
public Object getValue(String key) {
return values.get(key); } 
public String getQuestionDesc() {
return questionDesc; }
public String getQuestionName() {
return questionName; }
public void setQuestionDesc(String string) {
questionDesc = string; } 
public void setQuestionName(String string) {
questionName = string; } 
public String getReset() {
return reset; } 
public String getSubmit() {
return submit; }
public void setReset(String string) {
reset = string; } 
public void setSubmit(String string) {
submit = string; } 


public String getQuestions()
{
StringBuffer sb = new StringBuffer();
if ((values!=null  !values.isEmpty())) {
Iterator it = values.keySet().iterator();
while (it.hasNext()) {
String paramName = (String)it.next();
String paramValue = (String)values.get(paramName);
sb.append(paramName);
sb.append(paramValue);
} } return sb.toString(); 
} 


public void reset(ActionMapping mapping, HttpServletRequest request) {
this.questionName=null; 
this.questionDesc=null; 
} 


public ActionErrors validate(ActionMapping mapping, HttpServletRequest
request) {
ActionErrors errors = new ActionErrors();
return errors; } } 


The following is the action class 


package com.trx.kms.questionbank;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import javax.servlet.http.*;
import javax.servlet.*;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Iterator;

public final class CreateQuestionAction extends Action { 
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws
IOException, ServletException { 
String questions=((CreateQuestionForm)form).getQuestions(); 
ActionErrors errors = new ActionErrors();
if (!errors.isEmpty()) {
saveErrors(request, errors);
return (new ActionForward(mapping.getInput())); }
return (mapping.findForward(success)); }
}



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