You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by abhiram <ab...@yahoo.com> on 2007/04/05 15:20:51 UTC

how to set hidden field value to a session attribute ?

hi friends!! 
  im new to struts and im developing a web application using struts and jsp.
   
  in one scenario,i want to set  the value of a string variable of a formbean to a session attribute through jsp.bcoz  form bean is populated only when  formdata is submitted,i wrote a hidden field in the jsp. i dont know how to set the value of a hidden field to a session attribute.
   
  i wrote this in my jsp
   
  <html:html>
   <html:form>
    <!-- some code for uploading here -->
     <html:hidden property="albumId" value="<%= session.getAttribute("albId")"  
           %>
     <html:submit>Upload Files</html:submit>
   </html:form>
  
  </html:html>
   
  in a previous Action class, i set a session attribute to the string albId, and now, i want to send it to a form bean.
   
  the jsp above returnd a compilation error.my appln server is apache tomcat 5.5.9
  the error is like this
   
  org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 57 in the jsp file: /PicUploadForm.jsp
Generated servlet error:
The method setValue(String, Object) in the type TagSupport is not applicable for the arguments (Object)

   
  please suggest how to send my session attribute value into the formbean.


      abhiram




 				
---------------------------------
 Here’s a new way to find what you're looking for - Yahoo! Answers 

Re: how to set hidden field value to a session attribute ?

Posted by Dave Newton <ne...@yahoo.com>.
--- abhiram <ab...@yahoo.com> wrote:
> does it work for struts 1.2

It works on any container that supports JSP 2.0 (which
yours does). 

If your container *doesn't* support JSP 2.0 you can
use the html-el tags.

d.



 
____________________________________________________________________________________
We won't tell. Get more on shows you hate to love 
(and love to hate): Yahoo! TV's Guilty Pleasures list.
http://tv.yahoo.com/collections/265 

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


Re: how to set hidden field value to a session attribute ?

Posted by abhiram <ab...@yahoo.com>.
thanks sir. does it work for struts 1.2 also, as i'm using it.nyways, im new to jsp too and should learn to use custom tags.
  thanks for the quick response.
  abhiram

Dave Newton <ne...@yahoo.com> wrote:
  --- abhiram wrote:
> [...] i dont know how to set the value of a hidden
> field to a session attribute. my appln server is
apache
> tomcat 5.5.9



JSP 2.0 is your friend (as is documentation).

d.




____________________________________________________________________________________
Get your own web address. 
Have a HUGE year through Yahoo! Small Business.
http://smallbusiness.yahoo.com/domains/?p=BESTDEAL

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



 				
---------------------------------
 Here’s a new way to find what you're looking for - Yahoo! Answers 

Re: how to set hidden field value to a session attribute ?

Posted by Dave Newton <ne...@yahoo.com>.
--- abhiram <ab...@yahoo.com> wrote:
> [...] i dont know how to set the value of a hidden
> field to a session attribute. my appln server is
apache
> tomcat 5.5.9

<html:hidden property="albumId" value="${albId"}"/>

JSP 2.0 is your friend (as is documentation).

d.



 
____________________________________________________________________________________
Get your own web address.  
Have a HUGE year through Yahoo! Small Business.
http://smallbusiness.yahoo.com/domains/?p=BESTDEAL

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