You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Yinti, Deepak" <Yi...@AETNA.com> on 2003/05/29 19:34:06 UTC
Hi All,
I am not able to get values in <HTML:OPTIONS> , I am adding values in my
Session thru Controller , but not able to retrieve it in JSP form
I put values in Session like this :-
context.setAttribute(context.SESSION,"OPTION",option);
And try to retrieve values in JSP like this :-
<html:select property="status">
<html:options collection="OPTION"/>
</html:select>
Am I doing something wrong , bcoz I am trying to figure this problem
since long time , but no luck
Can some body please tell me how to get values in <HTML:OPTIONS> when
the values are added to Session thru Servlet.
When I do this <%System.out.println(request.getAttribute("OPTION")); %>
I can see all the values , but not with Struts tags
Thanks in Advance
Deepak
This e-mail may contain confidential or privileged information. If you
think you have received this e-mail in error, please advise the sender by
reply e-mail and then delete this e-mail immediately. Thank you. Aetna
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re:
Posted by Josh McCulloch <jj...@netscape.net>.
What is the error you are getting.
Your message shows you placing a variable in session scope, and then
using a scriptlet to
display a variable in request scope...
Here is some code I find helpful to better debug these situations:
Put this at the bottom of a jsp / footer:
<!--
if(com.whatever.Class.DEBUG_REQUEST)
out.println(com.whatever.Class.getDumpContents(request);
-->
public static String getDumpContents(HttpServletRequest request)
{
StringBuffer content = new StringBuffer(4096);
content.append(dumpRequest(request));
content.append(dumpSession(request.getSession(false)));
return content.toString();
}
public static String dumpSession(HttpSession session)
{
StringBuffer buf = new StringBuffer(1024);
buf.append("*(HttpSession)**************************\n");
// Append non-attribute data here
Enumeration enum = session.getAttributeNames();
while (enum.hasMoreElements())
{
String key = (String)enum.nextElement();
buf.append(key);
buf.append("=\"");
buf.append(session.getAttribute(key));
buf.append("\"\n");
}
buf.append("\n\n");
return buf.toString();
}
public static String dumpRequest(HttpServletRequest request)
{
StringBuffer buf = new StringBuffer(1024);
buf.append("*(HttpRequest)**************************\n");
// Append non-attribute data here
buf.append("\nAttributes:\n");
Enumeration enum = request.getAttributeNames();
while (enum.hasMoreElements())
{
String key = (String)enum.nextElement();
buf.append(key);
buf.append("=\"");
buf.append(request.getAttribute(key));
buf.append("\"\n");
}
buf.append("\nParameters:\n");
enum = request.getParameterNames();
while (enum.hasMoreElements())
{
String key = (String)enum.nextElement();
buf.append(key);
buf.append("=\"");
buf.append(request.getParameter(key));
buf.append("\"\n");
}
buf.append("\nHeaders:\n");
enum = request.getHeaderNames();
while (enum.hasMoreElements())
{
String key = (String)enum.nextElement();
buf.append(key);
buf.append("=\"");
buf.append(request.getHeader(key));
buf.append("\"\n");
}
buf.append("\n\n");
return buf.toString();
}
YintiD@AETNA.com wrote:
>Hi All,
>I am not able to get values in <HTML:OPTIONS> , I am adding values in my
>Session thru Controller , but not able to retrieve it in JSP form
>I put values in Session like this :-
>context.setAttribute(context.SESSION,"OPTION",option);
>
>And try to retrieve values in JSP like this :-
><html:select property="status">
><html:options collection="OPTION"/>
></html:select>
>
>Am I doing something wrong , bcoz I am trying to figure this problem
>since long time , but no luck
>Can some body please tell me how to get values in <HTML:OPTIONS> when
>the values are added to Session thru Servlet.
>When I do this <%System.out.println(request.getAttribute("OPTION")); %>
>I can see all the values , but not with Struts tags
>Thanks in Advance
>Deepak
>
>
>
>This e-mail may contain confidential or privileged information. If you
>think you have received this e-mail in error, please advise the sender by
>reply e-mail and then delete this e-mail immediately. Thank you. Aetna
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
--
Your favorite stores, helpful shopping tools and great gift ideas.
Experience the convenience of buying online with Shop@Netscape!
http://shopnow.netscape.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org