RE: How To Output the Value of a String That Is Passed From Another JSP?

2003-12-18 Thread Robert Taylor
I bet your missing the JSTL taglib directive in your page.
Try adding 
%@ taglib uri=http://java.sun.com/jsp/jstl/core; prefix=c % 
and then your c:x .../ actions will work.

 -Original Message-
 From: Caroline Jen [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, December 17, 2003 9:45 PM
 To: Struts Users Mailing List
 Subject: RE: How To Output the Value of a String That Is Passed From
 Another JSP?
 
 
 Thanks for your advice.  I did this in my view.jsp:
 
 html:form action=/list/Message
 c:set var=cr value=${articleForm.creator}
 scope=session/
 c:out value=${cr}/
 html:submitView/Send Messages/html:submit
 /html:form
 bean:write name=articleForm property=creator/
 
 I was able to see the View/Send Messages button
 displayed.  And the bean:write name=articleForm
 property=creator/ also wrote out the value of the
 property creator.
 
 Now, the question is 
 
 1. why the c:set var=cr
 value=${articleForm.creator} scope=session/ did
 not put the value in the session scope?  
 
 2. What is wrong with the c:set   tag?  
 
 3. What should I do if I want to put the value of
 creator in a session scope?
 
 -C
 
 
 --- Robert Taylor [EMAIL PROTECTED] wrote:
  Are you sure that c:set var=cr
  value=${articleForm.creator}
  scope=session/
  is placing the value in the intended scope?
  
  Try doing this:
  
  html:form action=/list/Message
  c:set var=cr
  value=${articleForm.creator}scope=session/
  c:out value=${cr}/
  html:submitView/Send Messages/html:submit
  /html:form
  
  To make sure it is actually putting the value in
  session scope.
  
  If so, then on postForm.jsp try using scriplets to
  make sure that
  the value can be accessed. If it can, then do you
  have all of your
  tag library directives in your pages?
  
  robert
  
   -Original Message-
   From: Caroline Jen [mailto:[EMAIL PROTECTED]
   Sent: Wednesday, December 17, 2003 8:40 PM
   To: Struts Users Mailing List
   Subject: RE: How To Output the Value of a String
  That Is Passed From
   Another JSP?
  
  
   cr is not a form and there is no action
  involved.
   There are two JSPs; view.jsp and postForm.jsp and
  each
   is with its own form (different forms).
  
   In my view.jsp, I am able to write out String
  creator
   this way:
   bean:write name=articleForm
  property=creator/
   and I put the String creator in a session object:
  
  html:form action=/list/Message
  c:set var=cr value=${articleForm.creator}
   scope=session/
  html:submitView/Send Messages/html:submit
  /html:form
  
   and in the postForm.jsp, I retrieve the String and
  try
   to write it out in a text field:
  
 bean:define id=author name=cr
   scope=session type=java.lang.String/
 html:text property=creator
   value=%=author% size=82 maxlength=25
   tabindex=1/
  
   I got this error message:
   ServletException in:/article/content/postForm.jsp]
Cannot find bean cr in scope session'
  
   -Caroline
   --- David Friedman [EMAIL PROTECTED] wrote:
Caroline,
   
How do you save the form cr in session scope?
Does your action use 'scope=session' or are
  you
doing a
'request.getSession().setAttribute(cr,cr);'
in the first action?
   
Regards,
David
   
-Original Message-
From: Caroline Jen [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 17, 2003 8:25 PM
To: Struts Users Mailing List
Subject: RE: How To Output the Value of a String
That Is Passed From
Another JSP?
   
   
Hi, my JSP#1 and JSP#2 use different forms.
However,
property name in JSP#1 is the same as that in
  JSP#2.
   
I tried to pass this Sring and write it out in a
text
field in JSP#2 and just could not get it right. 
  I
got
this error
message:
   
[ServletException
  in:/article/content/postForm.jsp]
Cannot find bean cr in scope session'
   
In my view.jsp, I put a String in a session
  object:
   
   html:form action=/list/Message
   c:set var=cr
  value=${articleForm.creator}
scope=session/
   html:submitView/Send Messages/html:submit
   /html:form
   
And in postForm.jsp, I tried to retrieve that
  String
and write it out in a text field this way:
   
  bean:define id=author name=cr
scope=session type=java.lang.String/
  html:text property=creator
value=%=author% size=82 maxlength=25
tabindex=1/
   
-Caroline
   
--- Robert Taylor [EMAIL PROTECTED] wrote:
 There are a couple (3) ways to do it.

 1. Have both JSP#1 and 2 use the same form
  then
have
 the action that
 processes JSP#1 simply
 forward to JSP#2 and Struts will auto-populate
  the
 field.

 2. Have the action that processes JSP#1
  forward or
 redirect to
JSP#2 whose form has the same property
  name.
 Place the create property
value in the query string and Struts will
 auto-populate the form
in JSP#2.

 3. Have the 

RE: How To Output the Value of a String That Is Passed From Another JSP?

2003-12-18 Thread Robert Taylor
 Hi, thank you for your attention to my problem.  First
 all, I think that I am missing someting.  In order to
 use the c:set  and c:out ...  tags, I think
 that I have to import a taglib into my JSP and assign
 it with a prefix c.  Which taglib should I import? 
 Right now, I have these:
 
 %@ taglib uri=/tags/struts-html prefix=html %
 %@ taglib uri=/tags/struts-bean prefix=bean %
 %@ taglib uri=/tags/struts-logic prefix=logic %
 %@ taglib uri=/tags/tiles prefix=tiles %
 %@ taglib uri=/tags/request prefix=req %

You are missing this one:
%@ taglib uri=http://java.sun.com/jsp/jstl/core; prefix=c % 

 
 Second, 
 
 html:form action=/list/Message
 c:set var=cr value=${articleForm.creator}
 scope=session/
 c:out value=${cr}/
 html:submitView/Send Messages/html:submit
 /html:form
 %-- The statement below has no problem to write on
 the value --%
 bean:write name=articleForm property=creator/
That's because you were missing the JSTL taglib directive
above.


 
 Third, the mapping to the next JSP is:
 
 action
 roles=administrator,editor,contributor
 path=/list/Message
 forward=.message.Form
 name=postForm
 scope=session
 validate=false/
 
Why are you defining an action path at all.
Once you add the JSTL taglib directive the following
line places the value in the session. There is no
need to submit.

c:set var=cr value=${articleForm.creator} scope=session/


 Fourth, in the postForm.jsp, I try to retrieve the
 value of the String that is passed in a session object
 and print it out in a text field:
 
 bean:define id=author name=cr scope=session
 type=java.lang.String/
 html:text property=creator value=%=author%
 size=82 maxlength=25 tabindex=1/
 
You could use Struts-EL and do something like:
html_el:text property=creator value=${cr}/

The Struts-EL taglib and jar file can be found in the /contrib directory
of the Struts distribution.


 Fifth, the error message is that cr cannot be found
 in the session scope.
 
Once again, this is because the JSTL taglib directive is missing.


 -Caroline
 
 --- Robert Taylor [EMAIL PROTECTED] wrote:
  What exactly are you trying to accomplish? What's
  the
  high level view?
  
  If you can explain your intent, maybe we can suggest
  an easier
  way to accomplish your goal.
  
  Is articleForm associated with action mapping
  /list/Message?
  If so, then you could do something like:
  
  html:form action=/list/Message
  html:hidden property=creator/
  html:submitView/Send Messages/html:submit
  /html:form
  
  This of course, assumes you have already populated
  creator in
  articleForm in some other action using the same
  form.
  
  
  The action with mapping /list/Message, which
  processes articleForm could
  do something like:
  
  MyForm articleForm = (MyForm) form;
  String creator = articleForm.getCreator();
  request.getSession().setAttribute(creator,
  creator);
  return mapping.findForward(success);
  
  
  In JSP#2 you could do something like this:
  c:out value=${creator}/
  
  robert
  
  
   -Original Message-
   From: Caroline Jen [mailto:[EMAIL PROTECTED]
   Sent: Wednesday, December 17, 2003 8:25 PM
   To: Struts Users Mailing List
   Subject: RE: How To Output the Value of a String
  That Is Passed From
   Another JSP?
  
  
   Hi, my JSP#1 and JSP#2 use different forms. 
  However,
   property name in JSP#1 is the same as that in
  JSP#2.
   I tried to pass this Sring and write it out in a
  text
   field in JSP#2 and just could not get it right.  I
  got
   this error
   message:
  
   [ServletException
  in:/article/content/postForm.jsp]
   Cannot find bean cr in scope session'
  
   In my view.jsp, I put a String in a session
  object:
  
  html:form action=/list/Message
  c:set var=cr value=${articleForm.creator}
   scope=session/
  html:submitView/Send Messages/html:submit
  /html:form
  
   And in postForm.jsp, I tried to retrieve that
  String
   and write it out in a text field this way:
  
 bean:define id=author name=cr
   scope=session type=java.lang.String/
 html:text property=creator
   value=%=author% size=82 maxlength=25
   tabindex=1/
  
   -Caroline
  
   --- Robert Taylor [EMAIL PROTECTED] wrote:
There are a couple (3) ways to do it.
   
1. Have both JSP#1 and 2 use the same form then
  have
the action that
processes JSP#1 simply
forward to JSP#2 and Struts will auto-populate
  the
field.
   
2. Have the action that processes JSP#1 forward
  or
redirect to
   JSP#2 whose form has the same property name.
Place the create property
   value in the query string and Struts will
auto-populate the form
   in JSP#2.
   
3. Have the action that processes JSP#1 access
  and
populate the form used
   in JSP#2 with the property then forward to
  JSP#2.
   
robert
   
 -Original Message-
 From: Caroline Jen
  [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, December 16, 2003 

RE: How To Output the Value of a String That Is Passed From Another JSP?

2003-12-18 Thread Caroline Jen
Thank you for your time and support.  It is the JSTL
taglib directive I missed in my page.  Now, everything
works as expected.
--- Robert Taylor [EMAIL PROTECTED] wrote:
 I bet your missing the JSTL taglib directive in your
 page.
 Try adding 
 %@ taglib uri=http://java.sun.com/jsp/jstl/core;
 prefix=c % 
 and then your c:x .../ actions will work.
 
  -Original Message-
  From: Caroline Jen [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, December 17, 2003 9:45 PM
  To: Struts Users Mailing List
  Subject: RE: How To Output the Value of a String
 That Is Passed From
  Another JSP?
  
  
  Thanks for your advice.  I did this in my
 view.jsp:
  
  html:form action=/list/Message
  c:set var=cr value=${articleForm.creator}
  scope=session/
  c:out value=${cr}/
  html:submitView/Send Messages/html:submit
  /html:form
  bean:write name=articleForm
 property=creator/
  
  I was able to see the View/Send Messages button
  displayed.  And the bean:write name=articleForm
  property=creator/ also wrote out the value of
 the
  property creator.
  
  Now, the question is 
  
  1. why the c:set var=cr
  value=${articleForm.creator} scope=session/
 did
  not put the value in the session scope?  
  
  2. What is wrong with the c:set   tag?  
  
  3. What should I do if I want to put the value of
  creator in a session scope?
  
  -C
  
  
  --- Robert Taylor [EMAIL PROTECTED] wrote:
   Are you sure that c:set var=cr
   value=${articleForm.creator}
   scope=session/
   is placing the value in the intended scope?
   
   Try doing this:
   
   html:form action=/list/Message
   c:set var=cr
   value=${articleForm.creator}scope=session/
   c:out value=${cr}/
   html:submitView/Send Messages/html:submit
   /html:form
   
   To make sure it is actually putting the value in
   session scope.
   
   If so, then on postForm.jsp try using scriplets
 to
   make sure that
   the value can be accessed. If it can, then do
 you
   have all of your
   tag library directives in your pages?
   
   robert
   
-Original Message-
From: Caroline Jen
 [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 17, 2003 8:40 PM
To: Struts Users Mailing List
Subject: RE: How To Output the Value of a
 String
   That Is Passed From
Another JSP?
   
   
cr is not a form and there is no action
   involved.
There are two JSPs; view.jsp and postForm.jsp
 and
   each
is with its own form (different forms).
   
In my view.jsp, I am able to write out String
   creator
this way:
bean:write name=articleForm
   property=creator/
and I put the String creator in a session
 object:
   
   html:form action=/list/Message
   c:set var=cr
 value=${articleForm.creator}
scope=session/
   html:submitView/Send
 Messages/html:submit
   /html:form
   
and in the postForm.jsp, I retrieve the String
 and
   try
to write it out in a text field:
   
  bean:define id=author name=cr
scope=session type=java.lang.String/
  html:text property=creator
value=%=author% size=82 maxlength=25
tabindex=1/
   
I got this error message:
ServletException
 in:/article/content/postForm.jsp]
 Cannot find bean cr in scope session'
   
-Caroline
--- David Friedman [EMAIL PROTECTED]
 wrote:
 Caroline,

 How do you save the form cr in session
 scope?
 Does your action use 'scope=session' or
 are
   you
 doing a

 'request.getSession().setAttribute(cr,cr);'
 in the first action?

 Regards,
 David

 -Original Message-
 From: Caroline Jen
 [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, December 17, 2003 8:25 PM
 To: Struts Users Mailing List
 Subject: RE: How To Output the Value of a
 String
 That Is Passed From
 Another JSP?


 Hi, my JSP#1 and JSP#2 use different forms.
 However,
 property name in JSP#1 is the same as that
 in
   JSP#2.

 I tried to pass this Sring and write it out
 in a
 text
 field in JSP#2 and just could not get it
 right. 
   I
 got
 this error
 message:

 [ServletException
   in:/article/content/postForm.jsp]
 Cannot find bean cr in scope session'

 In my view.jsp, I put a String in a session
   object:

html:form action=/list/Message
c:set var=cr
   value=${articleForm.creator}
 scope=session/
html:submitView/Send
 Messages/html:submit
/html:form

 And in postForm.jsp, I tried to retrieve
 that
   String
 and write it out in a text field this way:

   bean:define id=author name=cr
 scope=session type=java.lang.String/
   html:text property=creator
 value=%=author% size=82 maxlength=25
 tabindex=1/

 -Caroline

 --- Robert Taylor [EMAIL PROTECTED]
 wrote:
 
=== message truncated ===


__
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.

RE: How To Output the Value of a String That Is Passed From Another JSP?

2003-12-17 Thread Caroline Jen
Hi, my JSP#1 and JSP#2 use different forms.  However,
property name in JSP#1 is the same as that in JSP#2. 
I tried to pass this Sring and write it out in a text
field in JSP#2 and just could not get it right.  I got
this error
message:

[ServletException in:/article/content/postForm.jsp]
Cannot find bean cr in scope session' 

In my view.jsp, I put a String in a session object:

   html:form action=/list/Message
   c:set var=cr value=${articleForm.creator}
scope=session/
   html:submitView/Send Messages/html:submit
   /html:form

And in postForm.jsp, I tried to retrieve that String
and write it out in a text field this way:

  bean:define id=author name=cr
scope=session type=java.lang.String/
  html:text property=creator
value=%=author% size=82 maxlength=25
tabindex=1/

-Caroline
 
--- Robert Taylor [EMAIL PROTECTED] wrote:
 There are a couple (3) ways to do it.
 
 1. Have both JSP#1 and 2 use the same form then have
 the action that
 processes JSP#1 simply
 forward to JSP#2 and Struts will auto-populate the
 field.
 
 2. Have the action that processes JSP#1 forward or
 redirect to
JSP#2 whose form has the same property name.
 Place the create property
value in the query string and Struts will
 auto-populate the form
in JSP#2.
 
 3. Have the action that processes JSP#1 access and
 populate the form used
in JSP#2 with the property then forward to JSP#2.
 
 robert
 
  -Original Message-
  From: Caroline Jen [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, December 16, 2003 8:33 PM
  To: [EMAIL PROTECTED]
  Subject: How To Output the Value Of a Hidden
 Field?
 
 
  My JSP #2 receives a hidden field passed from JSP
 #1:
  html:hidden property=creator/
 
  In the JSP #2, I have a text field:
  html:text property=creator size=82
 maxlength=25
  tabindex=1/
 
  and I want the value of the hidden field to be the
  text in the text field of the JSP #2.  Please
 advise
  how to do it?
 
  __
  Do you Yahoo!?
  New Yahoo! Photos - easier uploading and sharing.
  http://photos.yahoo.com/
 
 

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

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


__
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

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



RE: How To Output the Value of a String That Is Passed From Another JSP?

2003-12-17 Thread David Friedman
Caroline,

How do you save the form cr in session scope?
Does your action use 'scope=session' or are you
doing a 'request.getSession().setAttribute(cr,cr);'
in the first action?

Regards,
David

-Original Message-
From: Caroline Jen [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 17, 2003 8:25 PM
To: Struts Users Mailing List
Subject: RE: How To Output the Value of a String That Is Passed From
Another JSP?


Hi, my JSP#1 and JSP#2 use different forms.  However,
property name in JSP#1 is the same as that in JSP#2. 
I tried to pass this Sring and write it out in a text
field in JSP#2 and just could not get it right.  I got
this error
message:

[ServletException in:/article/content/postForm.jsp]
Cannot find bean cr in scope session' 

In my view.jsp, I put a String in a session object:

   html:form action=/list/Message
   c:set var=cr value=${articleForm.creator}
scope=session/
   html:submitView/Send Messages/html:submit
   /html:form

And in postForm.jsp, I tried to retrieve that String
and write it out in a text field this way:

  bean:define id=author name=cr
scope=session type=java.lang.String/
  html:text property=creator
value=%=author% size=82 maxlength=25
tabindex=1/

-Caroline
 
--- Robert Taylor [EMAIL PROTECTED] wrote:
 There are a couple (3) ways to do it.
 
 1. Have both JSP#1 and 2 use the same form then have
 the action that
 processes JSP#1 simply
 forward to JSP#2 and Struts will auto-populate the
 field.
 
 2. Have the action that processes JSP#1 forward or
 redirect to
JSP#2 whose form has the same property name.
 Place the create property
value in the query string and Struts will
 auto-populate the form
in JSP#2.
 
 3. Have the action that processes JSP#1 access and
 populate the form used
in JSP#2 with the property then forward to JSP#2.
 
 robert
 
  -Original Message-
  From: Caroline Jen [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, December 16, 2003 8:33 PM
  To: [EMAIL PROTECTED]
  Subject: How To Output the Value Of a Hidden
 Field?
 
 
  My JSP #2 receives a hidden field passed from JSP
 #1:
  html:hidden property=creator/
 
  In the JSP #2, I have a text field:
  html:text property=creator size=82
 maxlength=25
  tabindex=1/
 
  and I want the value of the hidden field to be the
  text in the text field of the JSP #2.  Please
 advise
  how to do it?
 
  __
  Do you Yahoo!?
  New Yahoo! Photos - easier uploading and sharing.
  http://photos.yahoo.com/
 
 

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

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


__
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

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


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



RE: How To Output the Value of a String That Is Passed From Another JSP?

2003-12-17 Thread Caroline Jen
cr is not a form and there is no action involved. 
There are two JSPs; view.jsp and postForm.jsp and each
is with its own form (different forms).

In my view.jsp, I am able to write out String creator
this way:
bean:write name=articleForm property=creator/
and I put the String creator in a session object: 

   html:form action=/list/Message
   c:set var=cr value=${articleForm.creator}
scope=session/
   html:submitView/Send Messages/html:submit
   /html:form

and in the postForm.jsp, I retrieve the String and try
to write it out in a text field:

  bean:define id=author name=cr
scope=session type=java.lang.String/
  html:text property=creator
value=%=author% size=82 maxlength=25
tabindex=1/

I got this error message:
ServletException in:/article/content/postForm.jsp]
 Cannot find bean cr in scope session' 

-Caroline
--- David Friedman [EMAIL PROTECTED] wrote:
 Caroline,
 
 How do you save the form cr in session scope?
 Does your action use 'scope=session' or are you
 doing a
 'request.getSession().setAttribute(cr,cr);'
 in the first action?
 
 Regards,
 David
 
 -Original Message-
 From: Caroline Jen [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, December 17, 2003 8:25 PM
 To: Struts Users Mailing List
 Subject: RE: How To Output the Value of a String
 That Is Passed From
 Another JSP?
 
 
 Hi, my JSP#1 and JSP#2 use different forms. 
 However,
 property name in JSP#1 is the same as that in JSP#2.
 
 I tried to pass this Sring and write it out in a
 text
 field in JSP#2 and just could not get it right.  I
 got
 this error
 message:
 
 [ServletException in:/article/content/postForm.jsp]
 Cannot find bean cr in scope session' 
 
 In my view.jsp, I put a String in a session object:
 
html:form action=/list/Message
c:set var=cr value=${articleForm.creator}
 scope=session/
html:submitView/Send Messages/html:submit
/html:form
 
 And in postForm.jsp, I tried to retrieve that String
 and write it out in a text field this way:
 
   bean:define id=author name=cr
 scope=session type=java.lang.String/
   html:text property=creator
 value=%=author% size=82 maxlength=25
 tabindex=1/
 
 -Caroline
  
 --- Robert Taylor [EMAIL PROTECTED] wrote:
  There are a couple (3) ways to do it.
  
  1. Have both JSP#1 and 2 use the same form then
 have
  the action that
  processes JSP#1 simply
  forward to JSP#2 and Struts will auto-populate the
  field.
  
  2. Have the action that processes JSP#1 forward or
  redirect to
 JSP#2 whose form has the same property name.
  Place the create property
 value in the query string and Struts will
  auto-populate the form
 in JSP#2.
  
  3. Have the action that processes JSP#1 access and
  populate the form used
 in JSP#2 with the property then forward to
 JSP#2.
  
  robert
  
   -Original Message-
   From: Caroline Jen [mailto:[EMAIL PROTECTED]
   Sent: Tuesday, December 16, 2003 8:33 PM
   To: [EMAIL PROTECTED]
   Subject: How To Output the Value Of a Hidden
  Field?
  
  
   My JSP #2 receives a hidden field passed from
 JSP
  #1:
   html:hidden property=creator/
  
   In the JSP #2, I have a text field:
   html:text property=creator size=82
  maxlength=25
   tabindex=1/
  
   and I want the value of the hidden field to be
 the
   text in the text field of the JSP #2.  Please
  advise
   how to do it?
  
   __
   Do you Yahoo!?
   New Yahoo! Photos - easier uploading and
 sharing.
   http://photos.yahoo.com/
  
  
 

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

-
  To unsubscribe, e-mail:
  [EMAIL PROTECTED]
  For additional commands, e-mail:
  [EMAIL PROTECTED]
  
 
 
 __
 Do you Yahoo!?
 New Yahoo! Photos - easier uploading and sharing.
 http://photos.yahoo.com/
 

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

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


__
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

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



RE: How To Output the Value of a String That Is Passed From Another JSP?

2003-12-17 Thread Robert Taylor
What exactly are you trying to accomplish? What's the
high level view?

If you can explain your intent, maybe we can suggest an easier
way to accomplish your goal.

Is articleForm associated with action mapping /list/Message?
If so, then you could do something like:

html:form action=/list/Message
html:hidden property=creator/
html:submitView/Send Messages/html:submit
/html:form

This of course, assumes you have already populated creator in
articleForm in some other action using the same form.


The action with mapping /list/Message, which processes articleForm could
do something like:

MyForm articleForm = (MyForm) form;
String creator = articleForm.getCreator();
request.getSession().setAttribute(creator, creator);
return mapping.findForward(success);


In JSP#2 you could do something like this:
c:out value=${creator}/

robert


 -Original Message-
 From: Caroline Jen [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, December 17, 2003 8:25 PM
 To: Struts Users Mailing List
 Subject: RE: How To Output the Value of a String That Is Passed From
 Another JSP?


 Hi, my JSP#1 and JSP#2 use different forms.  However,
 property name in JSP#1 is the same as that in JSP#2.
 I tried to pass this Sring and write it out in a text
 field in JSP#2 and just could not get it right.  I got
 this error
 message:

 [ServletException in:/article/content/postForm.jsp]
 Cannot find bean cr in scope session'

 In my view.jsp, I put a String in a session object:

html:form action=/list/Message
c:set var=cr value=${articleForm.creator}
 scope=session/
html:submitView/Send Messages/html:submit
/html:form

 And in postForm.jsp, I tried to retrieve that String
 and write it out in a text field this way:

   bean:define id=author name=cr
 scope=session type=java.lang.String/
   html:text property=creator
 value=%=author% size=82 maxlength=25
 tabindex=1/

 -Caroline

 --- Robert Taylor [EMAIL PROTECTED] wrote:
  There are a couple (3) ways to do it.
 
  1. Have both JSP#1 and 2 use the same form then have
  the action that
  processes JSP#1 simply
  forward to JSP#2 and Struts will auto-populate the
  field.
 
  2. Have the action that processes JSP#1 forward or
  redirect to
 JSP#2 whose form has the same property name.
  Place the create property
 value in the query string and Struts will
  auto-populate the form
 in JSP#2.
 
  3. Have the action that processes JSP#1 access and
  populate the form used
 in JSP#2 with the property then forward to JSP#2.
 
  robert
 
   -Original Message-
   From: Caroline Jen [mailto:[EMAIL PROTECTED]
   Sent: Tuesday, December 16, 2003 8:33 PM
   To: [EMAIL PROTECTED]
   Subject: How To Output the Value Of a Hidden
  Field?
  
  
   My JSP #2 receives a hidden field passed from JSP
  #1:
   html:hidden property=creator/
  
   In the JSP #2, I have a text field:
   html:text property=creator size=82
  maxlength=25
   tabindex=1/
  
   and I want the value of the hidden field to be the
   text in the text field of the JSP #2.  Please
  advise
   how to do it?
  
   __
   Do you Yahoo!?
   New Yahoo! Photos - easier uploading and sharing.
   http://photos.yahoo.com/
  
  
 
 -
   To unsubscribe, e-mail:
  [EMAIL PROTECTED]
   For additional commands, e-mail:
  [EMAIL PROTECTED]
  
 
 
 
 -
  To unsubscribe, e-mail:
  [EMAIL PROTECTED]
  For additional commands, e-mail:
  [EMAIL PROTECTED]
 


 __
 Do you Yahoo!?
 New Yahoo! Photos - easier uploading and sharing.
 http://photos.yahoo.com/

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



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



RE: How To Output the Value of a String That Is Passed From Another JSP?

2003-12-17 Thread Robert Taylor
Are you sure that c:set var=cr value=${articleForm.creator}
scope=session/
is placing the value in the intended scope?

Try doing this:

html:form action=/list/Message
c:set var=cr value=${articleForm.creator}scope=session/
c:out value=${cr}/
html:submitView/Send Messages/html:submit
/html:form

To make sure it is actually putting the value in session scope.

If so, then on postForm.jsp try using scriplets to make sure that
the value can be accessed. If it can, then do you have all of your
tag library directives in your pages?

robert

 -Original Message-
 From: Caroline Jen [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, December 17, 2003 8:40 PM
 To: Struts Users Mailing List
 Subject: RE: How To Output the Value of a String That Is Passed From
 Another JSP?


 cr is not a form and there is no action involved.
 There are two JSPs; view.jsp and postForm.jsp and each
 is with its own form (different forms).

 In my view.jsp, I am able to write out String creator
 this way:
 bean:write name=articleForm property=creator/
 and I put the String creator in a session object:

html:form action=/list/Message
c:set var=cr value=${articleForm.creator}
 scope=session/
html:submitView/Send Messages/html:submit
/html:form

 and in the postForm.jsp, I retrieve the String and try
 to write it out in a text field:

   bean:define id=author name=cr
 scope=session type=java.lang.String/
   html:text property=creator
 value=%=author% size=82 maxlength=25
 tabindex=1/

 I got this error message:
 ServletException in:/article/content/postForm.jsp]
  Cannot find bean cr in scope session'

 -Caroline
 --- David Friedman [EMAIL PROTECTED] wrote:
  Caroline,
 
  How do you save the form cr in session scope?
  Does your action use 'scope=session' or are you
  doing a
  'request.getSession().setAttribute(cr,cr);'
  in the first action?
 
  Regards,
  David
 
  -Original Message-
  From: Caroline Jen [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, December 17, 2003 8:25 PM
  To: Struts Users Mailing List
  Subject: RE: How To Output the Value of a String
  That Is Passed From
  Another JSP?
 
 
  Hi, my JSP#1 and JSP#2 use different forms.
  However,
  property name in JSP#1 is the same as that in JSP#2.
 
  I tried to pass this Sring and write it out in a
  text
  field in JSP#2 and just could not get it right.  I
  got
  this error
  message:
 
  [ServletException in:/article/content/postForm.jsp]
  Cannot find bean cr in scope session'
 
  In my view.jsp, I put a String in a session object:
 
 html:form action=/list/Message
 c:set var=cr value=${articleForm.creator}
  scope=session/
 html:submitView/Send Messages/html:submit
 /html:form
 
  And in postForm.jsp, I tried to retrieve that String
  and write it out in a text field this way:
 
bean:define id=author name=cr
  scope=session type=java.lang.String/
html:text property=creator
  value=%=author% size=82 maxlength=25
  tabindex=1/
 
  -Caroline
 
  --- Robert Taylor [EMAIL PROTECTED] wrote:
   There are a couple (3) ways to do it.
  
   1. Have both JSP#1 and 2 use the same form then
  have
   the action that
   processes JSP#1 simply
   forward to JSP#2 and Struts will auto-populate the
   field.
  
   2. Have the action that processes JSP#1 forward or
   redirect to
  JSP#2 whose form has the same property name.
   Place the create property
  value in the query string and Struts will
   auto-populate the form
  in JSP#2.
  
   3. Have the action that processes JSP#1 access and
   populate the form used
  in JSP#2 with the property then forward to
  JSP#2.
  
   robert
  
-Original Message-
From: Caroline Jen [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 16, 2003 8:33 PM
To: [EMAIL PROTECTED]
Subject: How To Output the Value Of a Hidden
   Field?
   
   
My JSP #2 receives a hidden field passed from
  JSP
   #1:
html:hidden property=creator/
   
In the JSP #2, I have a text field:
html:text property=creator size=82
   maxlength=25
tabindex=1/
   
and I want the value of the hidden field to be
  the
text in the text field of the JSP #2.  Please
   advise
how to do it?
   
__
Do you Yahoo!?
New Yahoo! Photos - easier uploading and
  sharing.
http://photos.yahoo.com/
   
   
  
 
 -
To unsubscribe, e-mail:
   [EMAIL PROTECTED]
For additional commands, e-mail:
   [EMAIL PROTECTED]
   
  
  
  
 
 -
   To unsubscribe, e-mail:
   [EMAIL PROTECTED]
   For additional commands, e-mail:
   [EMAIL PROTECTED]
  
 
 
  __
  Do you Yahoo!?
  New Yahoo! Photos - easier uploading and sharing.
  http://photos.yahoo.com/
 
 
 -
  To unsubscribe, e-mail:
  [EMAIL 

RE: How To Output the Value of a String That Is Passed From Another JSP?

2003-12-17 Thread Caroline Jen
Thanks for your advice.  I did this in my view.jsp:

html:form action=/list/Message
c:set var=cr value=${articleForm.creator}
scope=session/
c:out value=${cr}/
html:submitView/Send Messages/html:submit
/html:form
bean:write name=articleForm property=creator/

I was able to see the View/Send Messages button
displayed.  And the bean:write name=articleForm
property=creator/ also wrote out the value of the
property creator.

Now, the question is 

1. why the c:set var=cr
value=${articleForm.creator} scope=session/ did
not put the value in the session scope?  

2. What is wrong with the c:set   tag?  

3. What should I do if I want to put the value of
creator in a session scope?

-C


--- Robert Taylor [EMAIL PROTECTED] wrote:
 Are you sure that c:set var=cr
 value=${articleForm.creator}
 scope=session/
 is placing the value in the intended scope?
 
 Try doing this:
 
 html:form action=/list/Message
 c:set var=cr
 value=${articleForm.creator}scope=session/
 c:out value=${cr}/
 html:submitView/Send Messages/html:submit
 /html:form
 
 To make sure it is actually putting the value in
 session scope.
 
 If so, then on postForm.jsp try using scriplets to
 make sure that
 the value can be accessed. If it can, then do you
 have all of your
 tag library directives in your pages?
 
 robert
 
  -Original Message-
  From: Caroline Jen [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, December 17, 2003 8:40 PM
  To: Struts Users Mailing List
  Subject: RE: How To Output the Value of a String
 That Is Passed From
  Another JSP?
 
 
  cr is not a form and there is no action
 involved.
  There are two JSPs; view.jsp and postForm.jsp and
 each
  is with its own form (different forms).
 
  In my view.jsp, I am able to write out String
 creator
  this way:
  bean:write name=articleForm
 property=creator/
  and I put the String creator in a session object:
 
 html:form action=/list/Message
 c:set var=cr value=${articleForm.creator}
  scope=session/
 html:submitView/Send Messages/html:submit
 /html:form
 
  and in the postForm.jsp, I retrieve the String and
 try
  to write it out in a text field:
 
bean:define id=author name=cr
  scope=session type=java.lang.String/
html:text property=creator
  value=%=author% size=82 maxlength=25
  tabindex=1/
 
  I got this error message:
  ServletException in:/article/content/postForm.jsp]
   Cannot find bean cr in scope session'
 
  -Caroline
  --- David Friedman [EMAIL PROTECTED] wrote:
   Caroline,
  
   How do you save the form cr in session scope?
   Does your action use 'scope=session' or are
 you
   doing a
   'request.getSession().setAttribute(cr,cr);'
   in the first action?
  
   Regards,
   David
  
   -Original Message-
   From: Caroline Jen [mailto:[EMAIL PROTECTED]
   Sent: Wednesday, December 17, 2003 8:25 PM
   To: Struts Users Mailing List
   Subject: RE: How To Output the Value of a String
   That Is Passed From
   Another JSP?
  
  
   Hi, my JSP#1 and JSP#2 use different forms.
   However,
   property name in JSP#1 is the same as that in
 JSP#2.
  
   I tried to pass this Sring and write it out in a
   text
   field in JSP#2 and just could not get it right. 
 I
   got
   this error
   message:
  
   [ServletException
 in:/article/content/postForm.jsp]
   Cannot find bean cr in scope session'
  
   In my view.jsp, I put a String in a session
 object:
  
  html:form action=/list/Message
  c:set var=cr
 value=${articleForm.creator}
   scope=session/
  html:submitView/Send Messages/html:submit
  /html:form
  
   And in postForm.jsp, I tried to retrieve that
 String
   and write it out in a text field this way:
  
 bean:define id=author name=cr
   scope=session type=java.lang.String/
 html:text property=creator
   value=%=author% size=82 maxlength=25
   tabindex=1/
  
   -Caroline
  
   --- Robert Taylor [EMAIL PROTECTED] wrote:
There are a couple (3) ways to do it.
   
1. Have both JSP#1 and 2 use the same form
 then
   have
the action that
processes JSP#1 simply
forward to JSP#2 and Struts will auto-populate
 the
field.
   
2. Have the action that processes JSP#1
 forward or
redirect to
   JSP#2 whose form has the same property
 name.
Place the create property
   value in the query string and Struts will
auto-populate the form
   in JSP#2.
   
3. Have the action that processes JSP#1 access
 and
populate the form used
   in JSP#2 with the property then forward to
   JSP#2.
   
robert
   
 -Original Message-
 From: Caroline Jen
 [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, December 16, 2003 8:33 PM
 To: [EMAIL PROTECTED]
 Subject: How To Output the Value Of a Hidden
Field?


 My JSP #2 receives a hidden field passed
 from
   JSP
#1:
 html:hidden property=creator/

 In the JSP #2, I have a text field:
 html:text property=creator size=82
maxlength=25
 tabindex=1/

 

RE: How To Output the Value of a String That Is Passed From Another JSP?

2003-12-17 Thread Caroline Jen
Hi, thank you for your attention to my problem.  First
all, I think that I am missing someting.  In order to
use the c:set  and c:out ...  tags, I think
that I have to import a taglib into my JSP and assign
it with a prefix c.  Which taglib should I import? 
Right now, I have these:

%@ taglib uri=/tags/struts-html prefix=html %
%@ taglib uri=/tags/struts-bean prefix=bean %
%@ taglib uri=/tags/struts-logic prefix=logic %
%@ taglib uri=/tags/tiles prefix=tiles %
%@ taglib uri=/tags/request prefix=req %

Second, 

html:form action=/list/Message
c:set var=cr value=${articleForm.creator}
scope=session/
c:out value=${cr}/
html:submitView/Send Messages/html:submit
/html:form
%-- The statement below has no problem to write on
the value --%
bean:write name=articleForm property=creator/

Third, the mapping to the next JSP is:

action
roles=administrator,editor,contributor
path=/list/Message
forward=.message.Form
name=postForm
scope=session
validate=false/

Fourth, in the postForm.jsp, I try to retrieve the
value of the String that is passed in a session object
and print it out in a text field:

bean:define id=author name=cr scope=session
type=java.lang.String/
html:text property=creator value=%=author%
size=82 maxlength=25 tabindex=1/

Fifth, the error message is that cr cannot be found
in the session scope.

-Caroline

--- Robert Taylor [EMAIL PROTECTED] wrote:
 What exactly are you trying to accomplish? What's
 the
 high level view?
 
 If you can explain your intent, maybe we can suggest
 an easier
 way to accomplish your goal.
 
 Is articleForm associated with action mapping
 /list/Message?
 If so, then you could do something like:
 
 html:form action=/list/Message
 html:hidden property=creator/
 html:submitView/Send Messages/html:submit
 /html:form
 
 This of course, assumes you have already populated
 creator in
 articleForm in some other action using the same
 form.
 
 
 The action with mapping /list/Message, which
 processes articleForm could
 do something like:
 
 MyForm articleForm = (MyForm) form;
 String creator = articleForm.getCreator();
 request.getSession().setAttribute(creator,
 creator);
 return mapping.findForward(success);
 
 
 In JSP#2 you could do something like this:
 c:out value=${creator}/
 
 robert
 
 
  -Original Message-
  From: Caroline Jen [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, December 17, 2003 8:25 PM
  To: Struts Users Mailing List
  Subject: RE: How To Output the Value of a String
 That Is Passed From
  Another JSP?
 
 
  Hi, my JSP#1 and JSP#2 use different forms. 
 However,
  property name in JSP#1 is the same as that in
 JSP#2.
  I tried to pass this Sring and write it out in a
 text
  field in JSP#2 and just could not get it right.  I
 got
  this error
  message:
 
  [ServletException
 in:/article/content/postForm.jsp]
  Cannot find bean cr in scope session'
 
  In my view.jsp, I put a String in a session
 object:
 
 html:form action=/list/Message
 c:set var=cr value=${articleForm.creator}
  scope=session/
 html:submitView/Send Messages/html:submit
 /html:form
 
  And in postForm.jsp, I tried to retrieve that
 String
  and write it out in a text field this way:
 
bean:define id=author name=cr
  scope=session type=java.lang.String/
html:text property=creator
  value=%=author% size=82 maxlength=25
  tabindex=1/
 
  -Caroline
 
  --- Robert Taylor [EMAIL PROTECTED] wrote:
   There are a couple (3) ways to do it.
  
   1. Have both JSP#1 and 2 use the same form then
 have
   the action that
   processes JSP#1 simply
   forward to JSP#2 and Struts will auto-populate
 the
   field.
  
   2. Have the action that processes JSP#1 forward
 or
   redirect to
  JSP#2 whose form has the same property name.
   Place the create property
  value in the query string and Struts will
   auto-populate the form
  in JSP#2.
  
   3. Have the action that processes JSP#1 access
 and
   populate the form used
  in JSP#2 with the property then forward to
 JSP#2.
  
   robert
  
-Original Message-
From: Caroline Jen
 [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 16, 2003 8:33 PM
To: [EMAIL PROTECTED]
Subject: How To Output the Value Of a Hidden
   Field?
   
   
My JSP #2 receives a hidden field passed from
 JSP
   #1:
html:hidden property=creator/
   
In the JSP #2, I have a text field:
html:text property=creator size=82
   maxlength=25
tabindex=1/
   
and I want the value of the hidden field to be
 the
text in the text field of the JSP #2.  Please
   advise
how to do it?
   
__
Do you Yahoo!?
New Yahoo! Photos - easier uploading and
 sharing.
http://photos.yahoo.com/
   
   
  
 

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