Use JSTL tags for ATG droplets and beans
Hi,
I am trying to display profile values in a JSON object in jsp.
<dsp:getvalueof var="json" bean="ProfileFormHandler.ProfileJSON"></dsp:getvalueof>
<c:out value="${json}" />
but instead of using dsp tag is there a way for accessing ProfileFormHandler using JSTL tag
Also how can we use droplets in ATG like ForEach using JSTL tags only
<dsp:droplet name="ForEach">
<dsp:param name="array" param="catalogItems.rootCategories"/>
<dsp:param name="elementName" value="categoryItem"/>
I am trying to display profile values in a JSON object in jsp.
<dsp:getvalueof var="json" bean="ProfileFormHandler.ProfileJSON"></dsp:getvalueof>
<c:out value="${json}" />
but instead of using dsp tag is there a way for accessing ProfileFormHandler using JSTL tagIn the <dsp:importbean> use var to give an EL variable name to the component you are importing.You can also set its scope attribute to page, request, session, or application with page scope being the default. You can then access it as a page scoped attribute. So this should do:
<dsp:importbean var="profileFormHandler" bean="/atg/userprofiling/ProfileFormHandler" />
<c:out value="${pageScope.profileFormHandler.ProfileJSON}" />In case you change the scope in importbean you can accordingly use pageScope, requestScope, sessionScope or applicationScope.
Also how can we use droplets in ATG like ForEach using JSTL tags only
<dsp:droplet name="ForEach">
<dsp:param name="array" param="catalogItems.rootCategories"/>
<dsp:param name="elementName" value="categoryItem"/>Any ATG droplet is nothing but a servlet which is also a Nucleus component. So essentially you want to call a servlet from JSTL which as such shouldn't be done in a well written script-less JSP. You can probably try to use the droplet as a bean and use JSTL on top of it but since ATG droplets also have different types of parameters like input, output and open so you will have to specially handle those.
Similar Messages
-
Cannot use jstl tag for jsp page which generated from Human Task
Hi
Plz help me.
I have tried to using jstl in jsp which generate from Human Task and I deploy it to server( by ant on Jdev ) to see task detail in Oracle Worklist application. But when i submit task and then I access to worklist to see task detail, the error has show in page that "OracleJSP: An error occurred. Consult your application/system administrator for support. Programmers should consider setting the init-param debug_mode to "true" to see the complete exception message. " .
I access server to see application.log to see error and I see error show "workflowform: JspServlet: unable to dispatch to requested page: Exception:oracle.jsp.parse.JspParseException: /Header1.jsp: Line # 3, <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%> "
How do I fix this error?
PS. I tried to us jstl because I need to connet to database which jstl tag(sql) if somebody has another solution for connect database in task detail page, Please help suggest me.
Thanks
user520932Is the jstl tag libray loaded in the appsserver?
Can you use jdbc connection like
DataSource ds = ic.lookup("java:comp/env/jdbc/myDB");
Connection con = ds.getConnection();
DataSource ds = (DataSource) org.apache.derby.jdbc.ClientDataSource()
ds.setPort(1521);
ds.setHost("localhost");
ds.setUser("APP")
ds.setPassword("APP");
Connection con = ds.getConnection();
http://java.sun.com/docs/books/tutorial/jdbc/basics/connecting.html -
I can't use JSTL tag for read rss.
I want to read rss from another web. but I can't read rss . I use Netbeans and I add JSTL Library already. I can use forEach tag but every time when I use xml tag it show error. This is my code for read rss. I don't know how to read rss with JSTL tag please help me.
<h6><!-- Filename: ShowStudents.jsp -->
<%@taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<HTML>
<BODY>
<c:import var="xmlDoc" url="http://www.manager.co.th/RSS/Home/Breakingnews.xml"/>
<x:parse var="parsedDocument" xml="${xmlDoc}"/>
<table>
<tr>
<th>Title : </th>
<th>Link : </th>
</tr>
<x:forEach select="$parsedDocument/channel/item"> // This code I ever been change to $parsedDocument/rss/channel/ and $parsedDocument/rss/channel/title ,but it show same error.
<tr>
<td> <x:out select="title" /> </td>
<td> <x:out select="link" /> </td>
</tr>
</x:forEach>
</table>
</BODY>
</HTML></h6>
when I run this code it show error like this. how to read rss with JSTL tag please help me.
<h6>
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: org.xml.sax.SAXParseException: Content is not allowed in prolog.
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:527)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:401)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
Filter.ThaiRequest.doFilter(ThaiRequest.java:38)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
root cause
javax.servlet.ServletException: javax.servlet.jsp.JspException: org.xml.sax.SAXParseException: Content is not allowed in prolog.
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.test_jsp._jspService(test_jsp.java:101)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
Filter.ThaiRequest.doFilter(ThaiRequest.java:38)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
root cause
org.xml.sax.SAXParseException: Content is not allowed in prolog.
com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:249)
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
org.apache.taglibs.standard.tag.common.xml.ParseSupport.parseInputSource(ParseSupport.java:227)
org.apache.taglibs.standard.tag.common.xml.ParseSupport.parseInputSourceWithFilter(ParseSupport.java:193)
org.apache.taglibs.standard.tag.common.xml.ParseSupport.parseReaderWithFilter(ParseSupport.java:199)
org.apache.taglibs.standard.tag.common.xml.ParseSupport.parseStringWithFilter(ParseSupport.java:206)
org.apache.taglibs.standard.tag.common.xml.ParseSupport.doEndTag(ParseSupport.java:138)
org.apache.jsp.test_jsp._jspx_meth_x_005fparse_005f0(test_jsp.java:150)
org.apache.jsp.test_jsp._jspService(test_jsp.java:80)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
Filter.ThaiRequest.doFilter(ThaiRequest.java:38)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
</h6>
Edited by: user12864851 on 15 ม.ค. 2554, 22:59 น.Ok, I did a bit more experimenting, and web searching, and found you are the victim of the UTF-8 BOM bug.
Basically the java UTF-8 reader does not recognise a BOM at the start of a UTF-8 stream, and it has to be discarded manually.
For details: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508058
Here is a 'fixed' JSP for you.
<%@taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<HTML>
<BODY>
<c:import var="xmlDoc"
url="http://www.manager.co.th/RSS/Home/Breakingnews.xml"
charEncoding="UTF8" />
<%--
JSTL hack to work around the UTF-8 BOM bug in JDK.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508058
--%>
<c:set var="testChar" value="fn:substring(xmlDoc, 0, 1)}"/>
<c:if test="${testChar != '<'}">
<c:set var="xmlDoc" value="${fn:substring(xmlDoc, 1, fn:length(xmlDoc))}" />
</c:if>
<table>
<tr>
<th>Title :</th>
<th>Link :</th>
</tr>
<x:parse var="parsedDocument" doc="${xmlDoc}" />
<x:forEach select="$parsedDocument/rss/channel/item">
<tr>
<td><x:out select="title" /></td>
<td><x:out select="link" /></td>
</tr>
</x:forEach>
</table>
</BODY>
</HTML>cheers,
evnafets -
Posting huge data on to JSP page using JSTL tags
Hi,
I have one application where I have to post huge data (approximately 2000 rows of data) into JSP page. I am using JSTL tags and running on Tomcat 5.
It is taking almost 20 to 25 seconds to load the entire page.
Is it the optimal time to load or it could be improved?
Please let me know.
Thanks,
--Subbu.Hi Evnafets,
Thank you for the response.
Here are the tasks I am doing to display the data on JSP.
0. We are running on Tomcat 5 and the memory size is 1024MB (1GB).
1. Getting the data - I am not performing any database queries. The data is stored in the static cache memory. So the server side response is so quick - less than a milli second.
2. Using Java beans to pass data to the presentation layer (JSP).
3. 10 'if' conditions and 2 'for' loops and 2 'choose' statements are being used in the JSP page while displaying the data.
4. Along with the above, there are 4 javascript files are being used.
5. The jsp file size after rendering the data, is aprox. 160 kb
Hope this information helps you to understand the problem.
Thanks,
--Subbu. -
Can i use Custom Tags for Database retrieval (as per MVC pattern)?
In our project we are dealing with database, and i've used the Cutom Tags for database retrieval (as per the Article from Mr Faisal Khan) and it is working fine. But i have a doubt if it affects the performance in any way . I wanted to know if its recommendable to use Custom Tags for the DB retrieval as per MVC Pattern or shall i create a intermediate bean and then call the bean in custom tag.
Thanks
PrakashPutting database code in your JSPs certainly couples your view to the database. That's usually not good.
If it's a simple app, it might be justified.
When you start having lots of pages and complex business logic it becomes less attractive. - MOD -
Problem in using JSTL tag libs
Hi there,
I am trying to use JSTL tag libs in my web app, but i get the following error message:
org.apache.jasper.JasperException: /index.jsp(22,0) According to TLD or attribute directive in tag file, attribute test does not accept any expressions
as it might be clear i am using Tomcat and line 22 of the code for index.jsp is:
<c:if test="${user.role > 0 }">
Please help my identify whats wrong in there. I suspect that it is because of my web.xml file, but i am not sure.
thanx in advance,
Capitan Haddocktry to use gt instead of >
-
How to write this java code in jsp using jstl tags?
Can anybody help me on this?
I dont know how to check the containsKey using jstl tags?
<%
LinkedHashMap yearMap = (LinkedHashMap)request.getAttribute("yearMap");
TreeSet nocSet = (TreeSet)request.getAttribute("nocSet");
Iterator yearMapIt = yearMap.keySet().iterator();
while(yearMapIt.hasNext())
int yearValue = (Integer)yearMapIt.next();
%>
<tr>
<td><%=yearValue%></td>
<%
LinkedHashMap monthMap = (LinkedHashMap)yearMap.get(yearValue);
Iterator nocSetIt = nocSet.iterator();
while(nocSetIt.hasNext())
String nCase=(String)nocSetIt.next();
if(monthMap.containsKey(nCase))
String count = (String)monthMap.get(nCase);
%>
<td> <%= count %> </td>
<% }
else
%>
<td> 0 </td>
<%
%>
</tr>
<% } %>Edited by: avn_venki on Feb 18, 2008 11:54 PM<c:forEach var="yearMap" items="${requestScope.yearMap}">
<th> <c:out value="${yearMap.key}"/> </th>
<bean:define id="monthMap" value="${yearMap.value}"/>
<c:forEach var="nocSet" items="${nocSet}">
then how to write containsKey using tags?? -
Problem using application client for local stateful session bean
Hi,
I have deployed a local stateful session bean in Sun J2EE 1.4 application server.
On running the applclient for the stateful session bean application client i get the following error:
Warning: ACC006: No application client descriptor defined for: [null]
cant we use application client for local stateful session beans. becoz the application runs smoothly when i changed the stateful sesion bean to remote.Hi,
No, an ejb that exposes a local view can only be accessed by an ejb or web component packaged within the same application. Parameters and return values for invocations through the ejb local view are passed by reference instead of by value. That can't work for an application client since it's running in a separate JVM.
--ken -
Is it possible todeclare primitive variable by using JSTL tag
Hi friends..........
I have to use jstl tags in my project , so i have to know how to declare primitive variables with jstl tag. Is it possible with <c:set > jstl tag........
Hope i get the answer...........
Thanks in advance...............JSTL variables are attributes in the page, request, session and application scopes.
As such, they can only be objects, because you can't store a primitive value as an attribute.
However you shouldn't need to declare primitive variables. You should hardly need to declare any variables.
JSTL is not a programming language. It is a language to aid the display of a JSP. Therefore most of its attention is geared towards outputting things, with a much lesser concern on setting them.
Cheers,
evnafets -
I have developed an app, which shows some numbers which are 10 digit long. I used meta tag for removing the formatting for telephone, so that the phone doesnt take those numbers as phone numbers.
It works fine when that page is launched through safari in iphone, but when i add an icon for that app to my iphone desktop and then launch it, the numbers are underlined.
I am using iPhone 4, Can anyone help, to remove those underlines?I have developed an app, which shows some numbers which are 10 digit long. I used meta tag for removing the formatting for telephone, so that the phone doesnt take those numbers as phone numbers.
It works fine when that page is launched through safari in iphone, but when i add an icon for that app to my iphone desktop and then launch it, the numbers are underlined.
I am using iPhone 4, Can anyone help, to remove those underlines? -
I'm installing the new OS and iPhone is asking for a password to "restore" my iPhone, but I've never used a password for the phone and don't know what it is! Can anyone help??
You selected Encrypt iPhone Backups in iTunes. Then you entered a password.
It would be that specific password it is asking for.
See here:
https://discussions.apple.com/thread/3284065?start=0&tstart=0 -
I am using Numbers app for the ipad and it has been working absolutely fine but now, when I want to email a spreadsheet as a PDF via the 'share and print' option, the file now doesn't appear as an attachment to the recipient. Any ideas please?
Hi mafiose15,
Thanks for visiting Apple Support Communities.
Restoring your iPod to factory settings is the best way to try and get it back to working order. You can use the instructions below to restore it:
How to restore iPod
Verify that you have an active Internet connection, because you may need to download new versions of the iTunes and iPod Software.
Download and install the latest version of iTunes if necessary.
Open iTunes. Connect your iPod to your computer using the USB or FireWire cable that came with your iPod.
After a few moments, your iPod will appear in the Source panel in iTunes.
Select your iPod in the Source panel. You will see information about your iPod appear in the Summary tab of the main iTunes window.
Click Restore.
If you are using a Mac, you will be asked to enter an administrator’s name and password.
A progress bar will appear on the computer screen, indicating that stage one of the restore process has begun. When this stage is done, iTunes will present one of two messages with instructions specific to the iPod model you are restoring.
Disconnect iPod and connect it to iPod Power Adapter (typically applies to older iPod models).
Leave iPod connected to computer to complete restore (typically applies newer iPod models).
During stage two of the restore process, the iPod displays an Apple logo as well as a progress bar at the bottom of the display. It is critical that the iPod remain connected to the computer or iPod power adapter during this stage.
Note: The progress bar may be difficult to see, because the backlight on the iPod display may be off.
After stage two of the restore process is complete, the iTunes Setup Assistant window will appear. It will ask you to name your iPod and choose your syncing preferences, as it did when you connected your iPod for the first time.
You can find the instructions in this article:
Restoring iPod to factory settings
http://support.apple.com/kb/ht1339
All the best,
Jeremy -
i have two iphone one is iphone 5 and othere is iphone 4 . can i use same id for both ? And do i have to purchase the application again for iphone 4 which i have buyed for iphone 5.??
You can use the same Apple ID for both phones, you would then be able to use the purchased Apps/Content on both phones without having to pay again.
-
Can I use a domain for one site and mobile me for a different site?
Can I use a domain for one site and mobile me for a different site?
I have two sites, I would like to have up and I would like to do one through a domain and one through mobileme is this possible?Yes you can. You can use the CNAME method of forwarding for the first site (the top site in iWeb) and use the MMe URL for your account for the other site: http://web.me.com/YourAccount_Name/SiteName/
OT -
I have Lightroom 6 (not CC) on a Windows machine. I'm prompted to log into Creative Cloud when I restart my computer (I don't have, use, or pay for Creative Cloud), and then when I launch Lightroom, it tells me to use the application I have to log into my Adobe account...AGAIN! And then to further add insult to injury, I'm prompted to enter in the license number of my product. I've gone through this process a dozen times now...SCREAM!!!
Paulou12 what type of a Creative Cloud Membership do you have? You can find details on how to update Lightroom using the Creative Cloud Desktop application at Install and update apps - https://helpx.adobe.com/creative-cloud/help/install-apps.html.
Finally if you are in a managed environment then please work with your I.T. department to apply the update.
Maybe you are looking for
-
Desktop will not load, stuck on blue screen -- please help!
As I can see, many other Mac users have encountered the same problem that I now have: the dreaded ‘blue screen of death’. About a week ago, any internet browser that I tried to open (Safari, Firefox) would freeze after loading its home page, and tell
-
How to limit the no of records per page in crystal reports 2008
I have to limit the number of records =10 per page in crystal reports 2008. Any help appreciated.
-
Unable to open PDF in Web Browser and delay for printing
In my LAN, on several PCs running with Windows 7 (32 and 64 bits), I observe two problems with "Acrobat Reader XI": - Delays / unable to open pdf files in the web browser (Internet Explorer). - Delays in printing: for example it takes over 8 minutes
-
Tried posting this in the newbie section with no luck.... I created a class extending a JScrollPane that encompasses a JTextPane. The method below appends some text to the current JTextPane with a certain color (this part works fine). What I am also
-
I have already tried deleting com.apple.ichat.plist. What else can I do?? I had been using ichat and all the sudden it logged out and now I can't log back in. Thank you!