Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 712583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:51:51+00:00 2026-05-14T04:51:51+00:00

I’m using Spring Web Flow (v. 1.0.5) and I have a JSP page that

  • 0

I’m using Spring Web Flow (v. 1.0.5) and I have a JSP page that makes an AJAX call to a flow and needs to read in the XML results. That flow successfully sets an object into the FlowScope, then calls a JSP page to render the results. In the JSP page, I’d like to test whether the object has a property (say, .firstName) and if so, do something. I can access the variable in the FlowScope using JSTL expression language (by saying ${userObj}), but that just lets me spit it out. I’ve tried the methods below to get at it and put logic around it, with varying success.

Update: The remaining question is: How do I get the context and flow scope in the scriptlet (<% %>) section?

<rootnode>

<!--  Attempt 1:  c:if isn't being interpreted (though ${userObj.firstName} is),
      it's just displaying the tags on the page. -->
<!--  Update, I didn't have the <%@ taglib directive for jstl/core.  
      Now I do, and they're being interpreted, but it says 
         "According to TLD or attribute directive in tag file,
          attribute test does not accept any expressions"
      How can the if/@test not accept expressions?  Isn't that its whole purpose
      in life? -->
<!--  Update 2, I also forgot the taglib for the rt language, which is separate,
      I guess (jstl/core_rt).  <c:if test now works properly. -->
<c:if test="${!empty(userObj.firstName)}">
<test>not empty</test>
</c:if>

<%
/* Attempt 2:  This throws an error, can't resolve "context".  How do I get the context? */
if (context.getFlowScope().userObj != null) {
    out.write("not null");
} else {
    out.write("not not null");
}
%>

<!--  Attempt 3:  This works, I get the reference to the Object and it
      spits out the correct firstName, gives me no control other than
      spitting out the value. -->
<userReference>${userObj}</userReference>
<userReference_firstName>${userObj.firstName}</userReference_firstName>

</rootnode>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:51:52+00:00Added an answer on May 14, 2026 at 4:51 am

    Attempt 1 should work if you installed JSTL and declared the taglib the right way and declared the web.xml to be at least Servlet 2.4. Also see the questions:

    • Where do I put jstl.jar and standard.jar so that Netbeans don't give errors/warnings?
    • ModelAttributes not accessible on jsp

    To test if an object is empty or not, you should rather use the following construct:

    <c:if test="${not empty userObj.firstName}">
    

    or

    <c:if test="${userObj.firstName != null}">
    

    Attempt 2 is strongly discouraged. Scriptlets are a poor practice and should always be replaced by taglibs like JSTL and EL (as you did in attempt 1). If it’s not possible for technical reasons, then the coding ought to be done in a real Java class, (indirectly) starting with a Servlet.

    Attempt 3 is doable, but I would recommend to use servlet with a Javabean-to-XML serializer like XStream instead. This way you can just feed a collection of Javabeans to the outputstream of the response transparently.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
I want to count how many characters a certain string has in PHP, but
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
In order to apply a triggered animation to all ToolTip s in my app,
I want use html5's new tag to play a wav file (currently only supported
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
Does anyone know how can I replace this 2 symbol below from the string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.