Win a copy of Head First Android this week in the Android forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

How to call a Java method within <c:if>?

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have been trying to call a method within <c:if>, but then it threw me Scripting elements ( <%!, <jsp:declaration, <%=, <jsp:expression, <%, <jsp:scriptlet ) are disallowed here...at

The code is given below:
<c:if test="${actionbean.commiterrormsg eq 'connection closed'}" >
<%
actionbean.startTransaction();
%>
</c:if>

What I am doing here is to check if error msg is "connection closed", if it is then I need to call the method startTransaction in ActionBean class.

Can someone pleaseeeeeeeeee help me.. Seems like it does not allow scriplets with <c:if>...


Thanks a ton in advance
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do it in a Java class.
 
Sheriff
Posts: 67595
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
The whole purpose of the JSTL and EL is to eliminate scriptlets from JSP pages, They are not meant to be used together, and mixing them in a page just makes a mess.

Processing should occur in the page controller, before the JSP page is forwarded to.
 
Anjali Raman
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:The whole purpose of the JSTL and EL is to eliminate scriptlets from JSP pages, They are not meant to be used together, and mixing them in a page just makes a mess.

Processing should occur in the page controller, before the JSP page is forwarded to.




Thanks a lot for the reply
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic