• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

doubt in Session parameters

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can we assign a session variable to a form property

Suppose I have a session variable named "username"........I do the following:


<%
String user=(String) session.getAttribute("username");
if(user==null) user="";
%>

Now can I write:


<jsp:setProperty name="details" property= "*" />

<jsp:setProperty name="details" property="id" value="user" />


If no, then how can I use the session parameter as a form parameter?
 
Ranch Hand
Posts: 212
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use expression in the value attribute of set property, it's allowed

Try


 
Agnit Chatterjee
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks.........I don't know whether it worked or not because when I am sending the value to the java file I still get the same result as follows:
false ACCOUNT NUMBER: 5456
ACCOUNT TYPE:null
USERNAME:null
ID:
BALANCE:null

here are the codes:

viewuserdetails.jsp




detailsproperties.jsp



viewaccountbalance.java

I would be grateful if someone could point out my mistake

Please tell me whether the JSP programs are right and whether the values enter the java file because I have separately run the java file in IDE using specific values and it worked just fine

I am now sure that the value is not entering the java program because I am getting Resultset exhausted
 
Agnit Chatterjee
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
getting exhausted result set when using <jsp:setProperty name="details" property="id" value="${sessionScope.user}" />
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does a result set have to do with your session?
 
Agnit Chatterjee
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have done it.......thanks to everyone who helped!!! Actually the problem was that the session parameter was not being recognized by the bean form..........so I tried the other way round.............I did not use:




What I did was that pass the session parameter as an argument to the Java file and got the result

The problem why I got the resultSet exhausted was that the Java program was not able to recognize one of the parameters and taking it as null for which I was basically getting:




reply
    Bookmark Topic Watch Topic
  • New Topic