• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Using setAttibute for send parameters to the servlet

 
Ranch Hand
Posts: 1329
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Im coding like this:



And the I try to send the "from" value to my controller like this:



When I press the link and chech the HTML generated it looks like this:



It is not getting the value of the request which I suppose is been set at the setAttribute line of code.


Any idea?

Regards,
Isaac
 
Sheriff
Posts: 67266
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mixing scriptlets with JSTL and EL is a big mess. I suggest against it.

That said, what's up with <c:out value="${request.getAttribute('from')}"/>?

Any reason it's not just <c:out value="${from}"/>?

Or, if the string is trusted, just ${from}?

Why are you still using scriptlets in a page that's enabled for JSTL and EL?
 
Angus Ferguson
Ranch Hand
Posts: 1329
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now it works fine, when using this:



 
Bear Bibeault
Sheriff
Posts: 67266
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But really, ditch the scriptlets. (Unless that was just for testing? In which case, <c:set> would be a better choice.)
 
Angus Ferguson
Ranch Hand
Posts: 1329
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oki, yes I will do it
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!