Javazoom UploadBean - using UploadBean properties within jsp tags
I am working on a jsp web application and integrating the UploadBean from javazoom.net into it. I am using a MySQL database to capture all informaion about mp3 files being uploaded - filename, date, filetype, etc.
Can someone guide me as to whether it is possible to reference the properties of the UploadFile class within a jsp tag?
What I am trying to do is this - I want to capture the filename of the file I upload and store it in a MySQL database. Within the SimpleUpload.jsp page, the filename is accessed within scriplet code as follows:
file.getFileName();
(Where file is a variable representing an instance of the UploadFile class, and getFileName() is a method in this class that returns the file name you are uploading).
What I would like to do is use this method so that this same filename can be used in a a sql:update tag to populate a database with the filename and with the other details of the file which is uploaded.
Can anyone advise as to if this is possible and how? I tried to create a sql:update statement to populate the database with the result of file.getFileName();
The problem is that the sql:update jsp tag can't see the file.getFileName() object and method - it doesn't know about this object and method.
Thanks!
I'd still appreciate an answer to this if anyone can help.
Thanks.
Similar Messages
-
Using jsp variables within JSP tag
I have a variable defined within a JSP:
<%
String cust_id = request.getParameter("cust_id");
%>
I want to use this variable as a parameter to a custom tag:
<%@ taglib uri="/tlds/DBTags.tld" prefix="db" %>
<db:MultiColumnSelect columns="c.id, c.po" name="ccar_id" table_name="ccar_headers c, ccar_rmas r" selectString="r.ccar_id = c.id AND c.cust_id = <%= cust_id %>"/>
The selectString value that is passed to my tag is:
r.ccar_id = c.id AND c.cust_id = <%= cust_id %>
The <%= cust_id %> is not replaced by the actual variable value.
How would I accomplish using this variable within my JSP tag?Your definition of the selectString attribute must indicate that it can accept runtime expressions.
<%
String cust_id = request.getParameter("cust_id");
String selectString = new String("r.ccar_id = c.id AND c.cust_id = " + cust_id);
%>
<%@ taglib uri="/tlds/DBTags.tld" prefix="db" %>
<db:MultiColumnSelect columns="c.id, c.po" name="ccar_id" table_name="ccar_headers c, ccar_rmas r"
selectString="<%= selectString %>"/> -
Using bean methods within JSP declaration
Is it true that bean methods will not work in JSP Methods ?
For example:
// get the bean
<jsp:useBean id="FormValidate" scope="session" class="fsm.frontendCtr.FormValidate" />
// build a new method in jsp
<%!
boolean validate(HttpServletRequest req, String submitFlag) {
FormValidate.checkMandatory("ADRNACHNAME");
%>ServletExec return:
Undefined Variable or class name: FormValidate
If i use the bean Methods outside the method it worx.
Is there a trick with which I can use BeanMethods in a JSP Method?Is it true that bean methods will not work in JSP
Methods ?
For example:
// get the bean
<jsp:useBean id="FormValidate" scope="session"
class="fsm.frontendCtr.FormValidate" />
// build a new method in jsp
<%!
boolean validate(HttpServletRequest req, String
submitFlag) {
FormValidate.checkMandatory("ADRNACHNAME");
%>ServletExec return:
Undefined Variable or class name: FormValidate
If i use the bean Methods outside the method it worx.
Is there a trick with which I can use BeanMethods in a
JSP Method?FormValidate is this Object. If you need others, pass them from parameters. Try to understand the structure of servlet generated by your JSP.
<%!
boolean validate(HttpServletRequest req, String submitFlag) {
this.checkMandatory("ADRNACHNAME");
%>
hope this helps,
yang -
NullPointer using weblogic's xslt jsp tags
I get the following stack trace (at the bottom), using the xslt tag provided by weblogic
<%@ taglib uri="xmlx.tld" prefix="x"%>
<x:xslt xml="test.xml" />
In, this case the test.xml contains the reference to the stylesheet.
Any help would be greatly apprecieated.
java.lang.NullPointerException
at weblogicx.xml.tags.XsltTag.doEndTag(XsltTag.java:207)
at jsp_servlet._portlets._xmltest.__content._jspService(content.jsp:7)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:945)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:332)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:376)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:242)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispat
cherImpl.java:539)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispat
cherImpl.java:368)
at weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:119
at jsp_servlet._framework.__portlet._jspService(portlet.jsp:84)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:945)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:332)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:242)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispat
cherImpl.java:539)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispat
cherImpl.java:368)
at weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:119
at com.bea.portal.render.servlets.jsp.taglib.RenderTag.renderPortlets(Re
nderTag.java:172)
at com.bea.portal.render.servlets.jsp.taglib.RenderTag.doStartTag(Render
Tag.java:60)
at jsp_servlet._framework._layouts._spanningthreecolumn.__template._jspS
ervice(template.jsp:10)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:945)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:332)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:376)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:242)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispat
cherImpl.java:539)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispat
cherImpl.java:368)
at weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:119
at jsp_servlet._framework.__page._jspService(page.jsp:64)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:945)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:332)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:242)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispat
cherImpl.java:539)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispat
cherImpl.java:368)
at weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:119
at jsp_servlet._framework.__portal._jspService(portal.jsp:19)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:945)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:332)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:242)
at weblogic.servlet.internal.RequestDispatcherImpl$ForwardAction.run(Req
uestDispatcherImpl.java:341)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServic
eManager.java:721)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispat
cherImpl.java:251)
at com.bea.portal.appflow.servlets.internal.PortalWebflowServlet.doGet(P
ortalWebflowServlet.java:146)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:945)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:332)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:242)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:5360)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServic
eManager.java:721)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3043)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2468)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)Soory, I used taglib from http://www.coldsuite.com/jsp.htm
-
How to use bean:write inside jsp:include ?
I got a problem about JSP's syntax. The following is my code:
<%@ include file="<bean:write name="HelloForm" property="target" />"%>
The double quotes inside bean:write is my problem. Could you please teach me how to use bean:write within JSP's include? Thank you!http://java.sun.com/products/jsp/syntax/1.2/syntaxref12.html
Include Directive vs <jsp:include>
The include directive <%@include %> is done at page translation/compile time.
It effectively pastes in a static file, and then compiles the JSP as if it was all one file.
As such, you cannot provide a runtime expression to it.
To do runtime inclusion, you need to use the <jsp:include> tag which does except runtime parameters.
<%String test = request.getParameter("pageInfo");%>
<%String link = test + ".jsp"; %>
<jsp:include page="<%= link %>" %>Unfortunately you can't use the tag with a bean:write tag as well, you can only use runtime expressions, not tag. So you have to do the include with
<jsp:include page="<%= HelloForm.getTarget() %>" />
Cheers,
evnafets -
F:invokeUrl jsp tag and child objects
Hey all,
Does anyone know if its possible to use the f:invokeUrl tag on a method in a child object? eg:
<f:invokeUrl var="myObject.myChildObject" methodName="myMethod" />
I've also tried:
<f:invokeUrl var="${myObject.myChildObject}" methodName="myMethod" />
with no luck. I've gotten the above to work using the f:invoke jsp tag.
What I'm trying to do is put my ajax type functions in the objects that make the most sense. If I can't get this to work, I'll need to make presentation objects with all my ajax functions, create an instance and put it into scope, which I rather not do.
Thanks,
GrahamGraham,
I can't say if it will work or not, because its a better practice to leave all logic outside of the jsp (and I really don't know!). Do the logic in an activity, then only use the jsp to display the values. Keeping the logic outside is a much easier way to keep track of the data, and also re-use if necessary.
Customarily, a 'view' object is created. FileStatusView for example, would be a BPM Object that contains all the values to be displayed in a JSP or presentation.
Hope thats helpful!
-Kevin -
Is a JSP Tag Library providing Oracle Financial look and feel available
We are going to use Oracle Financial as part of our future application.
That is why other parts of it (which we plan to develop using JDeveloper)
have to have the same Look and Feel.
Is a JSP Tag Library that provides Oracle Financial Look and Feel available?Oracle Applications use BC4J, UIX, and JDeveloper.
The UIX framework implements the Oracle "Browser Look And Feel" (BLAF) that our Oracle Applications self-service applications use.
The UIX JSP tag library lets JSP developers do the same. -
In javascript how to use jsp tag value
i want to change td value while clicking the options.In the td contains jsp page.while clicking the options i want to load particular jsp within in the td.i change the td value using innerHTML by assigning value this format <jsp:include page="..."/>.It's gives some error .
JspTranslate:Attribute has no value
code:
function rightPageload(strPage) {
pageval='<jsp:include page="/jsp/library/"'+strPage+'"/>'
document.getElementById("d1").innerHTML=pageval;
}Do you want to use taglibs or develop custom tags? Either way take a look at these:
http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPTags.html
http://www.stardeveloper.com/articles/display.html?article=2001081301&page=1
http://www.onjava.com/pub/a/onjava/2000/12/15/jsp_custom_tags.html
http://jakarta.apache.org/taglibs/tutorial.html
http://www.ibm.com/developerworks/edu/j-dw-java-custom-i.html
http://www.herongyang.com/jsp/tag.html -
How to get the values of an Array using JSP Tags
Hey guys,
I need some help. I've splited a String using
fn:split(String, delim) where String = "1,2,3,4" and delim is ,
This method returns an Array of splited Strings. how do i get the values from this array using jsp tags. I don't wanna put java code to achive that.
Any help would be highly appreciated
ThanksThe JSTL forEach tag.
In fact if all you want to do is iterate over the comma separated list, the forEach tag supports that without having to use the split function.
<c:set var="list" value="1,2,3,4"/>
<c:forEach var="num" items="${list}">
<c:out value="${num}"/>
</c:forEach>The c:forTokens method will let you do this with delimiters other than a comma, but the forEach tag works well just with the comma-delimited string. -
Error when run a simple sample using jsp tag
When i run a jsp using jsp tag, the tomcat gave me the following information:
Resolve entity failed-//Sun Microsystems,Inc.//DTD JSP Tag Library 1.2//EN http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd
My tld file is:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>sample</short-name>
<uri>WEB-INF/sampleTag</uri>
<display-name>SampleTag</display-name>
<description>Sample TLD</description>
<tag>
<name>time</name>
<tag-class>com.sample.taglib.TimeTag</tag-class>
<body-content>empty</body-content>
</tag>
</taglib>
Anybody can tell me why?
Thanks!!!It's strange bacause DTD is available under given address.
Which JSP version are you using?
Do you have any other tld file, which uses the same DTD version? Do tags define in it work properly?
Maby try to use 1.1 version of DTD?
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">But remember than version 1.1 has another node names (see http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd). -
Using scriplets in jsp-tag attribute
I have a strange problem with a custom taglibrary that I'm trying to write.
When I use the tag in a jsp like underneath the first outputs the right value (Welcome Hans), but the output of the second time shows: Welcome <%= test %>
This is a part of the JSP:
<% String test = "Hans"; %>
<arto:hello name="Hans" />
<arto:hello name="<%= test %>" />
I realy don't know how to let the tag display the value of the string in my jsp.
Can anyone give me some advice?
Thanks,
Hans
The files are:
import java.io.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
public class HelloTag extends TagSupport {
private String name;
public void setName(String name) {
this.name = name;
public int doStartTag() throws JspException {
try {
pageContext.getOut().print("Welcome " +name);
} catch (IOException ioe) {
throw new JspException("Error: IOException while writing to client");
return SKIP_BODY;
public int doEndTag() throws JspException {
return SKIP_PAGE;
The JSP:
<%@ taglib uri="arto" prefix="arto" %>
<%
String test = "Hans";
%>
<arto:hello name="<%= test %>" />
<arto:hello name="Hans" />
The TLD:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname></shortname>
<uri></uri>
<info></info>
<tag>
<name>hello</name>
<tagclass>HelloTag</tagclass>
<bodycontent>empty</bodycontent>
<info>Tag with Parameter</info>
<attribute>
<name>name</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
</taglib>In the tld for the name attribute, use
<rtexprvalue>true</rtexprvalue>
This specifies that the attribute value can be a run-time expression. Otherwise, the value is taken as a literal. -
I am trying to create two frames in my JSP page . However it just displays a blank page on execution.
I am using following code to create frames:
<hbj:content id="myContext" >
<hbj:document>
<hbj:documentHead>
<frameset cols="100,*" border=1 frameborder="1">
<frame name="frame1"
src ="http://www.yahoo.com">
<frame name="frame2"
src= "http://www.google.com">
</frameset>
<hbj:documentHead>
</hbj:document>
</hbj:content>
ThanksNeeti,
Just get rid of JSP tags and put the frameset html on jsp page. It should work without JSP tags.
<html>
<frameset cols="100,*" border=1 frameborder="1">
<frame name="frame1"
src ="http://www.yahoo.com">
<frame name="frame2"
src= "http://www.google.com">
</frameset>
</html>
Message was edited by: Prakash Singh -
Using variables in a jsp:useBean tag
I was wondeing if it is possible in any way to use variables in a jsp:useBean tag. Here is an example of what I am trying to do.
<%
String beanType = request.getParameter( "bean" );
if( beanType.equals( "Bean1" ) ) {
beanClass = "com.myCompany.Bean1";
} else {
beanClass = "com.myCompany.Bean2";
%>
<jsp:useBean name="<%= beanType %>" class="<%= beanClass %>"/>
I also tried using this approach
<%
if( beanType.equals( "Bean1" ) ) {
%>
<jsp:useBean id="bean" class="com.myCompany.Bean1"/>
<%
} else if( beanType.equals( "Bean2" ) ) {
%>
<jsp:useBean id="bean" class="com.myCompany.Bean2"/>
<%
%>
Neither approach seems to work. Is there any way around this problem?
Thanks,
Marcus.Hi,
check:
http://forum.java.sun.com/thread.jsp?forum=45&thread=398998&tstart=75&trange=15 -
How html textfield use i jsp tag
hi master
sir see my php code i get input in name and fname text box and pass in php tag for insertion into database
<html>
<body>
<form action="mfa.php" method="post">
First Name<input type="text" name="fname">
Second Name<input type="text" name="lname">
<input type="submit" name"Insert">
</form>
<?php
//Inserting records into database
$firstname=$_POST['fname'];
$lastname=$_POST['lname'];
mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("test1");
mysql_query("INSERT INTO persons (Firstname, Lastname) VALUES ('$firstname','$lastname')");
echo "Data Inserted";
?>
<?php
//showing resutls in browser
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("test1") or die(mysql_error());
$result = mysql_query("SELECT * FROM persons") or die(mysql_error());
echo "<table border='1'>
<tr>
<th>First Name</th>
<th>Last Name</th>
</tr>";
while($row = mysql_fetch_array( $result ))
echo "<tr>";
echo "<td>" . $row['Firstname'] . "</td>";
echo "<td>" . $row['Lastname'] . "</td>";
echo "</tr>";
echo "</table>";
?>
</body>
</html>
how i use html text box and pass to jsp tag for insertion data into database
please give me sample code
thank's
aamirI have never had any problems mixing straight HTML (without the verbatim tag) and JSF tags. OTOH, I use facelets, not JSPs, so my experience may not be applicable.
-
uix:table using JSP tags
I cannot figure out how to bind a dataobject list using the <uix:table> tag. Could someone please help me with this.
Jeff DriskellDo you mean that you already have a DataObjectList which you want to set as the <uix:table>'s tableData attribute? If so, I believe you have two choices:
1. You can use a scriptable variable for the table and call setTableData() explicitly on the TableBean.
2. You can use a scriptable variable for a dataScope and register a DataProvider which provides access to your DataObjectList. Then, you can use the tableDataBinding attribute of the <uix:table> tag to bind to your DataProvider.
Examples of both of these techniques are provided in the "Scriptable variables" section of the "UIX JSP Tag Libraries" section of the UIX Developer's Guide.
Maybe you are looking for
-
For example, I saved a jpeg named 'picasso the guitarist'. I have folders titled A to Z. When I click 'save as' it might open the 'K' folder and I have to manually search the 'P' folder for 'Picasso' and save file. The most irritating thing is, when
-
Little stuttering on 3e monitor
After installing a 2 videocard to play the 3e monitor and some help from the forum this works principally. One problem in this setting stay's. It looks if ones or twice per seconde the picture on the monitor "freezes" shortly, or plays back two frame
-
Quick selection tool only wants to make angular selections
I'm using PS CC on a Mac, OS 10.9.4 . My quick selection tool suddenly decided to be heavily biased towards making angular selections. It REALLY does not want to follow curves. I have restarted the computer and checked that the brush size and other
-
Dynamically pass the date to all the programs in a chain
Hi, I have a requirement to pass the date to all the programs in the chain. The first step when the chain starts should be to calculate the next batch date from a oracle table, and then pass that date as an argument to all the programs. For example,
-
Using trial version of iWord. I know I can save a document as a ms word file. However, is there a way to have all docs saved as ms word docs automatically, without having to choose that option at each save?