• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 426
  • Last Modified:

jsp session variables

Is it possible to insert a session variable as a value in a form? Ive tried this, it gets executed and the value is set buts its not inserted as a value in the form.

<% String p = (String)session.getAttribute("p");
out.print(p)
%>

<input type="text" name= "anam" size = "4" value = "€ "'+p+'"" >
0
wallpaperpaste
Asked:
wallpaperpaste
  • 2
  • 2
1 Solution
 
rrzCommented:
><input type="text" name= "anam" size = "4" value = "€ "'+p+'"" >
instead you could use  
<input type="text" name= "anam" size = "4" value ="<%= '€ ' + p %>" />
rrz
0
 
wallpaperpasteAuthor Commented:
This is what im trying:
value ="<%= + pass %>" "

This is the error im getting:
operator + cannot be applied to java.lang.String


0
 
rrzCommented:
>This is what im trying:
value ="<%= + pass %>" "

maybe you should try  
value ="<%='whatever' + pass %>"
0
 
wallpaperpasteAuthor Commented:
Got it with this:
value ="<%=pass %>

thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now